From f1eaa77092fd039f415da07af04b05a6cd9827d4 Mon Sep 17 00:00:00 2001 From: Pete Matsyburka Date: Tue, 2 Dec 2025 14:25:45 +0200 Subject: [PATCH] password reset i18n --- app/controllers/passwords_controller.rb | 2 ++ config/initializers/devise.rb | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/controllers/passwords_controller.rb b/app/controllers/passwords_controller.rb index 60de5b12..e166da35 100644 --- a/app/controllers/passwords_controller.rb +++ b/app/controllers/passwords_controller.rb @@ -5,6 +5,8 @@ class PasswordsController < Devise::PasswordsController skip_before_action :require_no_authentication, only: %i[edit update] # rubocop:enable Rails/LexicallyScopedActionFilter + around_action :with_browser_locale + class Current < ActiveSupport::CurrentAttributes attribute :user end diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb index 1329ce87..efa97448 100644 --- a/config/initializers/devise.rb +++ b/config/initializers/devise.rb @@ -17,7 +17,10 @@ module Devise assign_message_metadata(action, record) initialize_from_record(record) - mail(headers_for(action, opts), &) + + I18n.with_locale(record.account.locale) do + mail(headers_for(action, opts), &) + end end end end