Answer the question
In order to leave comments, you need to log in
YII2 translations, what's wrong?
In config:
app/common/config/main.php
return [
'sourceLanguage' => 'ru',
'language' => 'kk',
'components' => [
'i18n' => [
'translations' => [
'app*' => [
'class' => 'yii\i18n\GettextMessageSource',
'basePath' => '@common/messages',
//'sourceLanguage' => 'en_US',
'fileMap' => array(
'app'=>'app.php',
)
],
],
],
]
]
return [
'Контакты' => 'Контакты - KAZ',
];
Yii::t("app", "Контакты");
Answer the question
In order to leave comments, you need to log in
You are trying to set the GettextMessageSource component's fileMap property. It does not have such a public property: www.yiiframework.com/doc-2.0/yii-i18n-gettextmessa...
I did as indicated here:
https://github.com/yiisoft/yii2/blob/master/docs/g...
'components' => [
// ...
'i18n' => [
'translations' => [
'app*' => [
'class' => 'yii\i18n\PhpMessageSource',
//'basePath' => '@app/messages',
//'sourceLanguage' => 'en-US',
'fileMap' => [
'app' => 'app.php',
'app/error' => 'error.php',
],
],
],
],
],
'translations' => [
'*' => [
'class' => 'yii\i18n\GettextMessageSource',
'basePath' => '@common/messages',
//'sourceLanguage' => 'en_US',
'fileMap' => array(
'app'=>'app.php',
)
],
],
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question