You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The initial implementation of the locale per thread was done manually by setting Thread.current[:rosetta_locale_session] to an instance of Rosetta::LocaleSession.
This model encapsulates the logic of finding the correct locale based on the supplied input and fallback to the default locale if not found. This works well but I wondered if we'd be better off simply using the Rails CurrentAtributes API.
It's reset after each request, removing the need for Rosetta#with_locale to ensure the locale is set back to whatever it was before
It's built-in rails
One less thread-related consideration in the code, this simplifies things.
Warning
CurrentAttributes being a thread level singleton instance, one needs to be careful not to override any potential user-defined attribute.
The text was updated successfully, but these errors were encountered:
The initial implementation of the locale per thread was done manually by setting
Thread.current[:rosetta_locale_session]
to an instance ofRosetta::LocaleSession
.This model encapsulates the logic of finding the correct locale based on the supplied input and fallback to the default locale if not found. This works well but I wondered if we'd be better off simply using the Rails CurrentAtributes API.
Rosetta#with_locale
to ensure the locale is set back to whatever it was beforeWarning
CurrentAttributes
being a thread level singleton instance, one needs to be careful not to override any potential user-defined attribute.The text was updated successfully, but these errors were encountered: