[MODx] 10. Using Babel for Muti-languages support

Source: Internet
Author: User
Tags modx

1. Go to ' Extras ', download and install ' Babel '.

2. Set up '. htaccess ' file, currently, and 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.icorewritecond%{request_filename}!-Drewritecond%{request_filename}!-Frewriterule^ (en|NL|DE)/favicon.ico$ Favicon.ico [L,QSA] # REDIRECT all requests to/de/assets* and/NL/assets* to/assets*Rewritecond%{request_filename}!-Drewritecond%{request_filename}!-Frewriterule^ (en|NL|de)/assets (. *) $ assets$2[L,QSA] # REDIRECT all and requests to/de/*and/nl/*# to index.php and set the Culturekey parameterrewritecond%{request_filename}!-frewritecond%{REQUEST_FILE NAME}!-drewriterule ^ (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 the ht.access, you need to the delete it and replace with. htaccess.

3. Go to System setting, set ' use friendly URL ' to ' YES ':

4. Create a new plugin call ' Gateway ':

<?PHPif($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*/            unset($_get[' Culturekey ']); }

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

6. Go to System ' contexts ', add contexts ' Deutsch ' & ' Nedelands ':

7. In the context, right click on ' 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.