yandex_cloud v0.3.0 YandexCloud.Translate View Source
Client requests to Translate service
Link to this section Summary
Link to this section Functions
Link to this function
detect(options)
View Source
detect(options)
View Source
detect(keyword()) :: {:ok, %{}}
detect(keyword()) :: {:ok, %{}}
Detect language for text.
Example
iex> YandexCloud.Translate.detect([iam_token: "", text: "Hello"])
{:ok, %{"language" => "en"}}
Options
iam_token - IAM-token, required
folder_id - folder ID of your account at YandexCloud, otional]
text - text for detection, required
hint - list of possible languages, optional, example - "en,ru"
Link to this function
langs(options)
View Source
langs(options)
View Source
langs(keyword()) :: {:ok, %{}}
langs(keyword()) :: {:ok, %{}}
Get available languages for translation.
Example
iex> YandexCloud.Translate.langs([iam_token: ""])
{:ok, %{"languages" => [%{"language" => "az"}, %{...}, ...]}}
Options
iam_token - IAM-token, required
folder_id - folder ID of your account at YandexCloud, optional
Link to this function
translate(options)
View Source
translate(options)
View Source
translate(keyword()) :: {:ok, %{}}
translate(keyword()) :: {:ok, %{}}
Translate word or phrase.
Example
iex> YandexCloud.Translate.translate([iam_token: iam_token, text: "hello world", source: "en", target: "es"])
{:ok, %{"translations" => [%{"text" => "hola mundo"}]}}
Options
iam_token - IAM-token, required
folder_id - folder ID of your account at YandexCloud, optional
text - text for detection, required
source - source language, ISO 639-1 format (like "en"), optional
target - target language, ISO 639-1 format (like "ru"), required
format - text format, one of the [plain|html], default - plain, optional