2017 © Pedro Peláez
 

yii2-extension yii2-wbt

Yii plugin for WBTranslator

image

wbtranslator/yii2-wbt

Yii plugin for WBTranslator

  • Thursday, October 19, 2017
  • by wbtranslator
  • Repository
  • 2 Watchers
  • 2 Stars
  • 13 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

WBTranslator Plugin Yii2

Installation by composer

composer require wbtranslator/yii2-wbt

Set configs for plugin

If you are using basic version, set your default language in console.php., (*1)

 $config = [
     ...
     'language' => 'ru',
     ...
 ];

If you are using Advanced template, set default language in common/main.php or in console/main.php., (*2)

Add wbt_plugin to your bootstrap config in console app, (*3)

 $config = [
     ...
    'bootstrap' => ['log', 'wbt_plugin'],
     ...
 ];

Add configs for plugin in the same config file, $config array., (*4)

 'modules' => [
         ...
         'wbt_plugin' => [
             'class' => wbtranslator\wbt\WbtPlugin::class,
             'langMap' => [
                 'PhpMessageSource' => [
                     'basic' => '@app/messages',
                 ]
             ],
             'apiKey' => 'your_project_api_key'
         ],
         ...
     ],

In config option langMap you can customise your translations storage., (*5)

In config option PhpMessageSource in section basic you must write your project name., (*6)

If you are using Advanced template, and you have more then one default storage with your translations, you can add it's all to PhpMessageSource config option., (*7)

 'modules' => [
         ...
         'wbt_plugin' => [
             'class' => wbtranslator\wbt\WbtPlugin::class,
             'langMap' => [
                 'PhpMessageSource' => [
                     'common' => '@common/messages',
                     'common' => '@common/my-messages',
                     'frontend' => '@frontend/messages',
                     'backend' => '@backend/messages',
                     'console' => '@console/messages',
                 ]
             ],
             'apiKey' => 'your_project_api_key'
         ],
         ...
     ],

In plugin option PhpMessageSource key - is the name of your application and application folder, value - is path to your translation folder in this application., (*8)

Also you can extract your translations from database., (*9)

 'modules' => [
         ...
         'wbt_plugin' => [
             'class' => wbtranslator\wbt\WbtPlugin::class,
             'langMap' => [
                 'DbMessageSource' => [
                    'messageTable' => 'message',
                    'sourceMessageTable' => 'source_message'
                 ],
             ],
             'apiKey' => 'your_project_api_key'
         ],
         ...
     ],

In options messageTable, sourceMessageTable you can fill out your custom tables for translations., (*10)

'wbt_plugin' => [
             ...
             'apiKey' => 'your_project_api_key'
             ...
         ],

apiKey - is required option, that you can find in API section of your project., (*11)

Set folders permissions with translations to write access from server

$ chmod -R 775 ./resources/lang/

Use web interfase

Send abstractions to WBTranslator from console command

php yii  wbt_plugin/wbt/export

Get abstractions from WBTranslator and save them to lang directorys

php yii  wbt_plugin/wbt/import

The Versions

19/10 2017

dev-master

9999999-dev

Yii plugin for WBTranslator

  Sources   Download

MIT

The Requires

 

by Oleg Skalozub

yii2 translations wbt

19/10 2017

v0.1.0

0.1.0.0

Yii plugin for WBTranslator

  Sources   Download

MIT

The Requires

 

by Oleg Skalozub

yii2 translations wbt

10/08 2017

dev-development

dev-development

Yii2 plugin for WBTranslator

  Sources   Download

MIT

The Requires

 

by Oleg Skalozub

yii2 translations wbt

09/08 2017

dev-test

dev-test

translations

  Sources   Download

MIT

The Requires

 

by Oleg Skalozub

yii2 translations wbt