Class: PainfulTranslate::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/painful_translate/client.rb

Defined Under Namespace

Classes: NoTargetLanguage

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.instanceObject



5
6
7
# File 'lib/painful_translate/client.rb', line 5

def instance
  @instance ||= new
end

Instance Method Details

#translate(*keys, options) ⇒ Object



10
11
12
13
14
15
16
17
18
# File 'lib/painful_translate/client.rb', line 10

def translate(*keys, options)
  opts = _normalize options
  PainfulTranslate::GoogleTranslator.new.tap do |t|
    t.strings = keys
    t.to = opts[:to]
    t.from = opts[:from]
    t.session = _session
  end.translations
end