Yandex Translate API

License Codacy Badge Coverage Status Build Status

yandex-translate-api is a simple REST client library for Yandex.Translate. The API provides access to the Yandex online machine translation service. It supports more than 90 languages and can translate separate words or complete texts.

Online documentation: Javadoc


The following actions are required to work with this library:


Gradle configuration:

repositories {
    maven {
        url ""

dependencies {
    compile 'com.github.vbauer:yandex-translate-api:1.4.2'

Maven configuration:





The entry point of this library is YTranslateApi interface (and the corresponding implementation YTranslateApiImpl).

def key = "<your key>"
def api = new YTranslateApiImpl(key)

Using instance of this service you can work with the following features:


The following example returns Language.EN:

def language = api.detectionApi().detect("Hello, World!")


To retrieve all available languages without their names, use the following code snippet:

def languages = api.languageApi().all()

It is also possible to fetch names for each language, using ui parameter:

def languages = api.languageApi().all(Language.RU)


The following code should translate Russian's "Как дела?" to some English variant ("How are you doing?" or something similar):

def translation = api.translationApi().translate(
    "Как дела?", Direction.of(Language.RU, Language.EN)

Source language could be also detected automatically (so you need to specify only target language):

def translation = api.translationApi().translate("Как дела?", Language.EN)

Thanks to