Auto translate, detect language. API offers text translation function for more than 20 language pairs.
Uses Yandex API http://api.yandex.ru/translate/ . Terms of use http://legal.yandex.ru/translate_api/ .
Current version can:
- Translate text and html
- Detect text and html language
- Translated languages list
- Translate direction list
- Cached requests to API
- Translate i18n/messages files
- Update and expand caching
- Support others translation services
To use, download the source, extract and rename to translation
.
Move that folder into your modules directory, activate in your bootstrap,
set Translation::$key
- http://api.yandex.ru/key/form.xml?service=trnsl
and Translation::$certificate
- path to certificate *.crt file
(certificate chain in the format pem).
Configure:
Translation::$key = 'trnsl.1 .. 32'; Translation::$certificate = APPPATH.'YandexTranslate.crt'; Translation::$to = 'fr'; Translation::$from = 'en';
Translate:
$i18n = Kohana::load('... i18n/ru.php'); $i18n = Translation::translate($i18n, 'ru', 'en', TRUE);
Language detect:
echo Translation::detect('тест тост', TRUE);
Translate direction:
$dirs = Translation::direction();
Translated language list:
$langs = Translation::langs('ru');