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