(Warning: long post!)
I have very special questions regarding i18n and maybe you have an idea:
I generally don't need to have a fully translated website. Some Resources needs to be in English (the MODX projects and some of the Blog entries or Tutorials) and the rest in German language. This should all be possible with only 1 context.
So I've written a plugin which loads lexicon files depending on the browser language.
The strings for the Templates and Chunks of the website are now provided by the lexicon files. The rest comes from the Resources.
This works fine with some caveats (especially the MODX caching is a problem here).
The plugin loads the appropriate lexicon + sets a placeholder with "de" or "en":
switch ($browserLanguage) {
case 'de':
$modx->lexicon->load('de:site:default');
$modx->setPlaceholder('browserLanguage', 'de');
break;
default:
$modx->lexicon->load('en:site:default');
$modx->setPlaceholder('browserLanguage', 'en');
}
The lexicon tags I use in chunks and Templates:
[[!%site.title_mainmenu? &language=`[[+browserLanguage]]`]]
1) The fist problem is, that all chunks which contains lexicon tags needs to be uncached - otherwise they will display the language of the first visitor.
2) The second problem is that the lexicon tags doesn't work without the &language parameter as they should.
Do you have any other idea on how to solve this in a better way?
Do I realy need 2 Contexts?
3) And what's about the Articles container for my Blog entries? How do I handle those in 2 Contexts?
Greetings,
Martin