diff options
-rwxr-xr-x | bin/check-translations.rb | 19 |
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) |