blob: 16e9b28b80d55b36c74b9bf849bb49187c4ca50a (
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
#!/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 look_for_error(path, data)
if data.nil?
puts "No data for #{path.sub(/^\./, '')}"
return true
elsif data.class == Hash
data.keys.sort.each do |key|
if look_for_error(path + '.' + key, data[key])
return true
end
end
end
return false
end
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
if look_for_error('', i18n_lang)
exit 1
end
walk('', i18n_en, i18n_lang)
|