2020-06-19 08:45:38 +03:00
< img align = "right" width = "50" height = "50" src = "assets/microsoft_translator.svg" >
# 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 ](https://hex.pm/docs/publish ), the package can be installed
by adding `microsoft_translator` to your list of dependencies in `mix.exs` :
```elixir
def deps do
[
2020-06-30 07:48:19 +03:00
{:microsoft_translator, "~> 0.1.5"}
2020-06-19 08:45:38 +03:00
]
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 ](https://ms.portal.azure.com/ ) 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.
1. Retrieve your authentication key by first selecting the appropriate subscription.
1. Select **Keys** in the **Resource Management** section of your subscription's details.
1. Copy either of the keys listed for your subscription.
```elixir
config :microsoft_translator,
api_key: "KEY_1 or KEY_2"
endpoint: "ENDPOINT"
```
## Usage
### Supported languages
Request for getting list of supported languages is #languages .
```elixir
MicrosoftTranslator.languages()
```
### Language detection
Request for detecting language of text is #detect .
```elixir
MicrosoftTranslator.detect("Hello")
```
### Translation
Request for translating text is #translate .
```elixir
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 ](http://opensource.org/licenses/MIT ).
## Disclaimer
Use this package at your own peril and risk.
## Documentation
Documentation generated with [ExDoc ](https://github.com/elixir-lang/ex_doc )
and published on [HexDocs ](https://hexdocs.pm ). Once published, the docs can
be found at [https://hexdocs.pm/microsoft_translator ](https://hexdocs.pm/microsoft_translator ).