PHP code example of kialex / yii2-translation-center
1. Go to this page and download the library: Download kialex/yii2-translation-center library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
...
'components' => [
...
'i18n' => [
'translations' => [
'app*' => [
'class' => 'yii\i18n\PhpMessageSource', // default Yii transaltion
'fileMap' => [
'app' => 'app.php',
'app/error' => 'error.php',
],
],
'*' => [
'class' => '\yii\i18n\JsonMessageSource', // Your tranlation fron Translate Center
'basePath' => '@common/messages'
// If you change this path, you shoud change it in//
// `\Kialex\TranslateCenter\Storage\JsonFileStorage` as well
// You may do it via singletons or defenations in config
],
],
]
]
...