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

    Been trying all day to get my site multilingual. I found that Babel is absolute great but the tutorials and examples are all a bit dated. So to spare you some hours searching, here are the 100% working steps to a multilingual site.

    Steps

    1. Get clean modx installation (tested 2.5.4)
    2. Make sure FURL’s are working
    3. Create a new context with key -> en name -> English
    4. Create the following settings

      • base_url -> /
      • cultureKey -> en
      • site_url -> {url_scheme}{http_host}{base_url}{cultureKey}/
      • site_start -> ID*(once you know wich one)
    5. On the access permissions tab give user group anonymous the “load list and view” permission
    6. Install babel -> default settings
    7. Install langrouter -> default settings
    8. Make sure all paths in your tmpl are build with [[++assets_url]]
    9. Repeat this for all your languages

    If you want to use the web context

    1. Open web context
    2. Adjust permissions as in step 5
    3. Create settings as in 4
    4. Give it the right culture Key



    Now you are ready to make translations and switch them with [[BabelLinks? &showCurrent=`1` ]]

    Helpful resources


    Kind
      • 38783
      • 571 Posts
      Thanks. I have bookmarked this for future reference.
        If I help you out on these forums I would be very grateful if you would consider rating me on Trustpilot: https://uk.trustpilot.com/review/andytough.com

        email: [email protected] | website: https://andytough.com
        • 35814
        • 7 Posts
        Thanks for the how-to!

        I set up all contexts and settings according to your manual, Babel language switch, everything works.

        But is there a trick for the default context 'web' to be called like "www.example.com/" and not with the default contextKey in the URL like "www.example.com/en/"?

        Long story short:
        Default Context: www.example.com/en/ --> I want www.example.com
        German Context: www.example.com/de/ --> that's okay.

        any ideas very welcome smiley
          • 42042
          • 140 Posts
          Quote from: Relias at Feb 22, 2017, 10:42 AM
          Thanks for the how-to!

          I set up all contexts and settings according to your manual, Babel language switch, everything works.

          But is there a trick for the default context 'web' to be called like "www.example.com/" and not with the default contextKey in the URL like "www.example.com/en/"?

          Long story short:
          Default Context: www.example.com/en/ --> I want www.example.com
          German Context: www.example.com/de/ --> that's okay.

          any ideas very welcome smiley

          Great to hear. This is one way:

          snippet -> https://gist.github.com/christianseel/504302ce8ddfcde009c0
          ref -> https://modx.today/posts/2015/05/using-xrouting-for-multilingual-websites-in-modx (bottom)
            • 35814
            • 7 Posts
            What to keep in mind when I got MODX installed in a subfolder?

            Start-Pages throw an ERR_TOO_MANY_REDIRECTS when I try to access www.example.com/modx/en/
            Pages like www.example.com/modx/en/page1, www.example.com/modx/en/page2 ect. work fine.

            in .htaccess the subfolder is set, same as in the context settings for base_url -> /modx/

            I've wrapped my head around this for hours but I can't come up with a solution... having modx installed in root works fine :/