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;
}