thinikphp Framework support for multiple languages

Source: Internet
Author: User

1. Multilingual through behavior Behavior support/thinkphp/library/behavior/checklangbehavior.class.php

2. A total of 4 language packs, after the definition to overwrite the first defined (similar configuration file config.php overwrite/thinkphp/conf/convention.php)

3. Open multi-lingual support in config.php

' lang_switch_on ' + true,//turn on the language pack function ' Lang_auto_detect ' + true,//Auto Detect language to open multi-lingual function after effective ' lang_list ' = = ' ZH-CN ',//allowed to toggle the list of languages separated by commas ' var_language ' = ' + ',//default language toggle Variable

4. Ensure behavior Behavior Code execution

4.1 Manually start the CheckLangBehavior.class.php behavior

4.2 home/common/conf/tags.php

<?php ReturnArray (//Add the following line definition can//' App_begin ' =>array (' Behavior\checklang '),//if it is 3. 2.1 version needs to be changed to//' App_begin ' =>array (' Behavior\checklangbehavior ');

5 Language Packs 4 levels

"e:\huiyukeji-php\text\thinkphp/lang/zh-cn.php"//The language pack that is called by default

"./application/common/lang/zh-cn.php"//Read Common language pack

"./application/home/lang/zh-cn.php"//Read the specified module language pack

"./application/home/lang/zh-cn/index.php"//Read the specified module specific controller for the language pack

6 Getting language variable information

6.1 L () Quick function gets all the language variables

6.2 Assign () Passing language variables to the stencil for output

6.3 {$Think. lang. Variable name}

6.4 One language pack per language


This article is from the "Wang Zhiqiang" blog, make sure to keep this source http://wangzhiqiang.blog.51cto.com/12079071/1865142

thinikphp Framework support for multiple languages

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.