Add translation keys for test and shipment emails and make them lazy lookups

This commit is contained in:
Luis Ramos
2020-07-14 14:32:47 +01:00
parent f66538d2cb
commit 646f48f0af
6 changed files with 36 additions and 23 deletions

View File

@@ -5,7 +5,6 @@ module Spree
# Inline stylesheets
include Roadie::Rails::Automatic
# Define layout
layout 'mailer'
def from_address

View File

@@ -5,7 +5,7 @@ module Spree
def shipped_email(shipment, resend = false)
@shipment = shipment.respond_to?(:id) ? shipment : Spree::Shipment.find(shipment)
subject = (resend ? "[#{Spree.t(:resend).upcase}] " : '')
base_subject = Spree.t('shipment_mailer.shipped_email.subject')
base_subject = t('spree.shipment_mailer.shipped_email.subject')
subject += "#{Spree::Config[:site_name]} #{base_subject} ##{@shipment.order.number}"
mail(to: @shipment.order.email, from: from_address, subject: subject)
end

View File

@@ -4,7 +4,7 @@ module Spree
class TestMailer < BaseMailer
def test_email(user)
recipient = user.respond_to?(:id) ? user : Spree.user_class.find(user)
subject = "#{Spree::Config[:site_name]} #{Spree.t('test_mailer.test_email.subject')}"
subject = "#{Spree::Config[:site_name]} #{t('spree.test_mailer.test_email.subject')}"
mail(to: recipient.email, from: from_address, subject: subject)
end
end

View File

@@ -1,9 +1,9 @@
= Spree.t('shipment_mailer.shipped_email.dear_customer')
= t('.dear_customer')
= Spree.t('shipment_mailer.shipped_email.instructions')
= t('.instructions')
= "============================================================"
= Spree.t('shipment_mailer.shipped_email.shipment_summary')
= t('.shipment_summary')
= "============================================================"
- @shipment.manifest.each do |item|
= item.variant.sku
@@ -12,8 +12,8 @@
= "============================================================"
- if @shipment.tracking
= Spree.t('shipment_mailer.shipped_email.track_information', tracking: @shipment.tracking)
= t('.track_information', tracking: @shipment.tracking)
- if @shipment.tracking_url
= Spree.t('shipment_mailer.shipped_email.track_link', url: @shipment.tracking_url)
= t('.track_link', url: @shipment.tracking_url)
= Spree.t('shipment_mailer.shipped_email.thanks')
= t('.thanks')

View File

@@ -1,4 +1,4 @@
= t('test_mailer.test_email.greeting')
= t('.greeting')
= "================"
= t('test_mailer.test_email.message')
= t('.message')

View File

@@ -3508,6 +3508,32 @@ See the %{link} to find out more about %{sitename}'s features and to start using
invoice_email:
hi: "Hi %{name}"
invoice_attached_text: Please find attached an invoice for your recent order from
user_mailer:
reset_password_instructions:
request_sent_text: |
A request to reset your password has been made.
If you did not make this request, simply ignore this email.
link_text: >
If you did make this request just click the link below:
issue_text: |
If the above URL does not work try copying and pasting it into your browser.
If you continue to have problems please feel free to contact us.
confirmation_instructions:
subject: "Please confirm your OFN account"
shipment_mailer:
shipped_email:
dear_customer: "Dear Customer,"
instructions: "Your order has been shipped"
shipment_summary: "Shipment Summary"
subject: "Shipment Notification"
thanks: "Thank you for your business."
track_information: ! "Tracking Information: %{tracking}"
track_link: ! "Tracking Link: %{url}"
test_mailer:
test_email:
greeting: "Congratulations!"
message: "If you have received this email, then your email settings are correct."
subject: "Test Mail"
order_state:
address: address
adjustments: adjustments
@@ -3529,18 +3555,6 @@ See the %{link} to find out more about %{sitename}'s features and to start using
ended: ended
paused: paused
canceled: cancelled
user_mailer:
reset_password_instructions:
request_sent_text: |
A request to reset your password has been made.
If you did not make this request, simply ignore this email.
link_text: >
If you did make this request just click the link below:
issue_text: |
If the above URL does not work try copying and pasting it into your browser.
If you continue to have problems please feel free to contact us.
confirmation_instructions:
subject: Please confirm your OFN account
users:
form:
account_settings: Account Settings