We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
  • Is there a way to get the Babel language links to link to the corresponding page in the other context?
      Studying MODX in the desert - http://sottwell.com
      Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
      Join the Slack Community - http://modx.org
    • Babel have a snippet called "BabelLinks".
        zaenal.lokamaya
      • Yes, but it only provides links to the home page of the language chosen. I'm sure there must be some way to link to the corresponding page in the other language.
          Studying MODX in the desert - http://sottwell.com
          Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
          Join the Slack Community - http://modx.org
        • Susan,

          BabelLinks snippet should definitely provide a direct link to the « translated » resource, unless :

          • the « translated » resource is not published
          • there is no resource « marked » as translation (you might want to check the value of the TV used by Babel)

          In those cases, i remind that it links to the context site_start.
          Hope that will help
          • Ok, that's the holdup then. Makes sense. I haven't yet been able to figure out the Babel dialog when editing resources. Trying to do too much at once.
              Studying MODX in the desert - http://sottwell.com
              Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
              Join the Slack Community - http://modx.org
              • 44394
              • 2 Posts
              Hi,
              I'm new to modx (I usually work with Drupal).

              Is there anyway available script or module to allow the user to pick a language and save it as default for the next visit (the script in place uses Babel link but doesn't save the user's choice - the session is destroyed when he leaves the website) ?

              The code i've come up with works (detect first visit, if first visit display popup window, user chooses his languages, sets a cookie...) but won't match the one already in place.

              Thanks for your help.
                • 44394
                • 2 Posts
                i forgot : the modx version is 2.0.8.
                • I think that the solution you wrote here is the only way to do it. There is no finished module that could accomplish this. If the user is anonymous than there is no other way to store information other than a cookie as far as I can think of. There may be some idea of saving the ip address of the user and then having a script that tracks that, but I am not sure how reliable the IP address readout would be on the user. Usually you just get an IP from their provider.
                    Benjamin Davis: American web designer living in Munich, Germany and a MODX Ambassador. I am also co-founder of SEDA.digital, a MODX Agency.