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

    How to change language of the site frontend?

    I have added second language and all lexicon entries, also for [[Login]] snippet.

    --
    Regards
    MM
    • Quote from: maciej.m at Jul 18, 2009, 11:28 AM

      How to change language of the site frontend?

      I have added second language and all lexicon entries, also for [[Login]] snippet.
      That’s up to you as the site designer/developer to determine. Lexicons for use in the front-end is a new concept and I’m sure as component developers begin exploring i18n development for the front-end, a variety of solutions will be realized.

      There is an event, OnInitCulture, that is fired on initialization of the modX class which you could use to set the $modx->cultureKey (defaults to ’en’). This could be used to set the language for the request in a specific context, such as ’web’, and all subsequent calls to $modx->lexicon->load() should use that language unless specified in that function call.
        • 17838
        • 82 Posts
        Did you mean ’OnInitCulture’?
        • Quote from: maciej.m at Jul 19, 2009, 06:26 PM

          Did you mean ’OnInitCulture’?
          I did; sorry for the confusion. Trying to get multiple versions of PHP easily accessible via MacPorts had me distracted (sigh).
            • 28444
            • 6 Posts
            Quote from: OpenGeek at Jul 19, 2009, 11:07 PM

            Quote from: maciej.m at Jul 19, 2009, 06:26 PM

            Did you mean ’OnInitCulture’?
            I did; sorry for the confusion. Trying to get multiple versions of PHP easily accessible via MacPorts had me distracted (sigh).


            I’ve only encountered errors when identical_tvs was set to "not configured" string (the default value) or when the identical_tvs was equal to 0.
            Deleting this field (null value) OR setting the value equal to the ID of babel_ids TV was the solution for me.

            Thank you both of you.
              • 28215
              • 4,149 Posts
              You could also just add a context setting for ’cultureKey’ and set it to the IANA code for your language...
                shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com