Logo

0x5a.live

for different kinds of informations and explorations.

GitHub - ikeikeikeike/bing_translator: A simple Elixir interface to Bing's translation API.

A simple Elixir interface to Bing's translation API. - GitHub - ikeikeikeike/bing_translator: A simple Elixir interface to Bing's translation API.

Visit SiteGitHub - ikeikeikeike/bing_translator: A simple Elixir interface to Bing's translation API.

GitHub - ikeikeikeike/bing_translator: A simple Elixir interface to Bing's translation API.

A simple Elixir interface to Bing's translation API. - GitHub - ikeikeikeike/bing_translator: A simple Elixir interface to Bing's translation API.

Powered by 0x5a.live ๐Ÿ’—

Bing Translator, Microsoft Translator

Build Status Hex version Hex downloads

A simple Elixir interface to Azure's translation API

Installation

If available in Hex, the package can be installed as:

Add bing_translator to your list of dependencies in mix.exs:

def deps do
  [{:bing_translator, "~> 1.0"}]
end

Ensure bing_translator is started before your application:

def application do
  [applications: [:bing_translator]]
end

Getting a Subscription Key

To sign up for the free tier (as of this writing), do the following:

  • Text Translator is here
  • Speech Translator is here

Usage

spanish = BingTranslator.translate(text: "Hello. This will be translated!", from: "en", to: "es")

# without :from for auto language detection
spanish = BingTranslator.translate(text: "Hello. This will be translated!", to: "es")

locale = BingTranslator.detect(text: "Hello. This will be translated!") # => "en"
languages = BingTranslator.supported_language_codes # => ["ar", "bs-Latn", "bg", "ca", "zh-CHS",,,,,]

# The speak method calls a text-to-speech interface in the supplied language.
# It does not translate the text. Format can be 'audio/mp3' or 'audio/wav'

audio = BingTranslator.speak(text: "Hello. This will be spoken!", language: :en, format: "audio/mp3", options: "MaxQuality")

Configuration

The default behaviour is to configure using the application environment:

In config/config.exs, add:

config :bing_translator,
  subscription_key: "Your-Subscription-Key",
  http_client_options: []  #  [ssl: [{:versions, [:"tlsv1.2"]}]]

Or using environment variable

BING_TRANSLATOR_SUBSCRIPTION_KEY=Your-Subscription-Key mix run

Documentation

API Reference.

Elixir Resources

are all listed below.

Resources

listed to get explored on!!

Made with โค๏ธ

to provide different kinds of informations and resources.