TODO: Write a gem description
Add this line to your application's Gemfile:
gem 'translator_proxy'
And then execute:
$ bundle
Or install it yourself as:
$ gem install translator_proxy
require 'translator_proxy'
# get subscription key from microsoft
provider_info = {
subscription_key: '<subscription_key>',
}
# create translate provider (only Bing now)
TranslatorProxy.provider = ::TranslatorProxy::BingProvider.new(provider_info)
# translate languages
options = { from: 'ja', to: 'en' }
# Translate a string text
text = 'こんにちは' # Japanese.
TranslatorProxy.translate(text, options) # => "Hello"
# Translate string array
texts = ['おはよう', 'こんにちは'] # Japanese.
TranslatorProxy.translate_bulk(texts, options) # => ['Good morning', 'Hello']
TODO: Write usage instructions from server here
- Fork it ( http://github.com//translator_proxy/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request