Class Yandex Translate

By | October 12, 2016

In the context of developing multi-lingual pages was the question of automatic translation of texts, products, or other texts.
It turned out the interpreter class which uses the API yandex 1.5.

1476273994-5433-a65fc2f5edf90ab939092d14.png
Access to all API methods is the key.
Get your free API key you need the link
http://api.yandex.ru/key/form.xml?service=trnsl
The key is to write in the file Yandex_Translate in the line

PHP code:
# Your API key for Yandex. Get here: http://api.yandex.ru/key/form.xml?service=trnsl
protected $key = ‘Your API key for Yandex’
In the file text.txt is a demo text and the file text_big large text.
Large texts will be translated into fragments and then collected into one text.
It is possible to obtain a list of translation directions using getLangs.
Separately it is possible to obtain lists from any language to translate and into what language to translate.
As well as a list of language code name of language.
Can someone come in handy , to save time .
To demo place the trans folder in the root of the local domain, and in the file index.php specify the path to the text files demo

class_yandex_trans_27_10-2015

Note; This is for developer. YOU can use at your discretion.