Skip to content

Commit

Permalink
Translate strings individually
Browse files Browse the repository at this point in the history
  • Loading branch information
Jess Boctor committed Jan 22, 2025
1 parent fde886c commit d6e2040
Showing 1 changed file with 39 additions and 19 deletions.
58 changes: 39 additions & 19 deletions client/me/purchases/billing-history/receipt.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -138,32 +138,52 @@ export function ReceiptBody( {
const moment = useLocalizedMoment();
const title = translate( 'Visit %(url)s', { args: { url: transaction.url }, textOnly: true } );
const serviceLink = <a href={ transaction.url } title={ title } />;
const headerByLine = 'memberships' === transaction.service_slug ? 'Payment processed by' : 'by';

const membershipServiceHeader = translate(
'{{link}}%(service)s{{/link}} {{small}}Payment processed by %(organization)s{{/small}}',
{
components: {
link: serviceLink,
small: <small />,
},
args: {
service: transaction.service,
organization: transaction.org,
},
comment:
'This string is "Service Payment processed by Organization". ' +
'The {{link}} and {{small}} add html styling and attributes. ' +
'Screenshot: https://cloudup.com/isX-WEFYlOs',
}
);

const connectedServiceHeader = translate(
'{{link}}%(service)s{{/link}} {{small}}by %(organization)s{{/small}}',
{
components: {
link: serviceLink,
small: <small />,
},
args: {
service: transaction.service,
organization: transaction.org,
},
comment:
'This string is "Service by Organization". ' +
'The {{link}} and {{small}} add html styling and attributes. ' +
'Screenshot: https://cloudup.com/isX-WEFYlOs',
}
);

return (
<div>
<Card compact className="billing-history__receipt-card">
<div className="billing-history__app-overview">
<img src={ transaction.icon } title={ transaction.service } alt={ transaction.service } />
<h2>
{ translate(
'{{link}}%(service)s{{/link}} {{small}}%(headerByLine)s %(organization)s{{/small}}',
{
components: {
link: serviceLink,
small: <small />,
},
args: {
service: transaction.service,
headerByLine: headerByLine,
organization: transaction.org,
},
comment:
'This string is "Service by Organization". ' +
'The {{link}} and {{small}} add html styling and attributes. ' +
'Screenshot: https://cloudup.com/isX-WEFYlOs',
}
) }
{ 'memberships' === transaction.service_slug
? membershipServiceHeader
: connectedServiceHeader }
<small className="billing-history__organization-address">{ transaction.address }</small>
</h2>
<span className="billing-history__transaction-date">
Expand Down

0 comments on commit d6e2040

Please sign in to comment.