class YamlTranslator::Translator

Public Class Methods

new(adapter = Adapters::NoopAdapter.new) click to toggle source
# File lib/yaml-translator/translator.rb, line 5
def initialize(adapter = Adapters::NoopAdapter.new)
  @adapter = adapter
end

Public Instance Methods

adapter_name() click to toggle source
# File lib/yaml-translator/translator.rb, line 9
def adapter_name
  @adapter.name
end
file(f) click to toggle source
# File lib/yaml-translator/translator.rb, line 25
def file(f)
  FileContext.new(Locale.load_file(f), self)
end
string(s) click to toggle source
# File lib/yaml-translator/translator.rb, line 21
def string(s)
  StringContext.new(Locale.load(s), self)
end
translate(locale_texts, options = {}) click to toggle source

Translate target

@param [Hash] locale texts of translate target @return [Hash] locale texts

# File lib/yaml-translator/translator.rb, line 17
def translate(locale_texts, options = {})
  @adapter.translate(locale_texts, options)
end