Answer the question
In order to leave comments, you need to log in
Why don't i18n pull up translations?
In the application configuration:
'language' => 'ru-RU',
'components' => [
'i18n' => [
'translations' => [
'app*' => [
'class' => 'yii\i18n\PhpMessageSource',
'basePath' => '@common/messages',
],
],
],
return [
'Create Products' => 'Создать товар',
'Products' => 'Товары',
];
array (size=3)
'app*' =>
object(yii\i18n\PhpMessageSource)[92]
public 'basePath' => string '@common/messages' (length=16)
public 'fileMap' => null
public 'forceTranslation' => boolean false
public 'sourceLanguage' => string 'ru-RU' (length=5)
private '_messages' (yii\i18n\MessageSource) =>
array (size=0)
empty
private '_events' (yii\base\Component) =>
array (size=0)
empty
private '_behaviors' (yii\base\Component) => null
.....
Yii::t('app', 'Products');
// на выходе Products
Answer the question
In order to leave comments, you need to log in
Either the sourceLanguage of the application matches the language or the translation is not found for you (in this case, use the yii log or the debug panel)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question