aboutsummaryrefslogtreecommitdiff
path: root/bin/check-translations.rb
blob: e96750b6a8ff7fe2d88b3905aee54a2b450550a6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/ruby
#
#  check-translations.rb DIR LANG
#

require 'yaml'

dir  = ARGV[0]
lang = ARGV[1]

i18n_en   = YAML.load_file("#{dir}/en.yml")
i18n_lang = YAML.load_file("#{dir}/#{lang}.yml")

def walk(path, en, other)
    en.keys.sort.each do |key|
        name = path.sub(/^\./, '') + '.' + key
        if en[key].class == Hash
            if other.nil?
                puts "MISSING: #{name} [en=#{en[key]}]"
            else
                walk(path + '.' + key, en[key], other[key])
            end
        else
#            puts "#{name} [#{en[key]}] [#{other[key]}]"
            if other.nil?|| ! other[key]
                puts "MISSING: #{name} [en=#{en[key]}]"
            end 
        end
    end
end

walk('', i18n_en, i18n_lang)