Check that locale is well formed.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11096 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2013-01-03 11:12:41 +00:00
parent 6f614c034f
commit 3218b8204c
1 changed files with 9 additions and 1 deletions

View File

@ -43,7 +43,15 @@ namespace :locales do
files = Dir.glob(File.join(dir,'*.{yaml,yml}')) files = Dir.glob(File.join(dir,'*.{yaml,yml}'))
files.sort.each do |file| files.sort.each do |file|
puts "parsing #{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 = file_strings[file_strings.keys.first]
file_strings.each do |key, string| file_strings.each do |key, string|