Module: Langulator

Defined in:
lib/langulator.rb,
lib/langulator/loader.rb,
lib/langulator/munger.rb,
lib/langulator/untangler.rb

Defined Under Namespace

Classes: Loader, Munger, Untangler

Class Method Summary collapse

Class Method Details

.compile(options) ⇒ Object



16
17
18
19
20
# File 'lib/langulator.rb', line 16

def compile(options)
  filename = options[:to]
  translations = compile(options)
  write filename, translations
end

.decompile(aggregate, options) ⇒ Object



26
27
28
29
30
31
32
33
34
35
# File 'lib/langulator.rb', line 26

def decompile(aggregate, options)
  translations = untangle(aggregate, options)

  translations.each do |language, data|
    data.each do |path, translation|
      filename = "#{path}#{language}.yml"
      write filename, translation
    end
  end
end

.munge(options = {}) ⇒ Object



9
10
11
12
13
14
# File 'lib/langulator.rb', line 9

def munge(options = {})
  loader = Loader.new(options)
  munger = Munger.new(:language => loader.origin, :translations => loader.source_translations, :alternates => loader.destination_translations)

  munger.munge
end

.untangle(aggregate, options) ⇒ Object



22
23
24
# File 'lib/langulator.rb', line 22

def untangle(aggregate, options)
  Untangler.new(aggregate, options).untangle
end