|
|
@ -289,7 +289,7 @@ Examples |
|
|
|
|
|
|
|
|
|
|
|
###Translating module messages |
|
|
|
###Translating module messages |
|
|
|
|
|
|
|
|
|
|
|
If you want to translate messages for module and you dont use one translation file for all messages, you can make it like following: |
|
|
|
If you want to translate messages for a module and avoid using a single translation file for all messages, you can make it like the following: |
|
|
|
|
|
|
|
|
|
|
|
```php |
|
|
|
```php |
|
|
|
<?php |
|
|
|
<?php |
|
|
@ -310,8 +310,7 @@ class Module extends \yii\base\Module |
|
|
|
|
|
|
|
|
|
|
|
public function registerTranslations() |
|
|
|
public function registerTranslations() |
|
|
|
{ |
|
|
|
{ |
|
|
|
$i18n = Yii::$app->i18n; |
|
|
|
Yii::$app->i18n->translations['modules/users/*'] = [ |
|
|
|
$i18n->translations['modules/users/*'] = [ |
|
|
|
|
|
|
|
'class' => 'yii\i18n\PhpMessageSource', |
|
|
|
'class' => 'yii\i18n\PhpMessageSource', |
|
|
|
'sourceLanguage' => 'en', |
|
|
|
'sourceLanguage' => 'en', |
|
|
|
'basePath' => '@app/modules/users/messages', |
|
|
|
'basePath' => '@app/modules/users/messages', |
|
|
|