Thinkphp supports multiple languages and uses language files. If your application involves multiple http://www.aliyun.com/zixun/aggregation/18713.html "> language versions and internationalization support, then you can define the relevant language pack files." Any output in the form of a string can define a language constant.
Enable multiple languages
To enable multilingual features, first download the MultiLanguage Behavior Extension (http://www.thinkphp.cn/extend/186.html), or download the official Full expansion pack (http://www.thinkphp.cn/down/253). HTML) also contains multilingual behavior extensions, placing the CheckLangBehavior.class.php files extracted after downloading into the Thinkphp/extend/behavior (if not manually created) directory below. Then, in the project's behavior profile (conf/tags.php), enable the multilanguage behavior, add the following configuration items:
return Array (///Add the following line definition to ' app_begin ' => array (' Checklang '));
Indicates that multiple language detection behavior is performed at the App_begin label location. Because multilingual defaults are off, we also need to open the language pack feature in the Project Profile (conf/config.php):
' lang_switch_on ' => true,//enable the Language pack feature
Other multilanguage-related configuration parameters include:
' Lang_auto_detect ' => true,//automatic detection language to open multi-language features effective ' default_lang ' => ' zh ',//default language ' lang_list ' => ' zh-cn,en-us ', Allow switched languages list comma-delimited ' var_language ' => ' l ',//default language switch variable
If Lang_auto_detect is turned on, the current language is automatically detected, otherwise the Default_lang language setting is used. The use of language packs is determined by the system to automatically determine the current user's browser support language, and if the browser supports multiple languages, take the first support language. You can also use parameters in URL addresses to toggle multiple languages, such as:
Http://localhost/Lang/index.php/?l=en-us
Multi-language switching takes the cookie mechanism and therefore remembers the current language selection. Multiple-language switching is controlled by the Lang_list parameter, and if the language that the browser automatically detects or the user-switched language is not valid outside the lang_list, the system will use the default language. For example, in the case of the above settings parameter, Access:
Http://localhost/Lang/index.php/?l=zh-tw
Because the zh language is not in the MultiLanguage list, the 115.html ">" Simplified Chinese zh language pack will be used.
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.