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

    With Revo, what is the better way to get (programmatically) the current language manager ?

    An equivalent of $modx->config[’manager_language’]

    Thanks
      • 5811
      • 1,717 Posts
      is it $modx->cultureKey in any cases (whatever the context) ?
        • 22303 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.