Skip to content

Commit

Permalink
Make email subject and body translatable
Browse files Browse the repository at this point in the history
  • Loading branch information
Jinksi committed Sep 21, 2023
1 parent 3d35ecc commit 787b8d9
Showing 1 changed file with 22 additions and 9 deletions.
31 changes: 22 additions & 9 deletions client/payment-details/dispute-details/dispute-steps.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,29 @@ const DisputeSteps: React.FC< Props > = ( {
'Y-m-d',
moment( dispute.created * 1000 ).toISOString()
);
const emailSubject = `Problem with your purchase from ${ wcpaySettings.storeName } on ${ chargeDate }?`;
const emailSubject = sprintf(
// Translators: %1$s is the store name, %2$s is the charge date.
__(
`Problem with your purchase from %1$s on %2$s?`,
'woocommerce-payments'
),
wcpaySettings.storeName,
chargeDate
);
const customerName = customer?.name || '';
const emailBody =
`Hello ${ customerName }\n\n` +
`We noticed that on ${ disputeDate }, you disputed a ${ formatExplicitCurrency(
dispute.amount,
dispute.currency
) } from ${ chargeDate }. We wanted to contact you to make sure everything was all right with your purchase and see if there's anything else we can do to resolve any problems you might have had.\n\n` +
`Alternatively, if the dispute was a mistake, you could easily withdraw it by calling the number on the back of your card. Thank you so much - we appreciate your business and look forward to working with you.`;

const emailBody = sprintf(
// Translators: %1$s is the customer name, %2$s is the dispute date, %3$s is the dispute amount with currency-code e.g. $15 USD, %4$s is the charge date.
__(
`Hello %1$s\n\n` +
`We noticed that on %2$s, you disputed a %3$s charge on %4$s. We wanted to contact you to make sure everything was all right with your purchase and see if there's anything else we can do to resolve any problems you might have had.\n\n` +
`Alternatively, if the dispute was a mistake, you can easily withdraw it by calling the number on the back of your card. Thank you so much - we appreciate your business and look forward to working with you.`,
'woocommerce-payments'
),
customerName,
disputeDate,
formatExplicitCurrency( dispute.amount, dispute.currency ),
chargeDate
);
emailLink = `mailto:${ customer.email }?subject=${ encodeURIComponent(
emailSubject
) }&body=${ encodeURIComponent( emailBody ) }`;
Expand Down

0 comments on commit 787b8d9

Please sign in to comment.