Using contexts and Babel requires a resource for each language, one in each language context. You need to provide the content for each resource, in each language. All that Babel does is provide links between the resources in the different contexts to make it easier to manage them. The rest is provided by snippets and plugins to determine which resource to serve, and to help in generating menus. You'll also probably needs some custom lexicon files for form prompts and other small bits of content.
Here's another tutorial that may help you to understand how it all works together. http://www.multilingual-modx.com/blog/2011/seo-friendly-multilingual-websites-with-modx-and-babel.html
I prefer to use the router plugin from here https://gist.github.com/gadamiak/3812853 (it is mentioned in the comments to the article above).






Hello you two,
i'm also in the process of getting babel to work for modx revo 2.2.10. With little success so far. Put 1 and a half day into it so far.
I hope its ok to add to this thread instead of opening a new one.
- I followed the tutorials of the author at http://www.multilingual-modx.com/ to set things up.
- tried to setup a (de|en) site, where de is default(web).
Results:
- links like http://www.host.de/sub_folder/de/start are working
- links like http://www.host.de/sub_folder/en/home are not. Responce: 503 Error Page not found
- The view button in the window of a resource(en/home) just points to: http://www.host.de/sub_folder
- The Wayfinder generates links without the de, en folders. So everything is http://www.host.de/sub_folder/path
- The Language Switcher provided by babel through <ul>[[BabelLinks]]</ul> just generates links without the language folders like this: http://www.host.de/sub_folder
Hope you can point out the mistakes i made or where to debug next.
All the best
Jens
Details:
- adjusted my .htaccess file. The rewrite is working. rewrite 'de/start' -> 'index.php?cultureKey=de&q=start'
- i added the context specific settings, like so:
- made the changes to user friendly urls in Systemsettings
- my router plugin, so far
- installed babel 2.2.5 via modx packet manager
<?php
if($modx->context->get('key') != "mgr"){
/* grab the current langauge from the cultureKey request var */
switch ($_REQUEST['cultureKey']) {
case 'de':
/* switch the context */
$modx->switchContext('de');
break;
case 'fr':
/* switch the context */
$modx->switchContext('fr');
break;
case 'es':
/* switch the context */
$modx->switchContext('es');
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']);
}RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(de|fr|es)/favicon.ico$ favicon.ico [L,QSA]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(de|fr|es)/assets(.*)$ assets$2 [L,QSA]
# redirect all other requests to /de|fr|es/*
# to index.php and set the cultureKey parameter
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(de|fr|es)?/?(.*)$ index.php?cultureKey=$1&q=$2 [L,QSA]Hey,
congrats for finding a solution to the link problem. Please share it with the rest of us.![]()
<?php
if($modx->context->get('key') != "mgr"){
/* grab the current langauge from the cultureKey request var */
switch ($_REQUEST['cultureKey']) {
case 'en':
/* switch the context */
$modx->switchContext('en');
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']);
}RewriteEngine On
RewriteBase /ens
# redirect all requests to /de/favicon.ico and /nl/favicon.ico
# to /favicon.ico
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(en)/favicon.ico$ favicon.ico [L,QSA]
# redirect all requests to /de/assets* and /nl/assets* to /assets*
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(en)/assets(.*)$ assets$2 [L,QSA]
# redirect all other requests to /de/* and /nl/*
# to index.php and set the cultureKey parameter
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(en)?/?(.*)$ index.php?cultureKey=$1&q=$2 [L,QSA]Hello,
I am using Babel with this simple plugin added and named getaway :
<!--?php if($modx--->context->get('key') != "mgr"){ /* grab the current langauge from the cultureKey request var */ switch ($_REQUEST['cultureKey']) { case 'de': /* switch the context */ $modx->switchContext('de'); break; case 'fr': /* switch the context */ $modx->switchContext('fr'); break; case 'es': /* switch the context */ $modx->switchContext('es'); 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']); }
default context (web) in english
you need to add redirections to the main htaccess for the FURLS (Friendly URLs) :
RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(de|fr|es)/favicon.ico$ favicon.ico [L,QSA] RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(de|fr|es)/assets(.*)$ assets$2 [L,QSA] # redirect all other requests to /de|fr|es/* # to index.php and set the cultureKey parameter RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(de|fr|es)?/?(.*)$ index.php?cultureKey=$1&q=$2 [L,QSA]
... works just fine !