Skip to content

Commit

Permalink
extract keys method for MissingTranslationsData
Browse files Browse the repository at this point in the history
  • Loading branch information
Sven Fuchs committed Nov 4, 2010
1 parent 0b9a1f2 commit 3a37a38
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/i18n/exceptions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,13 @@ class MissingTranslationData < ArgumentError
def initialize(locale, key, opts = nil)
@key, @locale, @options = key, locale, opts.dup || {}
options.each { |k, v| options[k] = v.inspect if v.is_a?(Proc) }
super "translation missing: #{keys.join(', ')}"
end

def keys
keys = I18n.normalize_keys(locale, key, options[:scope])
keys << 'no key' if keys.size < 2
super "translation missing: #{keys.join(', ')}"
keys
end
end

Expand Down Expand Up @@ -68,4 +71,4 @@ def initialize(type, filename)
super "can not load translations from #{filename}, the file type #{type} is not known"
end
end
end
end

0 comments on commit 3a37a38

Please sign in to comment.