PHP code example of ziya / yii2-translate

1. Go to this page and download the library: Download ziya/yii2-translate 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/ */

    

ziya / yii2-translate example snippets


  $this->createTable('{{%article}}', [
            'id' => $this->primaryKey(),
            'name' => $this->json(),
            ....
        ]);

$languageList = ['eng','ru','fr'];

foreach ($languageList as $lang) {
        echo $form
            ->field($model, "name[{$lang}]")
            ->textInput(['value'=>$model->name->other($lang)])
            ->label($model->getAttributeLabel('name') . "_{$lang}");
}