aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJochen Topf <jochen@topf.org>2014-09-05 13:51:31 +0200
committerJochen Topf <jochen@topf.org>2014-09-05 13:51:31 +0200
commit64e47592b0ea6de3660e60b9d6875eb028cfef35 (patch)
tree4b7b34f738e2c67d877543eb756878c35cf85dc1
parentaf129af70f5a49bf3cee0d5278a3938f3533b458 (diff)
downloadtaginfo-64e47592b0ea6de3660e60b9d6875eb028cfef35.tar
taginfo-64e47592b0ea6de3660e60b9d6875eb028cfef35.tar.gz
Extent check-translations script to better find missing translations.
-rwxr-xr-xbin/check-translations.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/bin/check-translations.rb b/bin/check-translations.rb
index 9f76638..16e9b28 100755
--- a/bin/check-translations.rb
+++ b/bin/check-translations.rb
@@ -19,6 +19,20 @@ 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
@@ -37,5 +51,10 @@ def walk(path, en, other)
end
end
+
+if look_for_error('', i18n_lang)
+ exit 1
+end
+
walk('', i18n_en, i18n_lang)