We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 37060
    • 45 Posts
    Hi! I have a problem with the Babel plugin. I have two languages in frontend: Finnish and English. The thing is, I'm using English in backend and so I created a new context which was English. I think they are somehow mixing up. For example, my TinyMce just wrote the url of an image like this: www.site.com/en/en/images/image.jpg.

    It seems that somehow the web context is picking up the English context's URL and using that. I did name the culture key of English language to "english" precisely to avoid this mix up but still it happened. Any ideas?
      • 31946
      • 116 Posts
      Your cultureKey should be "en" not "english".
      Also, have you set the other context settings per language like:
      base_url
      site_url

      Friendly URL turned on? Modified .htaccess? Maybe you need
      to add a Rewrite Rule for the images folder!

      Cheers
        • 30912
        • 463 Posts
        Sounds like htacess to me, i followed this: http://www.multilingual-modx.com/blog/2011/seo-friendly-multilingual-websites-with-modx-and-babel.html

        the first time i set it up and thus no problems so far.
          • 37060
          • 45 Posts
          I can't name the English language "en" because that is already used by web context. Is it invalid to have a cultureKey with more than two letters in it?

          Friendly URLs are turned on
          .htaccess modified only by enabling RewriteEngine
          base_url and site_url are set.
            • 31946
            • 116 Posts
            Yes, this is invalid!
            There can be more than one context with cultureKey set to "en".
            I think you'll need to prived more information of your current setup.
              • 37060
              • 45 Posts
              Ok. At the moment the problem is slightly different (I'm getting same content no matter what) but the multilingual site is not working nevertheless. Here's all the info:

              First, the contexts and their settings:

              context: web
              No settings defined in context settings, in system settings cultureKey is "en"

              context: en
              base url: /english/
              culture key: english
              site url: http://www.mydomain.com/english/

              My gateway:

              if($modx->context->get('key') != "mgr"){
              //grab the current domain from the http_host option
              switch ($modx->getOption('http_host')) {

              case 'www.mydomain.com/english/':
              //switch the context
              $modx->switchContext('en');
              //set the cultureKey
              $modx->setOption('cultureKey', 'english');
              break;

              default:
              // Set the default language/context here
              $modx->switchContext('web');
              $modx->setOption('cultureKey', 'en');
              break;
              }
              }

              .htaccess is modifed only to allow furls, so I've uncommented the lines that do that.

              Just to be crystal clear: culture key cannot exceed two characters?
                • 31946
                • 116 Posts
                I guess the "http_host" will never be "www.mydomain.com/english/" so the switch statement doesn't work.
                Then a cultureKey of "english" is not possible, as already said. This has to be "en".
                Seems like you trying to set up a multilanguage site with virtual subfolders.
                Try the following tutorial:
                http://www.multilingual-modx.com/blog/2011/seo-friendly-multilingual-websites-with-modx-and-babel.html
                  • 37060
                  • 45 Posts
                  Thanks. I built the languages again from scratch, this time using only "fi" and "en". It works now.