Sha256: cbc9e3477c8f49e8bd8fadb55ba6b3b42dba803fa87b619cbbbcf408de5ac99c

Contents?: true

Size: 881 Bytes

Versions: 1

Compression:

Stored size: 881 Bytes

Contents

#!/usr/bin/env ruby

$LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__) + "/../lib"))

require 'missing_t'

def hashify(strings)
  strings.map { |s| s.split('.') }.each_with_object({}) do |segmented_string, h|
    segmented_string.each do |segment|
      h[segment] ||= {}
      h = h[segment]
    end
  end
end

def print_hash(h, level)
  h.each_pair do |k,v|
    puts %(#{" " * (level*2)}#{k}:)
    print_hash(v, level+1)
  end
end

missing_t = MissingT.new(MissingT::FileReader.new)
missing_t.parse_options(ARGV)
missing_message_strings = missing_t.find_missing_translations(ARGV.first).values.map { |ms| hashify(ms) }

missing = missing_message_strings.each_with_object({}) do |h, all_message_strings|
  all_message_strings.deep_safe_merge!(h)
end

missing.each do |language, missing_for_language|
  puts
  puts "#{language}:"
  print_hash(missing_for_language, 1)
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
missing_t-0.3.2 bin/missing_t