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. Oracle tnsname.ora 链接问题

    oracle数据库需要配置tns链接 这里我发现了一个问题: 在D:\Oracle\product\10.1.0\Client_3\NETWORK\ADMIN 目录中配置链接字符串的时候要特别注意: ...

  2. ExtJs双ActionResult共用同一Js文件ID冲突解决方案

    项目使用MVC+ExtJs实现,权限控制是基于Controller下的ActionResult的,有一个页面因参数不同就需要新建两个ActionResult. 不要问我为何是基于页面级,而不是数据级, ...

  3. CentOS下防火墙的基本操作命令

    CentOS 配置防火墙操作实例(启.停.开.闭端口): 注:防火墙的基本操作命令: 查询防火墙状态: [root@localhost ~]# service   iptables status< ...

  4. Asp.net MVC 4 异步方法

    今天我们来看一下,同样功能在 Asp.net MVC 4 下的实现,基于.net framework 4.5 下的async支持,让我们的代码更加简单,看下面片断代码名叫Index的Action方法: ...

  5. java.lang和java.lang.annotation中实现Annotation的类小结

    加了注解,等于打上了某种标记,没加,则等于没有某种标记,以后,其他程序可以用反射来了解你的类上面有无何种标记,看你有什么标记,就去干相应的事.标记可以加在类,方法,字段,包上,方法的参数上. (1)  ...

  6. spring的三种注入方式

    接口注入(不推荐) 构造器注入(死的应用) getter,setter方式注入(比较常用) Type1 接口注入 我们常常借助接口来将调用者与实现者分离.如: public class ClassA  ...

  7. volatile之一--volatile不能保证原子性

    Java语言是支持多线程的,为了解决线程并发的问题,在语言内部引入了 同步块 和 volatile 关键字机制在java线程并发处理中,有一个关键字volatile的使用目前存在很大的混淆,以为使用这 ...

  8. Poj 1953 World Cup Noise之解题报告

    World Cup Noise Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 16369   Accepted: 8095 ...

  9. iOS程序性能优化

    iOS程序性能优化 一.初级 使用ARC进行内存管理 在iOS5发布的ARC,它解决了最常见的内存泄露问题.但是值得注意的是,ARC并不能避免所有的内存泄露.使用ARC之后,工程中可能还会有内存泄露, ...

  10. 【暑假】[实用数据结构]UVAlive 3644 X-Plosives

    UVAlive X-Plosives 思路:    “如果车上存在k个简单化合物,正好包含k种元素,那么他们将组成一个易爆的混合物”  如果将(a,b)看作一条边那么题意就是不能出现环,很容易联想到K ...