module Transync::Runner

2713 = unicode check mark 2717 = unicode cross mark

Constants

PATH

Public Class Methods

init() click to toggle source
# File lib/transync/runner.rb, line 16
def self.init
  init = Init.new(PATH)
  init.run
end
sync(mode) click to toggle source
# File lib/transync/runner.rb, line 11
def self.sync(mode)
  sync = TranslationSync.new(PATH, mode)
  sync.run(mode)
end
test() click to toggle source
# File lib/transync/runner.rb, line 21
def self.test
  TransyncConfig::CONFIG['FILES'].each do |file|
    xliff_files = XliffTransReader.new(PATH, file, TransyncConfig::CONFIG['LANGUAGES'])
    puts "\u{2713} '#{file}' have all the keys for all languages in XLIFF files.".colorize(:green) if xliff_files.valid?
  end

  TransyncConfig::CONFIG['FILES'].each do |file|
    TransyncConfig::CONFIG['LANGUAGES'].each do |language|
      trans_sync = TranslationSync.new(PATH, 'test', file)

      if trans_sync.diff(language).keys.length == 0
        puts "\u{2713} '#{file}.#{language}' XLIFF is in sync with GDoc.".colorize(:green)
      else
        puts "\u{2717} '#{file}.#{language}' XLIFF is NOT in sync with GDoc. See diff!".colorize(:red)
      end
    end
    puts '----------'
  end
end
update() click to toggle source
# File lib/transync/runner.rb, line 41
def self.update
  TransyncConfig::CONFIG['FILES'].each do |file|
    xliff_files = XliffTransReader.new(PATH, file, TransyncConfig::CONFIG['LANGUAGES'])
    clean = xliff_files.fill_with_missing_keys

    if clean
      puts "\u{2713} '#{file}' already have all the keys in all the XLIFF files".colorize(:green)
    else
      puts "\u{2717} '#{file}' already DID NOT have all the keys in all the XLIFF files. But they were added automatically for you.".colorize(:red)
    end
  end
end