lib/i18n/tasks/data_traversal.rb in i18n-tasks-0.2.6 vs lib/i18n/tasks/data_traversal.rb in i18n-tasks-0.2.7
- old
+ new
@@ -2,10 +2,10 @@
# translation of the key found in the passed hash or nil
# @return [String,nil]
def t(hash = data[base_locale], key)
if hash.is_a?(String)
# has is a locale
- raise ArgumentError.new("invalid locale: #{hash}") if hash =~ /[^A-z-]/
+ raise ArgumentError.new("invalid locale: #{hash}") if hash =~ /[^A-z\d-]/
hash = data[hash]
end
key.split('.').inject(hash) { |r, seg| r[seg] if r }
end
\ No newline at end of file