about summary refs log tree commit diff
path: root/app/mailers
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2016-11-16 17:51:02 +0100
committerEugen Rochko <eugen@zeonfederated.com>2016-11-16 17:56:31 +0100
commit2c766bd4b4c6dcf8e7c9a6dd9421edca0de57aba (patch)
treed84f472de5ff84502928fec8582be492c45a6faf /app/mailers
parent01e43c3e5799b575a70798056945365ddf51f3ad (diff)
Add user locale setting
Diffstat (limited to 'app/mailers')
-rw-r--r--app/mailers/notification_mailer.rb20
1 files changed, 16 insertions, 4 deletions
diff --git a/app/mailers/notification_mailer.rb b/app/mailers/notification_mailer.rb
index 33bea4c79..cf5ad3f92 100644
--- a/app/mailers/notification_mailer.rb
+++ b/app/mailers/notification_mailer.rb
@@ -8,7 +8,10 @@ class NotificationMailer < ApplicationMailer
     @status = status
 
     return unless @me.user.settings(:notification_emails).mention
-    mail to: @me.user.email, subject: I18n.t('notification_mailer.mention.subject', name: @status.account.acct)
+
+    I18n.with_locale(@me.user.locale || I18n.default_locale) do
+      mail to: @me.user.email, subject: I18n.t('notification_mailer.mention.subject', name: @status.account.acct)
+    end
   end
 
   def follow(followed_account, follower)
@@ -16,7 +19,10 @@ class NotificationMailer < ApplicationMailer
     @account = follower
 
     return unless @me.user.settings(:notification_emails).follow
-    mail to: @me.user.email, subject: I18n.t('notification_mailer.follow.subject', name: @account.acct)
+
+    I18n.with_locale(@me.user.locale || I18n.default_locale) do
+      mail to: @me.user.email, subject: I18n.t('notification_mailer.follow.subject', name: @account.acct)
+    end
   end
 
   def favourite(target_status, from_account)
@@ -25,7 +31,10 @@ class NotificationMailer < ApplicationMailer
     @status  = target_status
 
     return unless @me.user.settings(:notification_emails).favourite
-    mail to: @me.user.email, subject: I18n.t('notification_mailer.favourite.subject', name: @account.acct)
+
+    I18n.with_locale(@me.user.locale || I18n.default_locale) do
+      mail to: @me.user.email, subject: I18n.t('notification_mailer.favourite.subject', name: @account.acct)
+    end
   end
 
   def reblog(target_status, from_account)
@@ -34,6 +43,9 @@ class NotificationMailer < ApplicationMailer
     @status  = target_status
 
     return unless @me.user.settings(:notification_emails).reblog
-    mail to: @me.user.email, subject: I18n.t('notification_mailer.reblog.subject', name: @account.acct)
+
+    I18n.with_locale(@me.user.locale || I18n.default_locale) do
+      mail to: @me.user.email, subject: I18n.t('notification_mailer.reblog.subject', name: @account.acct)
+    end
   end
 end