summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2013-01-03 11:12:41 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2013-01-03 11:12:41 +0000
commit3218b8204c09832f3e8ea0ac3cac6c6b57b27d95 (patch)
tree31a3889020ff4772a42b9c839b901a8f535837a0
parent6f614c034ff9fa6946906ddc9bd8181d6dcfc6d5 (diff)
downloadredmine-3218b8204c09832f3e8ea0ac3cac6c6b57b27d95.tar.gz
redmine-3218b8204c09832f3e8ea0ac3cac6c6b57b27d95.zip
Check that locale is well formed.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11096 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--lib/tasks/locales.rake10
1 files changed, 9 insertions, 1 deletions
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|