We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 36734
    • 14 Posts
    Hi all,

    I have a weird issue with my lexicon. I have a website translated in quite a few languages, but focusing on English/Chinese for now.

    I have for example a lexicon entry whose key is 'name', English is "Name" and Chinese is "姓名".

    If I clear the cache and reset the lexicon, the lexicon is properly generated. I got the proper value for English context or Chinese context.
    Now, if I switched context (without clearing the cache), I always get the previous value (ie, if after clearing the cache, I load the English context, then switch to Chinese, the value for 'name' will be "Name" not "姓名").

    I tried different syntax:
    - [[%name? &namespace=`quote`]]
    - [[%name? &namespace=`quote` &language=`[[++cultureKey]]`]]

    I think they are equivalent, as (I assume), the language used for the lexicon is set by the cultureKey system setting.

    Any idea ? Am I doing it wrong ?
      • 36734
      • 14 Posts
      ah, first syntax is %name? &namespace=`quote` (for some reasons it doesn't show in the post if I put the brackets)
        • 36734
        • 14 Posts
        Additional information as I'm investigating:
        - the chunk that calls the lexicon entry seems to be cached uniquely for one context. If I put [++cultureKey] somewhere in it, clear the cache, load the page in Chinese, I see "zh" (which is correct), if I load the English version, I still see "zh", even though the cultureKey should be "en".

          • 28042 ☆ A M B ☆
          • 24,524 Posts
          This forum is a native MODx application; if you post MODx tags it thinks it's supposed to actually use them. To post code or tags, use the code tags from the post editing tool bar (the little < > button).
            Studying MODX in the desert - http://sottwell.com
            Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
            Join the Slack Community - http://modx.org
            • 36734
            • 14 Posts
            Ah, I'm a loser.

            The chunk is called in a snippet, not with $chunk.

            And I manually cached that.

            Sorry for that :/