The new implementation detects when a Fiber inherited a configuration owned by another Fiber:
if current.respond_to?(:owned_by?) && !current.owned_by?(Fiber.current)
current = current.dup
Fiber[:i18n_config] = current
end
The problem is in I18n::Config#initialize_copy:
def initialize_copy(other)
@owner = Fiber.current
end
It changes the owner of the copied configuration, but it does not clear the copied @locale, i.e., Child Fiber inherits parent’s explicit @locale.
So if the parent Fiber currently has:
I18n.locale == :zh_CN
a child Fiber can inherit a copied configuration that still contains:
@locale == :zh_CN
even though that child Fiber now represents a different request that should resolve to English.
This cause a problem in discourse. When the user is using a display language different from the default language. Say, Chinese as the site default language and English as the display language, pages may accidentally display in Chinese, or a combination of English and Chinese.
Raise a commit to rollback the version update and added some spec, maybe pausing the update until upstream fix that will be a great idea.