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. 移植mysql到嵌入式ARM平台

    移植MySQL到嵌入式ARM平台  MySQL没有专门针对ARM的版本,移植到ARM没有官方文档可参考,因此,暂时参考这样一篇文档: http://blog.chinaunix.net/space.p ...

  2. 常用的js代码

    1.输入框输入提示代码 <input name="keyword" type="text" value="请输入关键字" onFocu ...

  3. NopCommerce架构分析之五------Model绑定Action参数

    asp.net MVC中Action参数不只是一些基本类型,也支持实体参数.那么从客户端传来的数据如何映射或转换成实体对象呢?就是通过实体绑定类ModelBinder.此系列类在请求转化为后台Cont ...

  4. Eclipse中出现Select at least one project解决办法

    今天遇到个问这个问题的,顺便帮解决了,是在导入工程的时候出现的,这是因为有同名的工程的,进入windows->show view->project explorer 这里找出来删掉再导入工 ...

  5. QTP、LoadRunner、QC工具下载地址

    QTP10.0工具下载地址:http://h30302.www3.hp.com/prdownloads/T6510-15063.zip?ordernumber=380454070&itemid ...

  6. xhtml知识及head部分名词解

    W3C: World Wide Web Con??? DTD: Document Type Defination DOCTYPE:Document Type meta:????? http-equiv ...

  7. 【暑假】[实用数据结构]UVAlive 4670 Dominating Patterns

    UVAlive 4670 Dominating Patterns 题目:   Dominating Patterns   Time Limit: 3000MS   Memory Limit: Unkn ...

  8. 8.2 C++ AMP advanced concepts

    C++ AMP一些更高级的概念: 1. device内存的分配和拷贝. void vecAdd(float* A, float* B, float* C, int n) { array<> ...

  9. 【Hadoop代码笔记】Hadoop作业提交之JobTracker等相关功能模块初始化

    一.概要描述 本文重点描述在JobTracker一端接收作业.调度作业等几个模块的初始化工作.想过模块的介绍会在其他文章中比较详细的描述.受理作业提交在下一篇文章中会进行描述. 为了表达的尽可能清晰一 ...

  10. C++ STL@ list 应用 (leetcode: Rotate Array)

    STL中的list就是一双向链表,可高效地进行插入删除元素. List 是 C++标准程式库 中的一个 类 ,可以简单视之为双向 连结串行 ,以线性列的方式管理物件集合.list 的特色是在集合的任何 ...