How to set the Mobility locale
masterMobility has its own locale setting that defaults to I18n.locale but can be set independently. This is useful when you want to show content in one language while the UI is in another.
Mobility.locale = :fr
# Set locale within a block
Mobility.with_locale(:ja) do
Mobility.locale #=> :ja
end
# Mobility.locale is back to :frMobility uses RequestStore to ensure these global variables are reset after every request, making it thread-safe in Rails environments.
Mobility.with_locale(:ja) do
# code using Japanese translations
end