From 64fed25d9d791a1053ab11b3e7edfdefd6c8bd2e Mon Sep 17 00:00:00 2001 From: drummer83 Date: Sun, 21 Jan 2024 21:01:00 +0100 Subject: [PATCH] Create, re-arrange and use some shared translation keys Shared keys are used for greetings, signoffs, order confirmation string (incl. order number), contact distributor note and order edit note Remaining translation keys for emails will be re-organized in a separate commit --- .../manager_invitation.html.haml | 2 +- app/views/enterprise_mailer/welcome.html.haml | 2 +- .../order_cycle_report.html.haml | 19 +--------- app/views/shared/mailers/_signoff.html.haml | 8 ---- .../mailers/_signoff_distributor.html.haml} | 2 +- .../mailers/_signoff_enterprise.html.haml | 16 ++++++++ .../mailers/_signoff_instance.html.haml | 8 ++++ .../mailers/_social_and_contact.html.haml | 4 +- .../admin/orders/_invoice/_payment.html.haml | 8 ++-- .../spree/order_mailer/cancel_email.html.haml | 2 +- .../confirm_email_for_customer.html.haml | 4 +- .../confirm_email_for_shop.html.haml | 4 +- .../order_mailer/invoice_email.html.haml | 2 +- .../spree/test_mailer/test_email.html.haml | 2 +- .../confirmation_instructions.html.haml | 2 +- .../user_mailer/signup_confirmation.html.haml | 2 +- .../confirmation_email.html.haml | 8 ++-- .../confirmation_summary_email.html.haml | 2 +- .../subscription_mailer/empty_email.html.haml | 6 +-- .../failed_payment_email.html.haml | 8 ++-- .../placement_email.html.haml | 8 ++-- .../placement_summary_email.html.haml | 2 +- config/locales/en.yml | 37 +++++++++++-------- 23 files changed, 83 insertions(+), 75 deletions(-) delete mode 100644 app/views/shared/mailers/_signoff.html.haml rename app/views/{spree/order_mailer/_signoff.html.haml => shared/mailers/_signoff_distributor.html.haml} (89%) create mode 100644 app/views/shared/mailers/_signoff_enterprise.html.haml create mode 100644 app/views/shared/mailers/_signoff_instance.html.haml diff --git a/app/views/enterprise_mailer/manager_invitation.html.haml b/app/views/enterprise_mailer/manager_invitation.html.haml index 6186bd2d93..0d3c8cd62b 100644 --- a/app/views/enterprise_mailer/manager_invitation.html.haml +++ b/app/views/enterprise_mailer/manager_invitation.html.haml @@ -14,6 +14,6 @@ %p = t('invite_email.mistakenly_sent', owner_email: @enterprise.owner.email) -= render 'shared/mailers/signoff' += render 'shared/mailers/signoff_instance' = render 'shared/mailers/social_and_contact' diff --git a/app/views/enterprise_mailer/welcome.html.haml b/app/views/enterprise_mailer/welcome.html.haml index c84428d0f3..12681f1294 100644 --- a/app/views/enterprise_mailer/welcome.html.haml +++ b/app/views/enterprise_mailer/welcome.html.haml @@ -13,6 +13,6 @@ %p = t(".email_community_html", link: link_to(t(".join_community"), ContentConfig.community_forum_url)) -= render 'shared/mailers/signoff' += render 'shared/mailers/signoff_instance' = render 'shared/mailers/social_and_contact' diff --git a/app/views/producer_mailer/order_cycle_report.html.haml b/app/views/producer_mailer/order_cycle_report.html.haml index e1abadf849..7b920d143d 100644 --- a/app/views/producer_mailer/order_cycle_report.html.haml +++ b/app/views/producer_mailer/order_cycle_report.html.haml @@ -107,20 +107,5 @@ = line_item[:last_name] %p = t :producer_mail_text_after -%p - = t(:producer_mail_signoff) - , - %em - %p - = @coordinator.name - %p - %br - = @coordinator.address.address1 - %br - = @coordinator.address.city - %br - = @coordinator.address.zipcode - %p - = @coordinator.phone - %p - = @coordinator.contact.email + += render 'shared/mailers/signoff_enterprise' diff --git a/app/views/shared/mailers/_signoff.html.haml b/app/views/shared/mailers/_signoff.html.haml deleted file mode 100644 index 7b10fffe97..0000000000 --- a/app/views/shared/mailers/_signoff.html.haml +++ /dev/null @@ -1,8 +0,0 @@ -%p   - -%p - = t :email_signoff - %br - = t :email_signature, sitename: Spree::Config[:site_name] - -%p   diff --git a/app/views/spree/order_mailer/_signoff.html.haml b/app/views/shared/mailers/_signoff_distributor.html.haml similarity index 89% rename from app/views/spree/order_mailer/_signoff.html.haml rename to app/views/shared/mailers/_signoff_distributor.html.haml index ef1e139ca9..2794b1518b 100644 --- a/app/views/spree/order_mailer/_signoff.html.haml +++ b/app/views/shared/mailers/_signoff_distributor.html.haml @@ -1,6 +1,6 @@ %br %p.callout - = t :email_confirm_customer_signoff + = t('.signoff') %br #{@order.distributor.contact_name} %br diff --git a/app/views/shared/mailers/_signoff_enterprise.html.haml b/app/views/shared/mailers/_signoff_enterprise.html.haml new file mode 100644 index 0000000000..97e2710199 --- /dev/null +++ b/app/views/shared/mailers/_signoff_enterprise.html.haml @@ -0,0 +1,16 @@ +%p + = t('.signoff') + %em + %p + = @coordinator.name + %p + %br + = @coordinator.address.address1 + %br + = @coordinator.address.city + %br + = @coordinator.address.zipcode + %p + = @coordinator.phone + %p + = @coordinator.contact.email diff --git a/app/views/shared/mailers/_signoff_instance.html.haml b/app/views/shared/mailers/_signoff_instance.html.haml new file mode 100644 index 0000000000..59cb106dc7 --- /dev/null +++ b/app/views/shared/mailers/_signoff_instance.html.haml @@ -0,0 +1,8 @@ +%p   + +%p + = t('.signoff') + %br + = t('.signature', sitename: Spree::Config[:site_name]) + +%p   diff --git a/app/views/shared/mailers/_social_and_contact.html.haml b/app/views/shared/mailers/_social_and_contact.html.haml index 7d8a74a457..c27bcc1504 100644 --- a/app/views/shared/mailers/_social_and_contact.html.haml +++ b/app/views/shared/mailers/_social_and_contact.html.haml @@ -6,7 +6,7 @@ %tr %td %h5 - = t :email_social + = t('.social') %p.social-icons - if ContentConfig.footer_facebook_url.present? %a.soc-btn.fb{href: ContentConfig.footer_facebook_url} @@ -25,7 +25,7 @@ %td - if ContentConfig.footer_email.present? %h5 - = t :email_contact + = t('.contact') %strong = mail_to ContentConfig.footer_email %span.clear diff --git a/app/views/spree/admin/orders/_invoice/_payment.html.haml b/app/views/spree/admin/orders/_invoice/_payment.html.haml index 81a974965a..d3e39b389f 100644 --- a/app/views/spree/admin/orders/_invoice/_payment.html.haml +++ b/app/views/spree/admin/orders/_invoice/_payment.html.haml @@ -6,15 +6,15 @@ %strong= @order.display_outstanding_balance - else - if @order.paid? - = t :email_payment_paid + = t 'spree.shared.payment.email_paid' - else - = t :email_payment_not_paid + = t 'spree.shared.payment.email_not_paid' %strong - = t :email_payment_summary + = t 'spree.shared.payment.email_summary' - if @order.payments.any? = render partial: 'spree/admin/orders/_invoice/payments_list', locals: { payments: @order.payments } - if @order.last_payment_method %p.callout{style: "margin-top: 40px"} %strong - = t :email_payment_description + = t 'spree.shared.payment.email_description' %p{style: "margin: 5px"}= @order.last_payment_method.description diff --git a/app/views/spree/order_mailer/cancel_email.html.haml b/app/views/spree/order_mailer/cancel_email.html.haml index dd6f5d5e5c..49f2d336e7 100755 --- a/app/views/spree/order_mailer/cancel_email.html.haml +++ b/app/views/spree/order_mailer/cancel_email.html.haml @@ -26,4 +26,4 @@ - else = t(".unpaid_order") -= render 'signoff' += render 'shared/mailers/signoff_distributor' diff --git a/app/views/spree/order_mailer/confirm_email_for_customer.html.haml b/app/views/spree/order_mailer/confirm_email_for_customer.html.haml index 37a5dac1c4..417ff23ad4 100644 --- a/app/views/spree/order_mailer/confirm_email_for_customer.html.haml +++ b/app/views/spree/order_mailer/confirm_email_for_customer.html.haml @@ -10,7 +10,7 @@ enterprise_for_logo: @enterprise_for_logo } %h4 - = t :email_confirm_customer_number_html, number: @order.number + = t('mailers_shared.order_confirmation_html', number: @order.number) %p = t :email_confirm_customer_details_html, distributor: @order.distributor.name @@ -18,4 +18,4 @@ = render 'spree/shared/payment' = render 'shipping' = render 'special_instructions' -= render 'signoff' += render 'shared/mailers/signoff_distributor' diff --git a/app/views/spree/order_mailer/confirm_email_for_shop.html.haml b/app/views/spree/order_mailer/confirm_email_for_shop.html.haml index fc831aff25..d3795f7792 100644 --- a/app/views/spree/order_mailer/confirm_email_for_shop.html.haml +++ b/app/views/spree/order_mailer/confirm_email_for_shop.html.haml @@ -10,7 +10,7 @@ enterprise_for_logo: @enterprise_for_logo } %h4 - = t :email_confirm_shop_number_html, number: @order.number + = t('mailers_shared.order_confirmation_html', number: @order.number) %h5 %strong= "#{@order.bill_address.firstname} #{@order.bill_address.lastname}" = " <#{@order.email}>" if @order.email @@ -22,5 +22,5 @@ = render 'special_instructions' %p   -= render 'shared/mailers/signoff' += render 'shared/mailers/signoff_instance' = render 'shared/mailers/social_and_contact' diff --git a/app/views/spree/order_mailer/invoice_email.html.haml b/app/views/spree/order_mailer/invoice_email.html.haml index 7b59d18fdd..161a7a1edc 100644 --- a/app/views/spree/order_mailer/invoice_email.html.haml +++ b/app/views/spree/order_mailer/invoice_email.html.haml @@ -9,4 +9,4 @@ intro: t(intro_key, distributor: @order.distributor.name), enterprise_for_logo: @enterprise_for_logo } -= render 'signoff' += render 'shared/mailers/signoff_distributor' diff --git a/app/views/spree/test_mailer/test_email.html.haml b/app/views/spree/test_mailer/test_email.html.haml index 3bc634ea2f..78036fd432 100644 --- a/app/views/spree/test_mailer/test_email.html.haml +++ b/app/views/spree/test_mailer/test_email.html.haml @@ -5,4 +5,4 @@ locals: { greeting: t(greeting_key), intro: t(intro_key) } -= render 'shared/mailers/signoff' += render 'shared/mailers/signoff_instance' diff --git a/app/views/spree/user_mailer/confirmation_instructions.html.haml b/app/views/spree/user_mailer/confirmation_instructions.html.haml index c2b3af71dc..6dcc1b60ad 100644 --- a/app/views/spree/user_mailer/confirmation_instructions.html.haml +++ b/app/views/spree/user_mailer/confirmation_instructions.html.haml @@ -13,7 +13,7 @@ %strong = link_to t(:email_confirmation_link_label), spree.spree_user_confirmation_url(:confirmation_token => @user.confirmation_token) -= render 'shared/mailers/signoff' += render 'shared/mailers/signoff_instance' %p.notice = t :email_confirmation_notice_unexpected, sitename: @instance, contact: @contact diff --git a/app/views/spree/user_mailer/signup_confirmation.html.haml b/app/views/spree/user_mailer/signup_confirmation.html.haml index 899c89d549..bc33209a42 100644 --- a/app/views/spree/user_mailer/signup_confirmation.html.haml +++ b/app/views/spree/user_mailer/signup_confirmation.html.haml @@ -18,6 +18,6 @@ %p = t :email_signup_help_html, email: mail_to(ContentConfig.footer_email) -= render 'shared/mailers/signoff' += render 'shared/mailers/signoff_instance' = render 'shared/mailers/social_and_contact' diff --git a/app/views/subscription_mailer/confirmation_email.html.haml b/app/views/subscription_mailer/confirmation_email.html.haml index 3aa9fdaa06..dcd8e1c18e 100644 --- a/app/views/subscription_mailer/confirmation_email.html.haml +++ b/app/views/subscription_mailer/confirmation_email.html.haml @@ -12,14 +12,14 @@ %p.callout = t("email_so_confirmation_explainer_html") - if @order.user.present? - = t("email_so_edit_false_html", + = t("subscription_mailer.shared.edit_false_html", orders_close_at: l(@order.order_cycle.orders_close_at, format: mail_long_datetime_format), order_url: order_url(@order)) - = t("email_so_contact_distributor_html", distributor: @order.distributor.name, email: @order.distributor.contact.email) + = t("subscription_mailer.shared.contact_distributor_html", distributor: @order.distributor.name, email: @order.distributor.contact.email) %p   %h4 - = t :email_confirm_customer_number_html, number: @order.number + = t("mailers_shared.order_confirmation_html", number: @order.number) %p = t("email_so_confirmation_details_html", distributor: @order.distributor.name) @@ -29,4 +29,4 @@ = render 'spree/order_mailer/shipping' = render 'spree/order_mailer/special_instructions' -= render 'spree/order_mailer/signoff' += render 'shared/mailers/signoff_distributor' diff --git a/app/views/subscription_mailer/confirmation_summary_email.html.haml b/app/views/subscription_mailer/confirmation_summary_email.html.haml index f27ce324af..4d3bbadc7d 100644 --- a/app/views/subscription_mailer/confirmation_summary_email.html.haml +++ b/app/views/subscription_mailer/confirmation_summary_email.html.haml @@ -13,4 +13,4 @@ = render 'summary_detail', summary: @summary %p   -= render 'shared/mailers/signoff' += render 'shared/mailers/signoff_instance' diff --git a/app/views/subscription_mailer/empty_email.html.haml b/app/views/subscription_mailer/empty_email.html.haml index 685978324a..a31a60359f 100644 --- a/app/views/subscription_mailer/empty_email.html.haml +++ b/app/views/subscription_mailer/empty_email.html.haml @@ -11,14 +11,14 @@ %p.callout = t("email_so_empty_explainer_html") - = t("email_so_contact_distributor_html", distributor: @order.distributor.name, email: @order.distributor.contact.email) + = t("subscription_mailer.shared.contact_distributor_html", distributor: @order.distributor.name, email: @order.distributor.contact.email) %p   %h4 - = t :email_confirm_customer_number_html, number: @order.number + = t("mailers_shared.order_confirmation_html", number: @order.number) %p = t("email_so_empty_details_html", distributor: @order.distributor.name) = render 'spree/order_mailer/order_summary' -= render 'spree/order_mailer/signoff' += render 'shared/mailers/signoff_distributor' diff --git a/app/views/subscription_mailer/failed_payment_email.html.haml b/app/views/subscription_mailer/failed_payment_email.html.haml index a0810dd564..42331d15fa 100644 --- a/app/views/subscription_mailer/failed_payment_email.html.haml +++ b/app/views/subscription_mailer/failed_payment_email.html.haml @@ -12,19 +12,19 @@ %p.callout = t("email_so_failed_payment_explainer_html", distributor: @order.distributor.name) - if @order.user.present? - = t("email_so_edit_false_html", + = t("subscription_mailer.shared.edit_false_html", orders_close_at: l(@order.order_cycle.orders_close_at, format: mail_long_datetime_format), order_url: order_url(@order)) - = t("email_so_contact_distributor_html", distributor: @order.distributor.name, email: @order.distributor.contact.email) + = t("subscription_mailer.shared.contact_distributor_html", distributor: @order.distributor.name, email: @order.distributor.contact.email) - if @order.errors.any? %p   %h4 - = t :email_confirm_customer_number_html, number: @order.number + = t("mailers_shared.order_confirmation_html", number: @order.number) %p = t("email_so_failed_payment_details_html", distributor: @order.distributor.name) - @order.errors.full_messages.each do |message| = message %br -= render 'spree/order_mailer/signoff' += render 'shared/mailers/signoff_distributor' diff --git a/app/views/subscription_mailer/placement_email.html.haml b/app/views/subscription_mailer/placement_email.html.haml index 96702a10ce..5eeb3bf51d 100644 --- a/app/views/subscription_mailer/placement_email.html.haml +++ b/app/views/subscription_mailer/placement_email.html.haml @@ -14,10 +14,10 @@ - if @order.user.present? - allow_changes = !!@order.distributor.allow_order_changes? - = t("email_so_edit_#{allow_changes}_html", + = t("subscription_mailer.shared.edit_#{allow_changes}_html", orders_close_at: l(@order.order_cycle.orders_close_at, format: mail_long_datetime_format), order_url: order_url(@order)) - = t("email_so_contact_distributor_html", distributor: @order.distributor.name, email: @order.distributor.contact.email) + = t("subscription_mailer.shared.contact_distributor_html", distributor: @order.distributor.name, email: @order.distributor.contact.email) - else = t("email_so_contact_distributor_to_change_order_html", orders_close_at: l(@order.order_cycle.orders_close_at, format: mail_long_datetime_format), @@ -26,7 +26,7 @@ %p   %h4 - = t :email_confirm_customer_number_html, number: @order.number + = t("mailers_shared.order_confirmation_html", number: @order.number) %p = t("email_so_placement_details_html", distributor: @order.distributor.name) @@ -40,4 +40,4 @@ = render 'spree/order_mailer/shipping' = render 'spree/order_mailer/special_instructions' -= render 'spree/order_mailer/signoff' += render 'shared/mailers/signoff_distributor' diff --git a/app/views/subscription_mailer/placement_summary_email.html.haml b/app/views/subscription_mailer/placement_summary_email.html.haml index f27ce324af..4d3bbadc7d 100644 --- a/app/views/subscription_mailer/placement_summary_email.html.haml +++ b/app/views/subscription_mailer/placement_summary_email.html.haml @@ -13,4 +13,4 @@ = render 'summary_detail', summary: @summary %p   -= render 'shared/mailers/signoff' += render 'shared/mailers/signoff_instance' diff --git a/config/locales/en.yml b/config/locales/en.yml index 7ea0e3eacb..1686c4d537 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -371,6 +371,7 @@ en: customer_greeting: "Dear %{name}," enterprise_greeting: "Dear %{name}," general_greeting: "Hello!" + order_confirmation_html: "Order confirmation #%{number}" enterprise_mailer: confirmation_instructions: subject: "Please confirm the email address for %{enterprise}" @@ -412,6 +413,10 @@ en: track_information: "Tracking Information: %{tracking}" track_link: "Tracking Link: %{url}" subscription_mailer: + shared: + edit_true_html: "You can make changes until orders close on %{orders_close_at}." + edit_false_html: "You can view details of this order at any time." + contact_distributor_html: "If you have any questions you can contact %{distributor} via %{email}." placement_email: intro_html: "You have a new order with %{distributor}." placement_summary_email: @@ -453,6 +458,18 @@ en: intro_html: "We tried to place a new order with %{distributor}, but had some problems..." failed_payment_email: intro_html: "We tried to process a payment for %{distributor}, but had some problems..." + shared: + mailers: + signoff_distributor: + signoff: "Kind regards," + signoff_enterprise: + signoff: "Thanks and best wishes," + signoff_instance: + signoff: "Cheers," + signature: "%{sitename} Team" + social_and_contact: + social: "Connect with Us:" + contact: "Email us:" provider_settings: "Provider settings" @@ -2427,15 +2444,8 @@ To activate your Profile we need to confirm this email address." email_confirmation_help_html: "After confirming your email you can access your administration account for this enterprise. See the %{link} to find out more about %{sitename}'s features and to start using your profile or online store." email_confirmation_notice_unexpected: "You received this message because you signed up on %{sitename}, or were invited to sign up by someone you probably know. If you don't understand why you are receiving this email, please write to %{contact}." - email_social: "Connect with Us:" - email_contact: "Email us:" - email_signoff: "Cheers," - email_signature: "%{sitename} Team" - email_confirm_customer_number_html: "Order confirmation #%{number}" email_confirm_customer_details_html: "Here are your order details from %{distributor}:" - email_confirm_customer_signoff: "Kind regards," - email_confirm_shop_number_html: "Order confirmation #%{number}" email_order_summary_item: "Item" email_order_summary_quantity: "Qty" email_order_summary_sku: "SKU" @@ -2443,17 +2453,10 @@ See the %{link} to find out more about %{sitename}'s features and to start using email_order_summary_subtotal: "Subtotal:" email_order_summary_total: "Total:" email_order_summary_includes_tax: "(includes tax):" - email_payment_paid: PAID - email_payment_not_paid: NOT PAID - email_payment_description: Payment Description at Checkout - email_payment_summary: Payment summary email_payment_method: "Paying via:" email_so_placement_details_html: "Here are the details of your order for %{distributor}:" email_so_placement_changes: "Unfortunately, not all products that you requested were available. The original quantities that you requested appear crossed-out below." email_so_placement_explainer_html: "This order was automatically created for you." - email_so_edit_true_html: "You can make changes until orders close on %{orders_close_at}." - email_so_edit_false_html: "You can view details of this order at any time." - email_so_contact_distributor_html: "If you have any questions you can contact %{distributor} via %{email}." email_so_contact_distributor_to_change_order_html: "This order was automatically created for you. You can make changes until orders close on %{orders_close_at} by contacting %{distributor} via %{email}." email_so_confirmation_explainer_html: "This order was automatically placed for you, and it has now been finalised." email_so_confirmation_details_html: "Here's everything you need to know about your order from %{distributor}:" @@ -2485,7 +2488,6 @@ See the %{link} to find out more about %{sitename}'s features and to start using producer_mail_order_text: "Here is a summary of the orders for your products:" producer_mail_delivery_instructions: "Stock pickup/delivery instructions:" producer_mail_text_after: "" - producer_mail_signoff: "Thanks and best wishes" producer_mail_order_customer_text: "Here is a summary of the orders grouped by customers" shopping_oc_closed: Orders are closed @@ -4201,6 +4203,11 @@ See the %{link} to find out more about %{sitename}'s features and to start using update: "Update" cancel: "Cancel" shared: + payment: + email_paid: "PAID" + email_not_paid: "NOT PAID" + email_summary: "Payment summary" + email_description: "Payment Description at Checkout" error_messages: errors_prohibited_this_record_from_being_saved: one: "1 error prohibited this record from being saved:"