From d0240440bf6616240523a215cd228a1d17740adb Mon Sep 17 00:00:00 2001 From: Jonian Guveli Date: Sun, 8 Nov 2020 16:26:46 +0200 Subject: [PATCH] store fallbacks in Thread.current --- lib/i18n/backend/fallbacks.rb | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/i18n/backend/fallbacks.rb b/lib/i18n/backend/fallbacks.rb index ce8635bb..f9f17a2b 100644 --- a/lib/i18n/backend/fallbacks.rb +++ b/lib/i18n/backend/fallbacks.rb @@ -10,17 +10,15 @@ # # I18n::Backend::Simple.include(I18n::Backend::Fallbacks) module I18n - @@fallbacks = nil - class << self # Returns the current fallbacks implementation. Defaults to +I18n::Locale::Fallbacks+. def fallbacks - @@fallbacks ||= I18n::Locale::Fallbacks.new + Thread.current[:i18n_fallbacks] ||= I18n::Locale::Fallbacks.new end # Sets the current fallbacks implementation. Use this to set a different fallbacks implementation. def fallbacks=(fallbacks) - @@fallbacks = fallbacks.is_a?(Array) ? I18n::Locale::Fallbacks.new(fallbacks) : fallbacks + Thread.current[:i18n_fallbacks] = fallbacks.is_a?(Array) ? I18n::Locale::Fallbacks.new(fallbacks) : fallbacks end end