PHP code example of rybinden / yii2-translate
1. Go to this page and download the library: Download rybinden/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/ */
rybinden / yii2-translate example snippets
'components' => [
'translate' => [
'class' => 'rybinden\translate\YandexTranslate',
'key' => 'ваш_ключ_приложения', // http://api.yandex.com/key/keyslist.xml
//'lang' => 'ru', установлено переводить на русский по умолчанию
],
...
]
echo Yii::$app->translate->translate('Эта строка будет переведена на английский'); // можно указать второй параметр - язык, на который нужно перевести
php composer.phar