Skip to content

Commit

Permalink
Remaining fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
hron84 committed Mar 27, 2012
1 parent 41c378f commit 645b099
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
6 changes: 5 additions & 1 deletion lib/i18n-spec.rb
@@ -1,3 +1,7 @@
if defined?(Psych) and !defined?(YAML::ParseError)
YAML::ParseError = Psych::SyntaxError
end

Dir[File.dirname(__FILE__) + '/i18n-spec/models/*.rb'].each {|file| require file }
Dir[File.dirname(__FILE__) + '/i18n-spec/matchers/*.rb'].each {|file| require file }
Dir[File.dirname(__FILE__) + '/i18n-spec/shared_examples/*.rb'].each {|file| require file }
Dir[File.dirname(__FILE__) + '/i18n-spec/shared_examples/*.rb'].each {|file| require file }
13 changes: 11 additions & 2 deletions lib/i18n-spec/models/locale_file.rb
Expand Up @@ -23,9 +23,15 @@ def flattened_translations
end

def pluralizations
flatten_tree(translations).select do |key, value|
result = flatten_tree(translations).select do |key, value|
value.is_a?(Hash)
end

if result.is_a?(Array)
Hash[result]
else
result
end
end

def invalid_pluralization_keys
Expand All @@ -43,7 +49,10 @@ def is_parseable?
begin
yaml_load_content
true
rescue Psych::SyntaxError => e
rescue YAML::ParseError => e
@errors[:unparseable] = e.to_s
false
rescue ArgumentError => e
@errors[:unparseable] = e.to_s
false
end
Expand Down

0 comments on commit 645b099

Please sign in to comment.