pashkinz92/yii2-yandex-translate

Translate content using YandexTranslateAPI

1.0.2 2016-05-30 08:33 UTC

This package is auto-updated.

Last update: 2024-02-29 03:11:16 UTC


README

Translate content using YandexTranslateAPI

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist pashkinz92/yii2-yandex-translate "*"

or add

"pashkinz92/yii2-yandex-translate": "*"

to the require section of your composer.json file.

Usage

    'components' => [
         ...
         'translate' => [
             'class' => \pashkinz92\yandex\translate\Translation::className(),
             'key' => 'yandexTranslateApiKey',
         ],
         ...
     ]

Once the extension is installed, simply use it in your code by :

 
     $lang =  Yii::$app->translate->detect('Hello !');
     echo '<pre>';
     var_dump($lang);
     echo '</pre>';