aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJochen Topf <jochen@topf.org>2011-10-26 11:40:14 +0200
committerJochen Topf <jochen@topf.org>2011-10-26 11:40:14 +0200
commitd5a47e37084a482bf4d7ff4b17b8d1fdd6a6dd49 (patch)
treecd46b96065191fea441d6deeac88427711f772ad
parent4c5b5e2ebb156569a1ac8071b208d318de264fa6 (diff)
downloadtaginfo-d5a47e37084a482bf4d7ff4b17b8d1fdd6a6dd49.tar
taginfo-d5a47e37084a482bf4d7ff4b17b8d1fdd6a6dd49.tar.gz
Add script to help find missing translations.
-rwxr-xr-xbin/check-translations.rb33
1 files changed, 33 insertions, 0 deletions
diff --git a/bin/check-translations.rb b/bin/check-translations.rb
new file mode 100755
index 0000000..e96750b
--- /dev/null
+++ b/bin/check-translations.rb
@@ -0,0 +1,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)
+