I’m kinda struggling what is going on right now.
I want to set up a site with multilanguage-functionality. For that, I read the topic about Internationalization in the guides. I don’t want to use the text-/file-version, I want to use the DB instead.
I found out, that there is something like the DbMessageSource. I applied the migration and have the following tables in my DB:
[b]message
message_source[/b]
In my config-file, I addes these lines:
'components' => [
'cache' => [
'class' => 'yii\caching\FileCache',
],
'i18n' => [
'translations' => [
'*' => [
'class' => 'yii\i18n\DbMessageSource',
'forceTranslation' => true,
'sourceMessageTable' => '{{%source_message}}',
'messageTable' => '{{%message}}',
'enableCaching' => false,
'cachingDuration' => 3600,
'sourceLanguage' => 'en_US'
],
],
],
],
In my view, I call the translation-function like this:
[b]echo yii::t('header_menu', 'news'); [/b]
It is actually displaying "news", but regardless of the language
I set, nothing is stored in the DB. Am I missing something? I thought every string, which is in a translate-function would be stored in the DB?
Thanks in advance