Hello,
I am working locally with couple of different language site and using Babel with country flags "babel-links-as-img"
<a href="[[+url]]"><img src="site/assets/flags/flag-[[+cultureKey]].gif" /></a>
and added following in one chunk which is used in the whole site.
<p>[[BabelLinks? &tpl=`babel-links-as-img`]]</p>
I made different context for each language, and needed to link every country flag to right context [[~id]]. How could I do that? Default "web" language is english.
Whole site is using only one template.
.htaccess file is modified
# The Friendly URLs part
# redirect all requests to /de/favicon.ico and /nl/favicon.ico
# to /favicon.ico
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(en|se|de|nl|es)/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|se|de|nl|es)/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|fi|se|de|nl|es)?/?(.*)$ index.php?cultureKey=$1&q=$2 [L,QSA]
gateway plugin is also made
<?php
if($modx->context->get('key') != "mgr"){
/* grab the current langauge from the cultureKey request var */
switch ($_REQUEST['cultureKey']) {
case 'se':
/* switch the context */
$modx->switchContext('se');
break;
case 'de':
/* switch the context */
$modx->switchContext('de');
break;
case 'nl':
/* switch the context */
$modx->switchContext('nl');
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']);
}
Many thank you for your help,
Tom