yii2-yandex-translate-api Translate your text with yandex translate API

Yii2 extension to Yandex Translate API ΒΆ

  1. Installation
  2. Usage

Yandex Translate API

GitHub Project page: https://github.com/wfstudioru/yii2-yandex-translate-api

Installation ΒΆ

The preferred way to install this extension is through composer.

Either run

php composer.phar require wfstudioru/yii2-yandex-translate-api "dev-master"

or add

"wfstudioru/yii2-yandex-translate-api": "dev-master"

to the `require` section of your composer.json file.

Usage ΒΆ

Create Yandex API Key (free to use) ΒΆ
  1. Go to the Yandex Translate API Site.
  2. Create new API Key.
Component Configuration ΒΆ
'components' => [
    ...
    'translate' => [
        'class' => 'wfstudioru\translate\Translation',
        'key' => 'INSERT-YOUR-API-KEY',
    ],
    ...
],
Yii::$app->translate->translate($source, $target, $text);
Usage ΒΆ
Yii::$app->translate->translate('en-US', 'ru-RU', 'Hi everybody!');

the response would be:

array (
    'code' => 200,    
    'lang' => 'en-ru',
    'text' => array (
        0 => 'ΠŸΡ€ΠΈΠ²Π΅Ρ‚ всСм!' 
                   )
      )

0 0
1 follower
0 downloads
Yii Version: 2.0
License: BSD-2-Clause
Category: Web Service
Developed by: BaBL BaBL
Created on: May 2, 2015
Last updated: 10 years ago

Related Extensions