[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$2 [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.

时间: 2024-11-14 19:02:26

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

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.com/en-us/help/4034314/smbv1-is-not-installed-by-default-in-windows-10-rs3-and-windows-server http://www.bit-tech.net/news/tech/software/microsoft-disab

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 Design anymore since it officially becomes a design philosophy by shaking the world of design in passed year. Surprisingly that it was not easy to implemen

Codelab for Android Design Support Library

extends:http://inthecheesefactory.com/blog/android-design-support-library-codelab At the moment I believe that there is no any Android Developer who doesn't know about Material Design anymore since it officially becomes a design philosophy by shaking

python——TypeError: &#39;str&#39; does not support the buffer interface

import socket import sys port=51423 host="localhost" data=b"x"*10485760 #在字符串前加 b 是字符串变为bytes类. sock=socket.socket(socket.AF_INET,socket.SOCK_STREAM) sock.connect((host,port)) byteswritten=0 while byteswritten<len(data): startpos =

【简单的案例分享,停机10分钟】10204升级CRS&amp;DB的PSU至102044

发现一个现象,AIX5.3+HACMP+10.2.0.4RAC+RAW的环境,运行五六年的数据库crsd.log都会报以下错误: ------------------------------------------- CAAMonitorHandler :: 0:Action Script /opt/oracle/product/crs/bin/racgwrap(check) timed out for ora.harac1.vip! (timeout=60) CheckResource err

NetCore开源项目集合

具体见:https://github.com/thangchung/awesome-dotnet-core 半年前看到的,今天又看到了,记录下. General ASP.NET Core Documentation - The official ASP.NET Core documentation site. .NET Core Documentation - Home of the technical documentation for .NET Core, C#, F# and Visual

Spring框架文档与API(4.3.6版本)

http://docs.spring.io/spring/docs/current/spring-framework-reference/htmlsingle/ Table of Contents I. Overview of Spring Framework 1. Getting Started with Spring 2. Introduction to the Spring Framework 2.1. Dependency Injection and Inversion of Contr

CodeMirror:基于JavaScript的代码编辑器

官方网站定义: http://codemirror.net/ CodeMirror is a versatile text editor implemented in JavaScript for the browser. It is specialized for editing code, and comes with a number of language modes and addons that implement more advanced editing functionalit

静默方式安装10g数据库软件+升级patch+手工建库

通常我们安装Oracle数据库软件,都是用OUI图形界面来完成的,但有些Unix/Linux系统中并未安装图形系统,也就无法使用图形界面来安装Oracle的产品了,对于这种场景,就只能采用静默方式来安装了,Oracle提供了这种silent方式,主要是通过配置响应文件rsp来完成的. 一.静默安装10.2.0.1数据库软件 --解压安装包 [[email protected] u01]$ unzip 10201_database_linux32.zip [[email protected] u0