Microsoft Translator
A simple Elixir interface to Microsoft Translator translation API in Azure. The Translator is a cloud-based machine translation service. The core service is the Translator, which powers a number of Microsoft products and services, and is used by thousands of businesses worldwide in their applications and workflows, which allows their content to reach a global audience.
Installation
If available in Hex, the package can be installed
by adding microsoft_translator
to your list of dependencies in mix.exs
:
def deps do
[
{:microsoft_translator, "~> 0.1.5"}
]
end
Get access to API
Creating a account in the Microsoft Azure
To perform operations in Microsoft Azure via the API, you need to:
- Sign in to the Azure portal.
- Create a subscription for Translator. Create a resource in the Search the Marketplace search box, enter Translator and then select it.
- Select Create to define details for the subscription.
- From the Pricing tier list, select the pricing tier that best fits your needs.
- Select Create to finish creating the subscription.
Getting a Authentication key
When you sign up for Translator, you get a personalized access key unique to your subscription. This key is required on each call to the Translator.
- Retrieve your authentication key by first selecting the appropriate subscription.
- Select Keys in the Resource Management section of your subscription's details.
- Copy either of the keys listed for your subscription.
config :microsoft_translator,
api_key: "KEY_1 or KEY_2"
endpoint: "ENDPOINT"
Usage
Supported languages
Request for getting list of supported languages is #languages.
MicrosoftTranslator.languages()
Language detection
Request for detecting language of text is #detect.
MicrosoftTranslator.detect("Hello")
Translation
Request for translating text is #translate.
MicrosoftTranslator.translate("Hello", "uk")
Contributing
Bug reports and pull requests are welcome on at https://gl.negrienko.com/negrienko/microsoft_translator.
License
The hex is available as open source under the terms of the MIT License.
Disclaimer
Use this package at your own peril and risk.
Documentation
Documentation generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/microsoft_translator.