Skip to content

Commit

Permalink
Fixes issue with Fallbacks and enforce_available_locales
Browse files Browse the repository at this point in the history
Fallbacks should check whether each fallback
location being tried was set by
store_translations before deferring to
I18n.translate. Otherwise a I18n::InvalidLocale
may be raised when enforce_available_locales is
set.
  • Loading branch information
romuloceccon committed Dec 7, 2013
1 parent d100659 commit 12aa0f0
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions lib/i18n/backend/fallbacks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ def translate(locale, key, options = {})

options[:fallback] = true
I18n.fallbacks[locale].each do |fallback|
next unless translations.keys.include?(fallback)
catch(:exception) do
result = super(fallback, key, options)
return result unless result.nil?
Expand Down

0 comments on commit 12aa0f0

Please sign in to comment.