matthew-p/yii2-translate-db

Translate DB tables and columns.

1.0 2017-10-27 12:15 UTC

This package is auto-updated.

Last update: 2023-08-19 23:18:14 UTC


README

Very simple extension for translation DB tables and columns

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist matthew-p/yii2-translate-db "*"

or add

"matthew-p/yii2-translate-db": "*"

to the require section of your composer.json file.

Usage

Once the extension is installed, simply use it in your code by:

In console main.php add:

return [
    ...
    'controllerMap' => [
        ...
        'message' => [
            'class'            => MPMessageController::class,
            'configFile'       => '@common/messages/config.php', // Set path to message config file
            'storedDbMessages' => '@common/db_messages.php',     // File where temporary stored data from db. This file must not be blocked (except) in messages config.php
            'tablesMessages'   => [
                ARModel::class  => ['title', 'title_for'], // ActiveRecord model => [column1, column2 ...]
                ARModel2::class => ['title'],
            ]  
        ],
        ...
    ]
    ...
];

And run in console:

php yii message