Sha256: abcf654c5d0f519eac773b8790cb0b65f2161e3fb9a37ddab6d2934fcd8dc2e2

Contents?: true

Size: 989 Bytes

Versions: 1

Compression:

Stored size: 989 Bytes

Contents

require "babel_diff/version"
require "babel_diff/file_handler"
require "babel_diff/import_file_handler"
require "babel_diff/yaml_differ"
require "babel_diff/yaml_merger"
require "babel_diff/hash_flattener"

module BabelDiff
  def self.generate_diffs(current_version_path = "config/locales/phrase.en.yml")
    handler = FileHandler.new(current_version_path)

    yaml_differ = YamlDiffer.new(handler.current_version, handler.previous_version)
    updates = yaml_differ.updates
    additions = yaml_differ.additions

    handler.create_updates(updates)
    handler.create_additions(additions)
    handler.version_files
  end

  def self.import_translations(import_directory, phrase_directory = "config/locales/")
    handler = ImportFileHandler.new(import_directory, phrase_directory)
    handler.phrases.each do |language,files|
      phrase, import = files
      yaml_merger = YamlMerger.new(phrase, import)
      handler.update_phrase(language,yaml_merger.merged_yaml)
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
babel_diff-1.1.0 lib/babel_diff.rb