@PMS, your module sounds fantastic! By all means use anything you like from my implementation.
I started with the same goal of not having to alter existing templates, but quickly ran into the problem of how to access fields nested inside chunks rather than in the main template. I wasn’t able to find a system event at which the chunks had been retrieved but not parsed; I concluded that it wasn’t possible without parsing the chunks yourself with modx->parseChunk, but realised I’d need to make this recursive for chunks nested inside chunks nested inside chunks... - and that’s where I gave up, since I’d essentially be replicating what the modx parser does. This is why I ended up using a general purpose snippet instead, so I can replace any field in any template or chunk with either:
[!Translate? &tpl=`MyChunk`!]
or
[!Translate? &field=`myField`!]
Did you solve this problem, or will all fields need to be exposed in the main template?
I’ve realised that it should be possible to improve the Translate snippet so that it outputs all translations into the cache (perhaps as a serialised array since this is how the modx cache works) and then it would check the cache before querying the db and set a global array of placeholders with a reference to the desired language (since in some cases the field/chunk should fall back to the default language). This array would then be used by the LanguageSwitcher plugin to alter the modx->documentOutput accordingly.
I’ve also been playing with ManagerManager as a way to organise the translated fields into tabs within the Manager, it would be fairly easy to generate the relevant rules with an include in mm_rules.inc.php:
@BobRay - I think the wiki may be right in the sense that caching happens after OnWebPagePrerender fires, however I think it is $modx->documentContent that gets cached not
$modx->documentOutput.