Translation not working with tagger

Hello,

I am experiencing an issue with the translation functionality of the Tagger plugin. Here is a detailed description of the problem:

In my template, I am calling TaggerGetTags as follows:

[[!TaggerGetTags? 
    &rowTpl=`TaglisteTpl`
    &groups=`[[!*SelectTags]]`
    &translate=1
]]

I am using this chunk for translation:
[[!+tag:taggerTranslated=tag]]

Here is the PHP snippet I am using:

<?php
$output = $input;
$options = $modx->getOption('options', $scriptProperties, '');
if (empty($options)) {
    return $output;
}

if (!$modx->lexicon->exists('tagger.custom_' . $options . '.' . $input, $modx->getOption('cultureKey'))) {
    return $output;
}
$output = $modx->lexicon('tagger.custom_' . $options . '.' . $input, [], $modx->getOption('cultureKey'));

return $output;
?>

Issue Description

I have translated all the lexicon entries correctly. However, I am encountering an issue where:

  1. When I make changes to the code and save it, the translated tags are displayed correctly upon the initial page refresh.
  2. After subsequent refreshes, the tags revert to displaying in English and remain in English thereafter.

Could you please assist me in resolving this issue so that the translated tags are consistently displayed?

Thank you!

When something works on an initial request and not on subsequent requests, the problem is usually cache related. But I can’t immediately see what the problem is, as all your tags seem to be uncached.

Does the translation fail for both the group names (&translate=`1`) and the tags (your custom output modifier “taggerTranslated”)?

Maybe try always loading the correct lexicon in your custom snippet → $modx->lexicon->load(...) before using it.


Also, please use code blocks in this forum when sharing code or MODX tags (to preserve the backticks):

```//line with 3 back-ticks at the beginning
//your code here
```//line with 3 back-ticks at the end