Class: YamlTranslator::Translator

Inherits:
Object
  • Object
show all
Defined in:
lib/yaml-translator/translator.rb

Instance Method Summary collapse

Constructor Details

#initialize(adapter = Adapters::NoopAdaptor.new) ⇒ Translator



5
6
7
# File 'lib/yaml-translator/translator.rb', line 5

def initialize(adapter = Adapters::NoopAdaptor.new)
  @adapter = adapter
end

Instance Method Details

#translate(locale, options = {}) ⇒ Locale

Translate target



13
14
15
16
# File 'lib/yaml-translator/translator.rb', line 13

def translate(locale, options={})
  translated = @adapter.translate(locale.flatten_hash, options)
  Locale.new(rebuild(translated), options[:to])
end