Class: YamlTranslator::Translator
- Inherits:
-
Object
- Object
- YamlTranslator::Translator
- Defined in:
- lib/yaml-translator/translator.rb
Instance Method Summary collapse
-
#initialize(adapter = Adapters::NoopAdaptor.new) ⇒ Translator
constructor
A new instance of Translator.
-
#translate(locale, options = {}) ⇒ Locale
Translate target.
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, ={}) translated = @adapter.translate(locale.flatten_hash, ) Locale.new(rebuild(translated), [:to]) end |