From 64e47592b0ea6de3660e60b9d6875eb028cfef35 Mon Sep 17 00:00:00 2001 From: Jochen Topf Date: Fri, 5 Sep 2014 13:51:31 +0200 Subject: Extent check-translations script to better find missing translations. --- bin/check-translations.rb | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'bin') 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) -- cgit v1.2.3