diff lib/tasks/locales.rake @ 1298:4f746d8966dd redmine_2.3_integration

Merge from redmine-2.3 branch to create new branch redmine-2.3-integration
author Chris Cannam
date Fri, 14 Jun 2013 09:28:30 +0100
parents 622f24f53b42
children
line wrap: on
line diff
--- a/lib/tasks/locales.rake	Fri Jun 14 09:07:32 2013 +0100
+++ b/lib/tasks/locales.rake	Fri Jun 14 09:28:30 2013 +0100
@@ -43,7 +43,15 @@
     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|