[MODx] 10. Using Babel for Muti-languages support
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的更多相关文章
- 单实例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. ...
- 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 ...
- 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- ...
- 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 ...
- 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 ...
- 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 ...
- 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 ...
- Android Meterial Design Support Library
extends:http://inthecheesefactory.com/blog/android-design-support-library-codelab At the moment I be ...
- TouTiao开源项目 分析笔记10 实现通用普通文章片段页面
1.RxJava的Observable数据操作符总结 1.1.Map操作符 Map操作符对原始Observable发射的没一项数据应用一个你选择的函数, 然后返回一个发射这些结果的Observable ...
随机推荐
- RPi 2B GPIO 测试
/************************************************************************************** * RPi 2B GPI ...
- LeetCode Intersection of Two Linked Lists (找交叉点)
题意: 给两个链表,他们的后部分可能有公共点.请返回第一个公共节点的地址?若不重叠就返回null. 思路: 用时间O(n)和空间O(1)的做法.此题数据弱有些弱. 方法(1)假设两个链表A和B,用两个 ...
- 让memcached和mysql更好的工作
这次是Fotolog的经验,传说中比Flickr更大的网站,Fotolog在21台服务器上部署了51个memcached实例,总计有254G缓存空间可用,缓存了多达175G的内容,这个数量比很多网站的 ...
- SharePoint 2010 master page 控件介绍(5):其他
转:http://blog.csdn.net/lgm97/article/details/6409227 <!-- 处理搜索按下"enter"键和点击后退按钮 --> ...
- Retrofit – Java(Android) 的REST 接口封装类库
Retrofit 和Java领域的ORM概念类似, ORM把结构化数据转换为Java对象,而Retrofit 把REST API返回的数据转化为Java对象方便操作.同时还封装了网络代码的调用. 例如 ...
- 从linux启动到rootfs的挂载分析
简单的来说,根文件系统包括虚拟根文件系统和真实根文件系统.在Kernel启动的初始阶段,首先去创建虚拟的根文件系统,接下来再去调用do_mount来加载真正的文件系统,并将根文件系统切换到真正的文件系 ...
- Ramdisk文件系统的制作与调试运行
开发环境:Fedora 9交叉编译工具链:arm-linux-gcc 4.3.2 with EABI嵌入式Linux内核版本:2.6.29.4-FriendlyARM.昨天写贴子的时候具体记不清了,今 ...
- oracle 问题若干 提醒注意
1.Powerdesigner 里生成sql,在oracle中运行时报错:ORA-00907: 缺失右括号 解决:这样的问题很多时候是因为用了不正确的数据类型造成的.比如写作nvarchar(n),但 ...
- 设计模式_Facade_门面模式
形象例子: 我有一个专业的Nikon相机,我就喜欢自己手动调光圈.快门,这样照出来的照片才专业,但MM可不懂这些,教了半天也不会.幸好相机有Facade设计模式,把相机调整到自动档,只要对准目标按快门 ...
- LeetCode题解——Add Two Numbers
题目: 两个数字求和,数字用链表表示,每一个结点代表一位.链表顺序与数字顺序相反,即表头存放数字的最低位. 解法: 分别遍历两个链表的每个结点,对两个结点求和即可.要维护一个变量保存每次相加之后的进位 ...