This article describes the YII2 simple implementation of the multilingual configuration method, shared for everyone to refer to, specific as follows:
1, the configuration file to add
' i18n ' => ['
translations ' => ['
* ' => '
class ' => '
yii\i18n\phpmessagesource ', ' BasePath ' => ' @app/messages ',
' sourcelanguage ' => ' en ',
' Filemap ' => [
' Custorm ' => '] Custorm.php ',
' app/error ' => ' error.php ',
],
],
],
2, create Messages folder, which add the appropriate language pack can
For more information on YII-related content, readers who are interested in this site can view the topics: Introduction to YII Framework and summary of common skills, "Summary of PHP Excellent development framework", "Smarty Template Introductory Course", "Introduction to PHP object-oriented programming", "PHP string" Summary of Usage , "Php+mysql Database operation Introduction Tutorial" and "PHP common database Operation Skills Summary"
I hope this article will help you with the PHP program design based on the YII framework.