Home > Backend Development > PHP Tutorial > Programming language implementation mode Yii2 simple method to implement multi-language configuration

Programming language implementation mode Yii2 simple method to implement multi-language configuration

WBOY
Release: 2016-07-28 08:25:30
Original
1093 people have browsed it

The example in this article describes the simple method of implementing multi-language configuration in Yii2 and is shared with everyone for your reference. The details are as follows:

1. Add

'i18n' => [
'translations' => [
'*' => [
'class' => 'yii\i18n\PhpMessageSource',
'basePath' => '@app/messages',
'sourceLanguage' => 'en',
'fileMap' => [
'custorm' => 'custorm.php',
'app/error' => 'error.php',
],
],
],
],

Copy after login

to the configuration file 2. Create a messages folder and add the corresponding language package to it That’s it

Readers who are interested in more Yii-related content can check out the special topics of this site: "Summary of Getting Started with Yii Framework and Common Techniques", "Summary of Excellent Development Framework of PHP", "Basic Tutorial for Getting Started with Smarty Templates", "Object-Oriented PHP "Introduction Tutorial on Programming", "Summary of PHP String Usage", "Introduction Tutorial on PHP+mysql Database Operation" and "Summary of Common PHP Database Operation Skills"

I hope this article will help you with PHP programming based on the Yii framework Helps.

The above introduces the programming language implementation mode Yii2 simple method to implement multi-language configuration, including the programming language implementation mode. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template