Home >Backend Development >PHP Tutorial >Yii2 simple method to implement multi-language configuration_php example
The example in this article describes the simple method of implementing multi-language configuration in Yii2 and shares it with everyone for your reference. The details are as follows:
1. Add
to the configuration file'i18n' => [ 'translations' => [ '*' => [ 'class' => 'yii\i18n\PhpMessageSource', 'basePath' => '@app/messages', 'sourceLanguage' => 'en', 'fileMap' => [ 'custorm' => 'custorm.php', 'app/error' => 'error.php', ], ], ], ],
2. Create a messages folder and add the corresponding language pack to it
Readers who are interested in more Yii-related content can check out the special topics of this site: "Introduction to Yii Framework and Summary of Common Techniques", "Summary of Excellent Development Framework of PHP", "Basic Tutorial for Getting Started with Smarty Templates", "Introduction to PHP Object-Oriented Programming" Tutorial", "php string (string) usage summary", "php+mysql database operation introductory tutorial" and "php common database operation skills summary"
I hope this article will help you design PHP programs based on the Yii framework.