From 12aa0f0d0fc1822d6825d81bb9cdfdc4eb325dfd Mon Sep 17 00:00:00 2001 From: "Romulo A. Ceccon" Date: Sat, 7 Dec 2013 16:09:06 +0000 Subject: [PATCH] Fixes issue with Fallbacks and enforce_available_locales 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. --- lib/i18n/backend/fallbacks.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/i18n/backend/fallbacks.rb b/lib/i18n/backend/fallbacks.rb index 7252bb00..e55e0226 100644 --- a/lib/i18n/backend/fallbacks.rb +++ b/lib/i18n/backend/fallbacks.rb @@ -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?