php - How to configure gettext with Yii::t() in Yii2 advanced? -


i'm installed yii2 advanced template , configure yii::t() phpmessagesource, need configure gettextmessagesource. i'm added common/config/main-local.php code:

'i18n' => [             'translations' => [                 'app*' => [                     'class' => 'yii\i18n\gettextmessagesource',                     'basepath' => '@app/messages',                     'sourcelanguage' => 'en-us',                 ],             ],         ], 

put @ frontend/messages/ru-ru app.po file sample text:

msgid "test" msgstr "Текст" 

add in view file:

yii::t('app', 'test'); 

but doesn't work, need store .po files or i'm doing wrong?

'basepath' => '@app/messages', 

change 'basepath' => '@common/messages', or 'basepath' => '@root/common/messages

and replace messages common/messages.


Comments

Popular posts from this blog

javascript - how to protect a flash video from refresh? -

android - Associate same looper with different threads -

visual studio 2010 - Connect to informix database windows form application -