Answer the question
In order to leave comments, you need to log in
How to configure Yii2 i18n to translate from ru-RU (source language) to ru-RU (target language)?
The situation is the following. The project is implemented in Russian, but in some cases messages in English may fly by. Previously, the default value was en-US, but at the moment internationalization is being implemented and there is a need to translate the application interface into English.
There is a configuration
return [
...,
'language' => 'ru-RU',
'sourceLanguage' => 'ru-RU',
...,
]
return [
...,
'components' => [
'i18n' => [
'translations' => [
'app*' => [
'class' => 'yii\i18n\PhpMessageSource',
'basePath' => '@frontend/messages',
'fileMap' => [
'app' => 'app.php',
'app/error' => 'error.php',
],
],
],
],
],
...,
];
return [
...,
'components' => [
'i18n' => [
'translations' => [
'app*' => [
'class' => 'yii\i18n\PhpMessageSource',
'basePath' => '@frontend/messages',
'fileMap' => [
'app' => 'app.php',
'app/error' => 'error.php',
],
'forceTranslation' => true,
],
],
],
],
...,
];
Answer the question
In order to leave comments, you need to log in
www.yiiframework.com/doc-2.0/yii-i18n-phpmessageso...
forceTranslation - Whether to force message translation when the source and target languages are the same.
Apparently this is what you need.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question