@Override
    public String translate(String text, String sourceLanguage, String targetLanguage)
            throws TikaException, IOException {
        if (!this.isAvailable()) {
            return text;
        }

        WebClient client = WebClient.create(YANDEX_TRANSLATE_URL_BASE);

        String langCode;

        if (sourceLanguage == null) {
            //Translate Service will identify source language
            langCode = targetLanguage;
        } else {
            //Source language is well known
            langCode = sourceLanguage + '-' + targetLanguage;
        }

        //TODO Add support for text over 10k characters
        Response response = client.accept(MediaType.APPLICATION_JSON).query("key", this.apiKey)
                .query("lang", langCode).query("text", text).get();
        StringBuilder responseText = new StringBuilder();
        try (InputStreamReader inputStreamReader = new InputStreamReader(
                (InputStream) response.getEntity(), UTF_8);
                BufferedReader reader = new BufferedReader(inputStreamReader)) {
            String line;
            while ((line = reader.readLine()) != null) {
                responseText.append(line);
            }
        }

        try {
            ObjectMapper mapper = new ObjectMapper();
            JsonNode jsonResp = mapper.readTree(responseText.toString());

            if (!jsonResp.findValuesAsText("code").isEmpty()) {
                String code = jsonResp.findValuesAsText("code").get(0);
                if (code.equals("200")) {
                    return jsonResp.findValue("text").get(0).asText();
                } else {
                    throw new TikaException(jsonResp.findValue("message").get(0).asText());
                }
            } else {
                throw new TikaException("Return message not recognized: " +
                        responseText.toString().substring(0, Math.min(responseText.length(), 100)));
            }
        } catch (JsonParseException e) {
            throw new TikaException(
                    "Error requesting translation from '" + sourceLanguage + "' to '" +
                            targetLanguage +
                            "', JSON response from Lingo24 is not well formatted: " +
                            responseText.toString());
        }
    }
The Yandex Translate API can handle text in <b>plain</b> and/or <b>html</b> format, the default
format is <b>plain</b>
tika-translate/src/main/java/org/apache/tika/language/translate/impl/YandexTranslator.java