umbalaconmeogia/yii2-translation-manager

Fork of wokster/yii2-translation-manager by Maksym Tymofeiev. CRUD for storage and editing of translations in a database. Works with a common Yii2 solution (yii i18n DbMessageSource)

v1.3.2 2020-09-17 04:56 UTC

This package is auto-updated.

Last update: 2020-10-17 05:10:27 UTC


README

This is a fork of wokster/yii2-translation-manage, including bug fix and code refactoring (be cause it seems that the original package isn't maintained any more).

CRUD for storage and editing of translations in a database. Works with a common Yii2 solution (yii\i18n\DbMessageSource)

Edit composer.json

Run

composer require umbalaconmeogia/yii2-translation-manager

or add "umbalaconmeogia/yii2-translation-manager": "*" to composer.json then run composer update

Edit config

Add to modules in config

'modules' => [
    'translation-manager' => [
        'class' => 'umbalaconmeogia\translationmanager\Module',
        'languages' => ['en', 'ja', 'vi'], // Any languages that you want to use
    ],
    // Other stuffs
],

config i18n like:

'components' => [
    'i18n' => [
        'translations' => [
            'yii*' => [
                'class' => 'yii\i18n\PhpMessageSource',
                'basePath' => '@vendor/yiisoft/yii2/messages',
                'sourceLanguage' => 'en'
            ],
            'app' => [
                'class' => 'yii\i18n\DbMessageSource',
                'forceTranslation' => true,
                //'enableCaching' => false,
                //'cachingDuration' => 3600,
            ],
        ],
    ],
    // Other stuffs
],

Run yii2 migration

php yii migrate --migrationPath=@yii/i18n/migrations/

Access to translation manager

https://<your domain>/?r=translation-manager