1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-07-21 22:29:38 +02:00
Maybe/app/controllers/concerns/localize.rb
Zach Gollwitzer ab40289eb4
Allow users to set preferred locale in settings and provide basic date and time localization support (#1226)
* Add basic date and time localization

* Normalize translations

* Localize transaction dates

* Removed unsupported Rails locales
2024-10-02 14:02:17 -04:00

13 lines
262 B
Ruby

module Localize
extend ActiveSupport::Concern
included do
around_action :switch_locale
end
private
def switch_locale(&action)
locale = Current.family.try(:locale) || I18n.default_locale
I18n.with_locale(locale, &action)
end
end