-
-
Notifications
You must be signed in to change notification settings - Fork 417
Open
Description
What I tried to do
teamskills(dev)> I18n.locale
=> :en
teamskills(dev)> fallbacks = I18n.fallbacks[I18n.locale]
=> [:en, :"en-US"]
teamskills(dev)> fallbacks.concat([:wtf])
=> [:en, :"en-US", :wtf]
teamskills(dev)> I18n.fallbacks[I18n.locale]
=> [:en, :"en-US", :wtf]
What I expected to happen
I would either expect that the array that is returned from I18n.fallbacks is a dup of the original one so that I can mutate it without poisoning future requests, or that the array that is returned is frozen so that it can't be mutated.
I personally would prefer the frozen array so that we don't incur the overhead of duplicating the array on each request if we probably aren't going to mutate it.
I can make a PR once we have decided which behaviour we prefer.
What actually happened
The array that is returned is mutable and if I mutate it then the mutated array is returned for future requests.
Versions of i18n, rails, and anything else you think is necessary
i18n version 1.14.7
rails 7.2.2.1
ruby 3.4.2
Bonus points for providing an application or a small code example which reproduces the issue.
Thanks! ❤️
Metadata
Metadata
Assignees
Labels
No labels