From 3218b8204c09832f3e8ea0ac3cac6c6b57b27d95 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Thu, 3 Jan 2013 11:12:41 +0000 Subject: [PATCH] Check that locale is well formed. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11096 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- lib/tasks/locales.rake | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/tasks/locales.rake b/lib/tasks/locales.rake index 8ad011881..6311d6ab1 100644 --- a/lib/tasks/locales.rake +++ b/lib/tasks/locales.rake @@ -43,7 +43,15 @@ namespace :locales do files = Dir.glob(File.join(dir,'*.{yaml,yml}')) files.sort.each do |file| puts "parsing #{file}..." - file_strings = YAML.load(File.read(file)) + file_strings = YAML.load_file(file) + unless file_strings.is_a?(Hash) + puts "#{file}: content is not a Hash (#{file_strings.class.name})" + next + end + unless file_strings.keys.size == 1 + puts "#{file}: content has multiple keys (#{file_strings.keys.size})" + next + end file_strings = file_strings[file_strings.keys.first] file_strings.each do |key, string| -- 2.39.5