Link
Link

Reputation: 699

How to change source translation in yii2 in lajax/translatemanager module

I installed this translate manager on my Yii 2 Advanced application and I'm trying to translate source variant.

Imagine that I have 2 languages - English and German. In my code I have Yii::t('frontend', 'Hello'). And I translated it to German like 'Guten morgen' and it works (word 'Hello' changes depending on the current application language, and now - if it's En - it's 'Hello' and if it's De - it's 'Guten morgen').

But now I want to translate source word 'Hello' and En variant will be 'Hi'. I did this but word does not change. What do I have to do?

Upvotes: 1

Views: 226

Answers (1)

Bizley
Bizley

Reputation: 18021

Yii 2 does not translate source language to the same target language by default and it looks like this is the case (default language is en-US and you want to set en). To do this you need to set forceTranslation in configuration to true like:

'i18n' => [
    'translations' => [
        '*' => [
            'class' => 'yii\i18n\DbMessageSource',
            // ...
            'forceTranslation' => true,
        ],
    ],
],

Upvotes: 1

Related Questions