1. Go to 'Extras' -> download and install 'Babel'.

2. Set up '.htaccess' file, currently, we set up three languages:

find '# The Friendly URLs part' in your .htaccess / ht.access file, replace the existing code with:

# 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|nl|de)/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|nl|de)/assets(.*)$ assets$ [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|nl|de)?/?(.*)$ index.php?cultureKey=$1&q=$2 [L,QSA]

Basicly, it just redirect to favicon, assets folder & index.php to root directory.

Then if you have ht.access, you need to delete it and replace with .htaccess.

3. Go to system setting, set 'Use Friendly URL' to 'YES':

4. Create a new plugin call 'gateway':

<?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('Nederlands');
break;
case 'de':
/* switch the context */
$modx->switchContext('Deutsch');
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']);
}

5. Then click 'System Events' tab, scroll down to 'OnHandleRequest', select the checkbox.

6. Go to system -> 'Contexts', add two contexts 'Deutsch' & 'Nedelands':

7. In Context, right click 'Web', select 'update context', then clicik 'context settings' tab:

8. Add setting to it:

7. In 'Access Control List', right click the '(anonymouse)', select 'Update user group':

8. Reinstall the Babel to add de & nl into the language.

[MODx] 10. Using Babel for Muti-languages support的更多相关文章

  1. 单实例dg软件从10.2.0.4版本安装至10.2.0.5.12

    DG环境搭建需求,因此安装与主库相同的软件版本 1.主库软件版本10.2.0.5.12 2dg环境提供的是全新的10.2.0.4.0 3.安装步骤,安装10.2.0.5 静默安装 psu安装10.2. ...

  2. Installing OpenCV 2.4.10 in Ubuntu 12.04 LTS

    转自 http://www.samontab.com/web/2012/06/installing-opencv-2-4-1-ubuntu-12-04-lts/ EDIT: I published a ...

  3. Install the 64bit library in Ubuntu13.10

    After installed Ubuntu13.10, and i want to run a 32bit software, in the pass, you just run sudo apt- ...

  4. Become a Windows Insider and Test New Windows 10 Features

    SR: To write an Edge browser extension. Microsoft is releasing Windows 10 build 14291 with browser e ...

  5. Codelab for Android Design Support Library used in I/O Rewind Bangkok session

    At the moment I believe that there is no any Android Developer who doesn't know about Material Desig ...

  6. SMBv1 is not installed by default in Windows 10 Fall Creators Update 2017 and Windows Server, Semi-annual Channel

    windows 10 rs3 release enable SMBv1 windows 10 rs3 release file sharing https://support.microsoft.co ...

  7. 10 Go 1.10 Release Notes

    Go 1.10 Release Notes Introduction to Go 1.10 Changes to the language Ports Tools Default GOROOT &am ...

  8. Android Meterial Design Support Library

    extends:http://inthecheesefactory.com/blog/android-design-support-library-codelab At the moment I be ...

  9. TouTiao开源项目 分析笔记10 实现通用普通文章片段页面

    1.RxJava的Observable数据操作符总结 1.1.Map操作符 Map操作符对原始Observable发射的没一项数据应用一个你选择的函数, 然后返回一个发射这些结果的Observable ...

随机推荐

  1. Glimpse

    给自己程序配好Glimpse. Glimpse.Mvc 有问题 遇到稍微复杂点的内套多个PartialView,内存就爆了彪1.7g,不开Glimpse一点问题都没.另外Glimpse.Nlog也有问 ...

  2. 职责链实现的apache.chain使用

    其实职责链在老早就使用过了,以前在HW给Vodafone做金融项目的时候,使用职责链完成交易步骤,那时觉得这东西真好用,可以直接通过配置决定业务流程,现在终于有机会实践一下.       项目地址:h ...

  3. 设计模式 - command

    将请求封装为对象,从而可以使用不同的请求对客户进行参数化,该模式的关键在于对不同请求的封装.简单的说,也就是在请求发出者和客户间通过command对象进行解耦,从而使得请求者可以通过实例化不同的com ...

  4. poj1180

    斜率优化dp 据说这题朴素的O(n2)dp也可以A 没试过 朴素的dp不难想:f[i]=min(f[j]+sumtime[i]*sumcost[j+1,i]+c*sumcost[j+1,n]) 稍微解 ...

  5. 探秘Java虚拟机——内存管理与垃圾回收

    本文主要是基于Sun JDK 1.6 Garbage Collector(作者:毕玄)的整理与总结,原文请读者在网上搜索. 1.Java虚拟机运行时的数据区 2.常用的内存区域调节参数 -Xms:初始 ...

  6. ssh-keygen+ssh-copy-id 在linux下实现ssh无密码登录访问

    环境: 192.168.2.10 192.168.2.11 实现:2.10 ssh无需密码登录到2.11 在2.10 ssh到2.11机器上,需要密码,这样对一些脚本工作不方便,因为需要密码,也就是需 ...

  7. Erlang分布式在linux和windows上的注意事项

    没事做,就在两台机器间测试下Erlang分布式的例子,一个台是windowsXP,一台装的redHat9,没有详细的文档,自己摸索着搞成功了,记录下. 1.首先,分布式Erlang的实现提供了自有的安 ...

  8. 刑事案件的构成要素 zt

    论刑事案件的构成要素   马忠红 2013-03-22 14:05:33 来源:<中国人民公安大学学报:社会科学版>(京)2012年5期 [内容提要]刑事案件是由诸多要素构成的一个系 统. ...

  9. ajax跨域解决方案(服务端仅限java)

    楼主前端知识菜鸟,高手勿喷,在此记录工作中遇到的问题及解决方案,大神请滤过 方法1.jsonp(js客户端ajax请求参数方式设置) 方法2.服务端接口设置: HttpServletResponse ...

  10. 《Genesis-3D开源游戏引擎完整实例教程-跑酷游戏篇05:二段跳》

    5.二段跳 二段跳概述: 基本跑酷游戏的框架搭建完毕,开发者会根据开发的游戏特性,增设一些额外功能,使游戏具有可玩性性和画面感.下面我们以角色的二段跳为例,来了解在跑酷游戏中增设其它功能的流程.二段跳 ...