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', ], ], ], ],
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.