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

    Mike Schell from MODX helped me out here. The results are posted here for others who may be having a similar issue:

    https://gist.github.com/8e29c06cee9ab8b8fab2
      Benjamin Davis: American web designer living in Munich, Germany and a MODX Ambassador. I am also co-founder of SEDA.digital, a MODX Agency.
    • I'm quite successfully using this routing plugin with no rewrites necessary, found in the comments to the article here http://www.multilingual-modx.com/blog/2011/seo-friendly-multilingual-websites-with-modx-and-babel.html

      https://gist.github.com/3812853
        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
        • 44307
        • 7 Posts
        Wow - thanks for posting your solution. I had been banging my head for the last 48 four hours trying to get the cultureKey to be correctly recognized by trying every variation in the .htaccess file...until I found out that it is completely ignored in modxcloud. Your nginx script is great along with all of the other setting examples on your github page. Thanks again for sharing.
        • That's why I like the plugin I linked to; no need for any server rewrites at all.
            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
          • Ok just tested babel.

            It works on MODX Cloud with 2.3 + Babel 2.2.5-pl
            But looks bad of course, will see if I can update the styling for it.

            My code:

            EN (default) context
                site_url: http://c3226.paas2.ams.modxcloud.com/en/
                base_url: /en/
                cultureKey: en
            

            NL context
                site_url: http://c3226.paas2.ams.modxcloud.com/nl/
                base_url: /nl/
                cultureKey: nl
            

            Gateway plugin
            Set this to load 'OnHandleRequest'
                <?php
                if($modx->context->get('key') != "mgr"){
                    /* grab the current langauge from the cultureKey request var */
                    switch ($_REQUEST['cultureKey']) {
                    case 'nl':
                        /* switch the context */
                        $modx->switchContext('nl');
                        break;
                    default:
                        /* Set the default context here */
                        $modx->switchContext('web');
                        break;
                    }
                    /* unset GET var to avoid * appending cultureKey=xy to URLs by other components */
                    unset($_GET['cultureKey']);
                }
            

            Cloud web rules:
                set $lang en;
                # choose the language that appears first in the accept_language header
                if ($http_accept_language ~* "(nl|en)") {
                    set $lang $1;
                }
                location ~ ^/$ {
                    rewrite ^ $lang/ redirect;
                }
                location ~ ^/(nl|en) {
                    # redirect favicon.ico and assets/* requests to site root
                    rewrite ^/(nl|en)/(favicon.ico|assets.*)$ /$2 redirect;
                    # main Babel rewrite
                    rewrite ^/(nl|en)/(.*)$ /?cultureKey=$1&q=$2 break;
                    # MODX rewrite
                    try_files $uri $uri/ @modx-rewrite;
                }
                location / {
                    try_files $uri $uri/ @modx-rewrite;
                }
            
              MODX Ambassador (NL) | Responsive web design specialist, developer & speaker
              DESIGNfromWITHIN, MPThemes and Any Screen Size
              Follow me on Twitter | Read my blog | My code on GitHub
              • 45900
              • 53 Posts
              Hi,

              I have moved my site to Modx cloud and I still can't change the language.
              My setting environment on cloud is Revo 2.4 + Babel3.0 beta. I tried to do the same as https://gist.github.com/netProphET/8e29c06cee9ab8b8fab2
              But I'm blocked by the nginx config. My site has 3 languages so if some one can guide me how to edit the nginx config to allow switching 3 languages it would be great.

              For more information, after I tried to use the above approach. I have got this error:
              The webpage at http://thaicom.dk/en/ has resulted in too many redirects. Clearing your cookies for this site or allowing third-party cookies may fix the problem. If not, it is possibly a server configuration issue and not a problem with your computer.



              Thank you [ed. note: joyobject last edited this post 8 years, 7 months ago.]
                • 54376
                • 1 Posts
                In our case, we want to transpile the JSX to JavaScript and ES6 code to browser-compliant ES5 code. We can do this by providing a JavaScript file as an entry point for Webpacks loader pipeline. Webpack will analyze this file and all of the subsequent dependencies used in your code to generate a bundle for you to include in your HTML. mobdro.io [ed. note: michelina852 last edited this post 5 years, 9 months ago.]