T
T
tigra2017-06-15 15:24:55
Yii
tigra, 2017-06-15 15:24:55

How can I add my own translations for the 'yii' category?

in my config there is such a component with a written TranslationEventHandler that checks if there is a translation from the page and adds it to the database, everything works fine with my categories.

'i18n' => [
            'translations' => [
                '*' => [
                    'class' => 'yii\i18n\DbMessageSource',
                    'sourceLanguage' => 'en',
                    'sourceMessageTable' => '{{%i18n_source_message}}',
                    'messageTable' => '{{%i18n_message}}',
                    'cachingDuration' => 86400,
                    'enableCaching' => false,
                    'on missingTranslation' => ['common\components\i18n\TranslationEventHandler', 'handleMissingTranslation'],
                ],
                'translate' => true
            ],
        ],

There was a need to translate the category yii, because. The language I need is not in vendor/messages/, I would like translations with the 'yii' category to be added to the database and translated manually, and not from the vendor/messages/ folder.
Is there such a possibility? and has anyone done this?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
tigra, 2017-06-15
@tigroid3

figured out why when you specifically specify a rule for the 'yii' category, it does not accept the validation rules in rules when added to the source_message table

'yii' => [
                    'class' => 'yii\i18n\DbMessageSource',
                    'sourceLanguage' => 'en',
                    'sourceMessageTable' => '{{%i18n_source_message}}',
                    'messageTable' => '{{%i18n_message}}',
                    'cachingDuration' => 86400,
                    'enableCaching' => false,
                    'on missingTranslation' => ['common\components\i18n\TranslationEventHandler', 'handleMissingTranslation'],
                ],

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question