Royal PITA
Many issues and questions posted for this problem. I do not believe Yii2 has solved it yet.
Perhaps I have failed to read/understand something. But time is up.
Why are there no english files (EG vendor/yiisoft/yii2/messages/en/yii.php) ?
Where do the defaults come from please?
Ah. They are embedded in the code of course.
So my config has
'language'=>'en-US',
...
'components' => [
'i18n' => [
'translations' => [
'core' => [
'class' => 'yii\i18n\PhpMessageSource',
// The base path for all translated messages. Defaults to '@app/messages'.
'basePath' => '/home/mehere/sites/www/messages',
'sourceLanguage' => 'en',
'fileMap' => [
'core' => 'core.php',
],
],
'shop' => [
'class' => 'yii\i18n\PhpMessageSource',
// The base path for all translated messages. Defaults to '@app/messages'.
'basePath' => '/home/mehere/sites/www/messages',
'sourceLanguage' => 'en',
'fileMap' => [
'shop' => 'shop.php',
],
],
'chat' => [
'class' => 'yii\i18n\PhpMessageSource',
// The base path for all translated messages. Defaults to '@app/messages'.
'basePath' => '/home/mehere/sites/www/messages',
'sourceLanguage' => 'en',
'fileMap' => [
'chat' => 'chat.php',
],
],
/*
// contact page is a problem child The CAPTCHA is firing this
The message file for category 'yii' does not exist: /home/mehere/sites/www/vendor/yiisoft/yii2/messages//yii.php Fallback file does not exist as well: /home/mehere/sites/www/vendor/yiisoft/yii2/messages//yii.php
/home/mehere/sites/www/frontend/views/layouts/main.php:244
/home/mehere/sites/www/frontend/controllers/SiteController.php:260
'yii' => [
'class' => 'yii\i18n\PhpMessageSource',
'basePath' => '@yii/messages',
'sourceLanguage' => 'en',
],
*/
],
],
It’s a bit messy now because I have thrown out a third party package and am going back to basics.
I need to split those module configs out and get the alias back. But I think there is nothing wrong here.
To resolve this issue I took a language file for yii.php and removed all the translated strings. Placed it at /vendor/yiisoft/yii2/messages//yii.php and now I have no errors.
I think I will override PhpMessageSource:: loadMessages instead.
I fail to follow these in gory detail. None of the fixes seemed to work for me.