We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 26503
    • 620 Posts
    I have added 2 new languages to an existing site, Spanish [Mexico] and Chinese - everything works just fine, logging into multoiple contexts, my custom lexicon entries etc.... the problem is that the login error messages are all in English regardless of the context a user is trying to log into!

    The specific error message is part of the core > login lexicon (login_cannot_locate_account) it does havve translations for both new languages

    What is the problem here??

    cultureKey(s) = es, en & zh
    locale(s) = es_MX, en_EN & zh_CN

    [Modx Revolution 2.4.something....]

    This question has been answered by BobRay. See the first response.

      *** Not just websites, we also create signage, banners, print, trade show displays and more! ***

      Sean Kimball CLP, CLS.
      Technical Director / Sr. Developer | BigBlock Studios
      ._______________________________________________.
      Bigblock Studios http://www.bigblockstudios.ca Web site design & development.
      27-1300 King Street East. Box 167 Oshawa, Ontario L1H8J4 Canada.
      phone/fax: 905-426-5525
      • 3749
      • 24,544 Posts
      Make sure that the base href tag in all your templates is called uncached:

      <base href="[[!++site_url]]" />
        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
        • 26503
        • 620 Posts
        I was using base_url not cached, but no difference. error messages are still in english


        Quote from: BobRay at Feb 04, 2016, 05:49 AM
        Make sure that the base href tag in all your templates is called uncached:

        <base href="[[!++site_url]]">
          *** Not just websites, we also create signage, banners, print, trade show displays and more! ***

          Sean Kimball CLP, CLS.
          Technical Director / Sr. Developer | BigBlock Studios
          ._______________________________________________.
          Bigblock Studios http://www.bigblockstudios.ca Web site design & development.
          27-1300 King Street East. Box 167 Oshawa, Ontario L1H8J4 Canada.
          phone/fax: 905-426-5525
          • 3749
          • 24,544 Posts
          Is this for the Manager login or the Login snippet?
            Did I help you? Buy me a beer
            Get my Book: MODX:The Official Guide
            MODX info for everyone: http://bobsguides.com/modx.html
            My MODX Extras
            Bob's Guides is now hosted at A2 MODX Hosting
            • 26503
            • 620 Posts
            Quote from: BobRay at Feb 04, 2016, 06:49 PM
            Is this for the Manager login or the Login snippet?

            It's the frontend login snippett other things are not translated as well - like the login countries snippett form control [though I'm not sure that is supposed to be]
              *** Not just websites, we also create signage, banners, print, trade show displays and more! ***

              Sean Kimball CLP, CLS.
              Technical Director / Sr. Developer | BigBlock Studios
              ._______________________________________________.
              Bigblock Studios http://www.bigblockstudios.ca Web site design & development.
              27-1300 King Street East. Box 167 Oshawa, Ontario L1H8J4 Canada.
              phone/fax: 905-426-5525
              • 3749
              • 24,544 Posts
              I think I see the problem. Surprisingly, the Login class does this:

              $this->modx->lexicon->load('login:default');


              There's no language specified, so it will use the current language. Have you created cultureKey Context Settings for each context?
                Did I help you? Buy me a beer
                Get my Book: MODX:The Official Guide
                MODX info for everyone: http://bobsguides.com/modx.html
                My MODX Extras
                Bob's Guides is now hosted at A2 MODX Hosting
                • 26503
                • 620 Posts
                Quote from: BobRay at Feb 05, 2016, 05:18 AM
                I think I see the problem. Surprisingly, the Login class does this:

                $this->modx->lexicon->load('login:default');


                There's no language specified, so it will use the current language. Have you created cultureKey Context Settings for each context?

                Yes, each context has a "cultureKey" setting. I've tried to get the login snippet to log the user into all the contexts [so they can switch languages] HOWEVER the &contexts=`es,en,zh` does not work. I have never got that to work properly on any multilingual site. I'v always used a plugin.
                <?php
                if($modx->context->get('key') != "mgr"){
                
                	switch ($_REQUEST['cultureKey']) {
                
                        case 'zh':
                            $modx->switchContext('zh');
                            break;
                
                        case 'es':
                            $modx->switchContext('es');
                            break;
                
                        default:
                            $modx->switchContext('web');
                            break;
                
                    }
                
                }


                I did try switching the &context to just the one context I was trying to log into. ~ still no dice.
                  *** Not just websites, we also create signage, banners, print, trade show displays and more! ***

                  Sean Kimball CLP, CLS.
                  Technical Director / Sr. Developer | BigBlock Studios
                  ._______________________________________________.
                  Bigblock Studios http://www.bigblockstudios.ca Web site design & development.
                  27-1300 King Street East. Box 167 Oshawa, Ontario L1H8J4 Canada.
                  phone/fax: 905-426-5525
                  • 3749
                  • 24,544 Posts
                  How about adding a language load in the switch statement in your plugin:

                  $modx->lexicon->load('zh:login:default');


                  You might have to comment out the lexicon load line in the Login class file for it to work.

                  Would it solve your problem if the login snippet had a &language property to use like this?

                  &language=`[++cultureKey]]`


                  Come to think of it, I think this would work -- replace the lexicon->load line in the Login class file with this (untested):

                  $ck = $modx->getOption('cultureKey', null, 'en');
                  $lang = $modx->getOption('language', $scriptProperties, $ck, true);
                  $modx->lexicon->load($lang . ':login:default');


                  If that works, you wouldn't need the &language property unless you needed override the context's cultureKey setting.

                  If this last solution works, the Login extra code could be updated to include it.
                    Did I help you? Buy me a beer
                    Get my Book: MODX:The Official Guide
                    MODX info for everyone: http://bobsguides.com/modx.html
                    My MODX Extras
                    Bob's Guides is now hosted at A2 MODX Hosting
                    • 26503
                    • 620 Posts
                    Quote from: BobRay at Feb 06, 2016, 07:25 PM
                    How about adding a language load in the switch statement in your plugin:

                    $modx->lexicon->load('zh:login:default');


                    You might have to comment out the lexicon load line in the Login class file for it to work.

                    Would it solve your problem if the login snippet had a &language property to use like this?

                    &language=`[++cultureKey]]`


                    Come to think of it, I think this would work -- replace the lexicon->load line in the Login class file with this (untested):

                    $ck = $modx->getOption('cultureKey', null, 'en');
                    $lang = $modx->getOption('language', $scriptProperties, $ck, true);
                    $modx->lexicon->load($lang . ':login:default');


                    If that works, you wouldn't need the &language property unless you needed override the context's cultureKey setting.

                    If this last solution works, the Login extra code could be updated to include it.


                    No idea what happened - after 3 days of not working, it just started working!!?? made NO changes to the code - weeeeiiirrd...
                      *** Not just websites, we also create signage, banners, print, trade show displays and more! ***

                      Sean Kimball CLP, CLS.
                      Technical Director / Sr. Developer | BigBlock Studios
                      ._______________________________________________.
                      Bigblock Studios http://www.bigblockstudios.ca Web site design & development.
                      27-1300 King Street East. Box 167 Oshawa, Ontario L1H8J4 Canada.
                      phone/fax: 905-426-5525
                      • 3749
                      • 24,544 Posts
                      If it's a cache issue, it could show up again. Saving things in the Manager clears the cache and might hide it temporarily.
                        Did I help you? Buy me a beer
                        Get my Book: MODX:The Official Guide
                        MODX info for everyone: http://bobsguides.com/modx.html
                        My MODX Extras
                        Bob's Guides is now hosted at A2 MODX Hosting