On March 26, 2019 we launched new MODX Forums. Please join us at the new MODX Community Forums.
Subscribe: RSS
  • Hi,

    I am using Lingua Plugin. All looks great! I do have one question though.

    When switching languages, I get the language URLs as per following examples:

    https://mydomain.com?lang=en (for English)
    https://mydomain.com?lang=fr (for French)
    etc ...

    What I am looking to achieve is to switch these to:

    https://mydomain.com/en (for English)
    https://mydomain.com/fr (for French)
    etc ...

    Which would also work with child resources, ex. https://mydomain.com/en/about, https://mydomain.com/fr/sur. (Where About and Sur are the same Resource with Parent 0).

    Anybody managed to do this before with Lingua and would like to share smiley ?
      Steven James McLean
      Tech Lead
      springbokagency.com
    • Have you tried to enable friendly URLs in the system setting of the manager?
      • Hi aaronkent! Indeed the friendly URLs are already switched on in the manager.

        In fact I can see that the alias is being shown when accessing the website (instead of index.php?id=4 for example).

        I don't think that Lingua Extra inherits this setting in this case.
          Steven James McLean
          Tech Lead
          springbokagency.com
        • You could setup an htaccess rule that converts the request to friendly in the address bar or try using the CustomRequest plugin. I use that plugin for a huge project and it works well. Just associate the entries to corespond as you describe.
          • Hi sjmclean,

            I've used the Lingua extra on quite a few projects and it works great.

            Like aaronkent, I use .htaccess, but with the addition of Ajax.

            1. By using .htaccess to allow for 'example.com/{country_code}/', you can grab the {country_code} by exploding $_SERVER['REQUEST_URI'] and checking to see if the {country_code} matches the current MODx cultureKey.
            2. If they don't match, you can just do an Ajax post to example.com?lang={country_code} and refresh your page.

            Cheers

            Jim