Yii2 Internationalization (i18n) for advanced template
We are working on a project that makes use of Yii2 advanced template. This project needs to support Internationalization (i18n). In each of our application, we have a translation configuration. This is needed to generate the translation. The files would be generated in backend/messages, common/messages or frontend/messages. Here’s a sample. <?php // backend/config/i18n.php // common/config/i18n.php // frontend/config/i18n.php return [ 'sourcePath' => __DIR__ . DIRECTORY_SEPARATOR . '..', 'languages' => [ 'zh-CN', ], 'translator' => 'Yii::t', 'sort' => true, 'removeUnused' => true, 'markUnused' => true, 'only' => ['*.php'], 'except' => [ '.svn', '.git', '.gitignore', '.gitkeep', '.hgignore', '.hgkeep', '/assets', '/command', '/config', '/mail', '/messages', '/modules', '/runtime', '/tests', '/vagrant', '/vendor', '/views/user/settings', '/web', '/widgets', ], 'format' => 'php', 'messagePath' => __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'messages', 'overwrite' => true, ]; Here are some samples of how the text should be wrapped. ...