From 346f1cd19fe85484622eb8a17ea2a0a7adb97dac Mon Sep 17 00:00:00 2001 From: Alex Schmitt Date: Thu, 6 May 2021 11:55:04 -0700 Subject: [PATCH] Update available locale check in Simple backend This reduces some duplication in the Simple backend by leveraging a check that will validate both string and symbols against a set of available locales. --- lib/i18n/backend/simple.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/i18n/backend/simple.rb b/lib/i18n/backend/simple.rb index 5c7268ef..0dde82d7 100644 --- a/lib/i18n/backend/simple.rb +++ b/lib/i18n/backend/simple.rb @@ -35,8 +35,7 @@ def initialized? def store_translations(locale, data, options = EMPTY_HASH) if I18n.enforce_available_locales && I18n.available_locales_initialized? && - !I18n.available_locales.include?(locale.to_sym) && - !I18n.available_locales.include?(locale.to_s) + !I18n.locale_available?(locale) return data end locale = locale.to_sym