You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Don't worry, they have a free tier! (up to 2 million translated characters/month) Once you sign up for the Translator
API you will also need to register your application with the Azure
Datamarket.
Also, you shouldn't stress about what to put for the Redirect URI. For the purposes of
this gem you won't be using it so your project's homepage will work just
fine. You'll use the Client ID and Client secret to authenticate
your requests to the API. Once this is done you'll install it like you
would any other gem...
Add this line to your application's Gemfile:
gem 'microsoft_translator'
And then execute:
$ bundle
Or install it yourself as:
$ gem install microsoft_translator
Usage
Create a MicrosoftTranslator::Client with your Client ID & secret.
To translate pass in the foreign text along with the language codes for
the language you are going from/to and the content type. The content
type is either "text/plain" or "text/html"
spanish="hasta luego muchacha"translator.translate(spanish,"es","en","text/html")# => "until then girl"
Language Detection
To detect the language simply pass in the foreign text. The language
code will be returned.