I just created a new Yii2 advanced project with the suggested command:
composer create-project --prefer-dist yiisoft/yii2-app-advanced sdcac
(sdcac is the project name)
Following https://www.yiiframework.com/doc/guide/2.0/en/tutorial-i18n I tried to "extract" all i18n messages from my app.
From root folder I executed this command to create config file:
./yii message/config --languages=en,es --messagePath=messages console/config/i18n.php
It generated this:
return [
'color' => null,
'interactive' => true,
'help' => false,
'silentExitOnException' => null,
'sourcePath' => '@yii',
'messagePath' => 'messages',
'languages' => [
'en',
'es',
],
'translator' => [
'Yii::t',
'\\Yii::t',
],
'sort' => false,
'overwrite' => true,
'removeUnused' => false,
'markUnused' => true,
'except' => [
'.*',
'/.*',
'/messages',
'/tests',
'/runtime',
'/vendor',
'/BaseYii.php',
],
'only' => [
'*.php',
],
'format' => 'php',
'db' => 'db',
'sourceMessageTable' => '{{%source_message}}',
'messageTable' => '{{%message}}',
'catalog' => 'messages',
'ignoreCategories' => [],
'phpFileHeader' => '',
'phpDocBlock' => null,
];
Then, I tried to "extract" all the messages from my project running:
./yii message/extract console/config/i18n.php
But it only finds Yii texts on "vendor" folder, although it's listed on "except" param:
Yii2 console extract command result
For example, it misses this message on "views/site/index.php" file:
\Yii::t('app', 'Give it a try!')
I can't understand why. What's wrong? Please, help!