Open bertoost opened 12 years ago
bobray submitted:
Two possible solutions:
Put this above the $lexicon->load() call:
$modx->setOption('cultureKey', $language);
markh submitted:
What about this:
$modx->lexicon->load('nl:namespace:topic');
bertoost submitted:
That is what I do Mark, only the language code is dynamic because I want them to be able to see all the languages that are possible. As the docs suggest this should work (and did before) but as you can see in my original text and screenshot there's a bug in the code.
bertoost submitted:
Just remembered myself to test this again; but all suggested options doesn't work. Please see the attachment and debug it a little
bertoost submitted:
This is working for me, but I'm still of the opinion this isn't right..
$modx->setOption('cultureKey', $lang); $modx->lexicon->load($lang.':mycmp:mytopic');
bertoost submitted:
Still not working in 2.2.8-pl
Using it like RTFM says doesn't work. The cultureKey setting is overruling anyway. Would be great if this can be fixed sometime.
bertoost submitted:
It's not that the lexicons from the given language are not working, they are loaded well.. but because the $modx->lexicon() method ends on the "cultureKey" setting every time, it will never show the one who's default. Even because $modx->getOption() pulls from context-settings and not from system-settings itself.
bertoost created Redmine issue ID 7262
I have made a component where you can add titles to entries, these titles are stored in the lexicon table, so $modx->lexicon() can be used for this. In the manager pages you can select an available language from a dropdown to see and modify the titles. This language can be different then the manager language is. To let this work I have done this inside the getlist processor (for example);
In 2.1.5 I have seen the lexicon->load() function is a bit different. The array where the lexicons are stored in is in 2.2 modified with $this->_lexicon[$defaultLanguage] and here the $defaultLanguage is always de manager_language and by default set to "en". This isn't right! Because now I cannot load other languages... at least; the array with other language topics is merged with the "en" array and not with the language array I want.
This seems a bug to me! Can you confirm that?