Class: Translatomatic::Translator::Google

Inherits:
Base
  • Object
show all
Defined in:
lib/translatomatic/translator/google.rb

Instance Attribute Summary

Attributes inherited from Base

#listener

Instance Method Summary collapse

Methods inherited from Base

#name, #translate

Methods included from Util

#locale, #log, #string

Constructor Details

#initialize(options = {}) ⇒ Google

Create a new Google translator instance



11
12
13
14
15
16
# File 'lib/translatomatic/translator/google.rb', line 11

def initialize(options = {})
  super(options)
  key = options[:google_api_key] || ENV["GOOGLE_API_KEY"]
  raise "google api key required" if key.nil?
  EasyTranslate.api_key = key
end

Instance Method Details

#languagesArray<String>

Returns A list of languages supported by this translator.

Returns:

  • (Array<String>)

    A list of languages supported by this translator.



19
20
21
# File 'lib/translatomatic/translator/google.rb', line 19

def languages
  EasyTranslate::LANGUAGES.keys
end