mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-08-05 05:25:24 +02:00
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
This commit is contained in:
parent
7fabca4679
commit
ab40289eb4
130 changed files with 25190 additions and 10 deletions
|
@ -1,5 +1,5 @@
|
|||
class ApplicationController < ActionController::Base
|
||||
include AutoSync, Authentication, Invitable, SelfHostable, StoreLocation
|
||||
include Localize, AutoSync, Authentication, Invitable, SelfHostable, StoreLocation
|
||||
include Pagy::Backend
|
||||
|
||||
# Only allow modern browsers supporting webp images, web push, badges, import maps, CSS nesting, and CSS :has.
|
||||
|
|
13
app/controllers/concerns/localize.rb
Normal file
13
app/controllers/concerns/localize.rb
Normal file
|
@ -0,0 +1,13 @@
|
|||
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
|
|
@ -21,6 +21,6 @@ class Settings::PreferencesController < SettingsController
|
|||
private
|
||||
|
||||
def preference_params
|
||||
params.require(:user).permit(family_attributes: [ :id, :currency ])
|
||||
params.require(:user).permit(family_attributes: [ :id, :currency, :locale ])
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue