Class: Translatomatic::Provider::Microsoft
- Defined in:
- lib/translatomatic/provider/microsoft.rb
Overview
Interface to the Microsoft translation API
Instance Attribute Summary
Attributes inherited from Base
Class Method Summary collapse
-
.supports_alternative_translations? ⇒ boolean
True if a string can have alternative translations.
-
.supports_no_translate_html? ⇒ boolean
True if this provider supports html5 <span translate=“no”></span> tags.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Microsoft
constructor
Create a new Microsoft provider instance.
-
#languages ⇒ Array<String>
A list of languages supported by this provider.
Methods inherited from Base
Constructor Details
#initialize(options = {}) ⇒ Microsoft
Create a new Microsoft provider instance
23 24 25 26 27 |
# File 'lib/translatomatic/provider/microsoft.rb', line 23 def initialize( = {}) super() @key = [:microsoft_api_key] || ENV['MICROSOFT_API_KEY'] raise t('provider.microsoft.key_required') if @key.nil? end |
Class Method Details
.supports_alternative_translations? ⇒ boolean
Returns True if a string can have alternative translations.
13 14 15 |
# File 'lib/translatomatic/provider/microsoft.rb', line 13 def self.supports_alternative_translations? true end |
.supports_no_translate_html? ⇒ boolean
Returns true if this provider supports html5 <span translate=“no”></span> tags.
18 19 20 |
# File 'lib/translatomatic/provider/microsoft.rb', line 18 def self.supports_no_translate_html? true end |
Instance Method Details
#languages ⇒ Array<String>
Returns A list of languages supported by this provider.
30 31 32 |
# File 'lib/translatomatic/provider/microsoft.rb', line 30 def languages @languages ||= fetch_languages end |