FIX: I18n couldn't find translations. (#11774)

"I18n.t(key, locale: locale)" fails to find the correct translation in some cases. We should always wrap it with the "I18n.with_locale(locale)" method.

Also, reverting an override wasn't always possible because the serializer always used "I18n.locale" as the locale.
This commit is contained in:
Roman Rizzi
2021-01-20 17:43:00 -03:00
committed by GitHub
parent 3b2f6e129a
commit 82d2284ce6
2 changed files with 10 additions and 7 deletions

View File

@@ -15,7 +15,7 @@ class SiteTextSerializer < ApplicationSerializer
if options[:overridden_keys]
options[:overridden_keys].include?(object[:id])
else
TranslationOverride.exists?(locale: I18n.locale, translation_key: object[:id])
TranslationOverride.exists?(locale: object[:locale], translation_key: object[:id])
end
end