MicrosoftTranslator v0.1.5 MicrosoftTranslator View Source

Basic functions for requests to Microsoft Translator API on Microsoft Azure

Link to this section Summary

Functions

Detect the language of the text

Retrieves the list of supported languages.

Link to this section Functions

Detect the language of the text

Get text as a string param and return a map with language code

MicrosoftTranslator.detect("Криївка")
%{languageCode: "uk"}

Or get a map with :text and :languageCodeHints (for specify the most likely languages).

In some languages, one and the same word has the same spelling. For example, the English word “hand” is also written as “hand” in German, Swedish, and Dutch. If the text you transmit contains words like this, Translate may detect the source language incorrectly.

To avoid mistakes, you can use the languageCodeHints field to specify which languages should be given priority when determining the language of the text

MicrosoftTranslator.detect(%{text: "Капелюх"})
%{languageCode: "uk"}

Retrieves the list of supported languages.

Return a map with language code (use it for translations) and native language name

MicrosoftTranslator.detect()
%{
  languages: [
    %{code: "af", "name":"Afrikaans","nativeName":"Afrikaans"},
    %{code: "ar", "name":"Arabic","nativeName":"العربية"},
    %{code: "bg", "name":"Bulgarian","nativeName":"Български"},
    %{code: "bn", "name":"Bangla","nativeName":"বাংলা"},
    %{code: "bs", "name":"Bosnian","nativeName":"bosanski (latinica)"}
    ...
  ]
}
Link to this function

translate(text, to, from)

View Source