summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Jankowski <matt@jankowski.online>2023-12-18 16:49:17 -0500
committerGitHub <noreply@github.com>2023-12-18 21:49:17 +0000
commit7cfc0781980933a6966979afeba5cc15784d665a (patch)
treebb11cae0ee4b166817810c8d94e7482d720e8e0a
parent476d1237d4eda2455df8b75db523e281705c005d (diff)
Fix rails mailer preview not honouring locale (#28418)
-rw-r--r--app/mailers/application_mailer.rb2
-rw-r--r--app/mailers/user_mailer.rb2
2 files changed, 2 insertions, 2 deletions
diff --git a/app/mailers/application_mailer.rb b/app/mailers/application_mailer.rb
index 35f0b5fee18..3312183d47d 100644
--- a/app/mailers/application_mailer.rb
+++ b/app/mailers/application_mailer.rb
@@ -12,7 +12,7 @@ class ApplicationMailer < ActionMailer::Base
protected
def locale_for_account(account, &block)
- I18n.with_locale(account.user_locale || I18n.default_locale, &block)
+ I18n.with_locale(account.user_locale || I18n.locale || I18n.default_locale, &block)
end
def set_autoreply_headers!
diff --git a/app/mailers/user_mailer.rb b/app/mailers/user_mailer.rb
index 2af2a3a41d2..432b851b5e6 100644
--- a/app/mailers/user_mailer.rb
+++ b/app/mailers/user_mailer.rb
@@ -202,6 +202,6 @@ class UserMailer < Devise::Mailer
end
def locale
- @resource.locale.presence || I18n.default_locale
+ @resource.locale.presence || I18n.locale || I18n.default_locale
end
end