Fix subject of email subscription notification e-mail being difficult to localize (#38507)
This commit is contained in:
@@ -30,7 +30,7 @@ class EmailSubscriptionMailer < ApplicationMailer
|
||||
@statuses = statuses
|
||||
|
||||
I18n.with_locale(locale) do
|
||||
mail subject: default_i18n_subject(count: @statuses.size, name: @subscription.account.display_name, excerpt: @statuses.first.text.truncate(17))
|
||||
mail subject: I18n.t(@statuses.size == 1 ? 'singular' : 'plural', scope: 'email_subscription_mailer.notification.subject', name: @subscription.account.display_name, excerpt: @statuses.first.text.truncate(17))
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<%= t '.title', count: @statuses.size, name: display_name(@subscription.account), excerpt: truncate(@statuses.first.text, length: 17) %>
|
||||
<%= t @statuses.size == 1 ? 'singular' : 'plural', scope: 'email_subscription_mailer.notification.title', name: display_name(@subscription.account), excerpt: truncate(@statuses.first.text, length: 17) %>
|
||||
|
||||
===
|
||||
|
||||
|
||||
@@ -1440,11 +1440,11 @@ en:
|
||||
one: Interact with this post and discover more like it.
|
||||
other: Interact with these posts and discover more.
|
||||
subject:
|
||||
one: 'New post: "%{excerpt}"'
|
||||
other: New posts from %{name}
|
||||
plural: New posts from %{name}
|
||||
singular: 'New post: "%{excerpt}"'
|
||||
title:
|
||||
one: 'New post: "%{excerpt}"'
|
||||
other: New posts from %{name}
|
||||
plural: New posts from %{name}
|
||||
singular: 'New post: "%{excerpt}"'
|
||||
email_subscriptions:
|
||||
active: Active
|
||||
confirmations:
|
||||
|
||||
@@ -30,7 +30,7 @@ RSpec.describe EmailSubscriptionMailer do
|
||||
.to send_email(
|
||||
to: email_subscription.email,
|
||||
from: 'notifications@localhost',
|
||||
subject: I18n.t('email_subscription_mailer.notification.subject', count: statuses.size, name: email_subscription.account.display_name, excerpt: statuses.first.text.truncate(17))
|
||||
subject: I18n.t('email_subscription_mailer.notification.subject.singular', name: email_subscription.account.display_name, excerpt: statuses.first.text.truncate(17))
|
||||
)
|
||||
end
|
||||
end
|
||||
@@ -43,7 +43,7 @@ RSpec.describe EmailSubscriptionMailer do
|
||||
.to send_email(
|
||||
to: email_subscription.email,
|
||||
from: 'notifications@localhost',
|
||||
subject: I18n.t('email_subscription_mailer.notification.subject', count: statuses.size, name: email_subscription.account.display_name, excerpt: ActionController::Base.helpers.truncate(statuses.first.text, length: 17))
|
||||
subject: I18n.t('email_subscription_mailer.notification.subject.plural', name: email_subscription.account.display_name, excerpt: ActionController::Base.helpers.truncate(statuses.first.text, length: 17))
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user