Class: Translatomatic::Translator::Google
- Defined in:
- lib/translatomatic/translator/google.rb
Overview
Interface to the Google translation API
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Google
constructor
Create a new Google translator instance.
-
#languages ⇒ Array<String>
A list of languages supported by this translator.
Methods inherited from Base
Constructor Details
#initialize(options = {}) ⇒ Google
Create a new Google translator instance
15 16 17 18 19 20 |
# File 'lib/translatomatic/translator/google.rb', line 15 def initialize( = {}) super() key = [:google_api_key] || ENV["GOOGLE_API_KEY"] raise t("translator.google_key_required") if key.nil? EasyTranslate.api_key = key end |
Instance Method Details
#languages ⇒ Array<String>
Returns A list of languages supported by this translator.
23 24 25 |
# File 'lib/translatomatic/translator/google.rb', line 23 def languages EasyTranslate::LANGUAGES.keys end |