TP Multi-language support

Source: Internet
Author: User

TP supports multiple languages by get to change the language

Http://localhost/tp/index.php/Admin/User/add/hl/zh-cn

Http://localhost/tp/index.php/Admin/User/add/hl/zh-tw

Multi-language support belongs to behavior extension in library\behavior\checklangbehaviro.class.php

In the configuration file

' lang_switch_on ' + true,//turn on the Language pack feature
' Lang_auto_detect ' + true,//auto-detect language effective after opening multi-language function
' Lang_list ' + ' zh-cn,pt-br,zh-tw,en-us ',//The list of languages allowed to switch is separated by commas
' Var_language ' = ' hl ',//default language toggle Variable

Language zh-cn.php in lang with admin-peer common

To support you will also need to create a new file under common conf tags.php

<?php
Return Array (
Add the following line definition
' App_begin ' = = Array (' Behavior\checklang '),
If 3.2. Version 1 needs to be changed to
' App_begin ' = = Array (' Behavior\checklangbehavior '),
);

L () can pass all variables of the current language to the template

You can also use {$Think. Lang.username} to get

tags.php Source thinkphp\mode\common.php

TP Multi-language 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.