aboutsummaryrefslogtreecommitdiff
path: root/bin/check-translations.rb
blob: 9f76638266129692cd6fa5d3e7ccb786e09fc506 (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
34
35
36
37
38
39
40
41
#!/usr/bin/ruby
#
#  check-translations.rb DIR LANG
#

v=RUBY_VERSION.split('.').map{ |x| x.to_i }
if (v[0]*100+v[1])*100+v[0] < 10901
    STDERR.puts "You need at least Ruby 1.9.1 to run taginfo"
    exit(1)
end

#------------------------------------------------------------------------------

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)