PHP code example of demondogsl / yii2-translate-manager
1. Go to this page and download the library: Download demondogsl/yii2-translate-manager 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/ */
demondogsl / yii2-translate-manager example snippets
'modules' => [
'translateManager' => [
'class' => 'DemonDogSL\translateManager\Module', // instances. For example: ['@backend', '@common', '@frontend']. For Default is '@app'
'allowedIPs' => ['0.0.0.0'], // optional IP addresses from which the translation interface is accessible. For Default is ['127.0.0.1']
'roles' => ['@'], // optional For setting access levels to the translating interface. For Default is []
'tmpDir' => '@example', // optional Writable directory for the client-side temporary javascript language files. Can be '@backend/runtime'. For Default is '@runtime'
'ignoredCategories' => ['example'], // optional These categories won't be scanned. For Default is ['yii']
'onlyCategories' => ['example'], // optional Only these categories will be scanned. For Default is []
'ignoredItems' => ['example'], // optional These files will not be processed. For Default is ['.svn', '.git', '.gitignore', '.gitkeep', '.hgignore', '.hgkeep', '/messages', '/BaseYii.php', 'runtime', 'bower', 'nikic']
'tables' => [ // optional Database Tables that will be scanned. For Default not exists
[
'connection' => 'db',
'table' => '{{%example}}', // Table name
'columns' => ['example1', 'example2'], // Names of columns
'category' => 'database-table-name',
]
],
],
],
namespace backend\controllers;
use DemonDogSL\translateManager\helpers\Language;
class Controller extends \yii\web\Controller {
public function init() {
Language::registerAssets();
parent::init();
}
}
// Default
echo \DemonDogSL\translateManager\widgets\ToggleTranslate::widget();
// If you want change position
echo \DemonDogSL\translateManager\widgets\ToggleTranslate::widget([
'position' => 'example', // optional Can be 'top-left', 'top-right', 'bottom-left' or 'bottom-right'. For Default is 'bottom-left'
]);