With Revo, what is the better way to get (programmatically) the current language manager ?
An equivalent of $modx->config[’manager_language’]
Thanks
is it $modx->cultureKey in any cases (whatever the context) ?
-
MODX Staff
- 10,725 Posts
Well, do you want the cultureKey set for the specific context you are in? $modx->getOption(’cultureKey’) would get you that Setting (user, context or system, in that order of precedence) [NOTE: do not access $modx->config directly anymore]. But modX is automatically setting the cultureKey for the lexicon when a Context is initialized. Also, the Setting can be overridden by a SESSION or REQUEST var with the key cultureKey, as well. So in most cases, you can just reference $modx->cultureKey when you want to know the current language setting.
This is set in the protected method modX::_initCulture() and can be overridden by a plugin registered to the OnInitCulture event.