Skip to content

Commit

Permalink
rewrite strings for {{ vs {
Browse files Browse the repository at this point in the history
  • Loading branch information
cathysarisky committed Nov 4, 2024
1 parent 6e8e817 commit 4c8f4ee
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion apps/comments-ui/src/components/content/CTABox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const CTABox: React.FC<Props> = ({isFirst, isPaid}) => {
window.location.href = '#/portal/signin';
};

const text = reactStringReplace(isPaid ? t('Become a paid member of {{publication}} to start commenting.') : t('Become a member of {{publication}} to start commenting.'), '{{publication}}', () => (
const text = reactStringReplace(isPaid ? t('Become a paid member of {publication} to start commenting.') : t('Become a member of {publication} to start commenting.'), '{publication}', () => (
<span className="font-semibold">{publication}</span>
));

Expand Down
2 changes: 1 addition & 1 deletion apps/comments-ui/src/components/popups/AddDetailsPopup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ const AddDetailsPopup = (props: Props) => {
return returnable;
};

const charsText = reactStringReplace(t('{{amount}} characters left'), '{{amount}}', () => {
const charsText = reactStringReplace(t('{amount} characters left'), '{amount}', () => {
return <b>{expertiseCharsLeft}</b>;
});

Expand Down
2 changes: 1 addition & 1 deletion apps/portal/src/components/Notification.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const NotificationText = ({type, status, context}) => {
const firstname = context.member.firstname || '';
return (
<p>
{firstname ? t('Welcome back, {{name}}!', {name: firstname}) : t('Welcome back!')}<br />{t('You\'ve successfully signed in.')}
{firstname ? t('Welcome back, {name}!', {name: firstname}) : t('Welcome back!')}<br />{t('You\'ve successfully signed in.')}
</p>
);
} else if (type === 'signin' && status === 'error') {
Expand Down
2 changes: 1 addition & 1 deletion apps/portal/src/components/common/ProductsSection.js
Original file line number Diff line number Diff line change
Expand Up @@ -748,7 +748,7 @@ function ProductCardButton({selectedProduct, product, disabled, noOfProducts, tr
return (
<Interpolate
syntax={SYNTAX_I18NEXT}
string={t('Start {{amount}}-day free trial')}
string={t('Start {amount}-day free trial')}
mapping={{
amount: trialDays
}}
Expand Down
4 changes: 2 additions & 2 deletions apps/portal/src/components/pages/AccountEmailPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export default function AccountEmailPage() {
<p className={`gh-portal-text-center gh-portal-header-message ${hideClassName}`}>
<Interpolate
syntax={SYNTAX_I18NEXT}
string={t('{{memberEmail}} will no longer receive emails when someone replies to your comments.')}
string={t('{memberEmail} will no longer receive emails when someone replies to your comments.')}
mapping={{
memberEmail: <strong>{member?.email}</strong>
}}
Expand All @@ -68,7 +68,7 @@ export default function AccountEmailPage() {
<p className={`gh-portal-text-center gh-portal-header-message ${hideClassName}`}>
<Interpolate
syntax={SYNTAX_I18NEXT}
string={t('{{memberEmail}} will no longer receive {{newsletterName}} newsletter.')}
string={t('{memberEmail} will no longer receive {newsletterName} newsletter.')}
mapping={{
memberEmail: <strong>{member?.email}</strong>,
newsletterName: <strong>{unsubscribedNewsletter?.name}</strong>
Expand Down
2 changes: 1 addition & 1 deletion apps/portal/src/components/pages/RecommendationsPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ const RecommendationsPage = () => {
return <LoadingPage/>;
}

const heading = pageData && pageData.signup ? t('Welcome to {{siteTitle}}', {siteTitle: title, interpolation: {escapeValue: false}}) : t('Recommendations');
const heading = pageData && pageData.signup ? t('Welcome to {siteTitle}', {siteTitle: title, interpolation: {escapeValue: false}}) : t('Recommendations');

/* Possible cases:
- no recommendations found - subhead says no recommendations are available.
Expand Down
6 changes: 3 additions & 3 deletions apps/portal/src/components/pages/UnsubscribePage.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ export default function UnsubscribePage() {
<p className='gh-portal-text-center'>
<Interpolate
syntax={SYNTAX_I18NEXT}
string={t('{{memberEmail}} will no longer receive this newsletter.')}
string={t('{memberEmail} will no longer receive this newsletter.')}
mapping={{
memberEmail: <strong>{member?.email}</strong>
}}
Expand Down Expand Up @@ -212,7 +212,7 @@ export default function UnsubscribePage() {
<p className={`gh-portal-text-center gh-portal-header-message ${hideClassName}`}>
<Interpolate
syntax={SYNTAX_I18NEXT}
string={t('{{memberEmail}} will no longer receive emails when someone replies to your comments.')}
string={t('{memberEmail} will no longer receive emails when someone replies to your comments.')}
mapping={{
memberEmail: <strong>{member?.email}</strong>
}}
Expand All @@ -235,7 +235,7 @@ export default function UnsubscribePage() {
<p className={`gh-portal-text-center gh-portal-header-message ${hideClassName}`}>
<Interpolate
syntax={SYNTAX_I18NEXT}
string={t('{{memberEmail}} will no longer receive {{newsletterName}} newsletter.')}
string={t('{memberEmail} will no longer receive {newsletterName} newsletter.')}
mapping={{
memberEmail: <strong>{member?.email}</strong>,
newsletterName: <strong>{unsubscribedNewsletter?.name}</strong>
Expand Down
14 changes: 7 additions & 7 deletions apps/portal/src/utils/errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ export function chooseBestErrorMessage(error, alreadyTranslatedDefaultMessage, t
t('This site is invite-only, contact the owner for access.');
t('Unable to initiate checkout session');
t('This site is not accepting payments at the moment.');
t('Too many attempts try again in {{number}} minutes.');
t('Too many attempts try again in {{number}} hours.');
t('Too many attempts try again in {{number}} days.');
t('Too many different sign-in attempts, try again in {{number}} minutes');
t('Too many different sign-in attempts, try again in {{number}} hours');
t('Too many different sign-in attempts, try again in {{number}} days');
t('Too many attempts try again in {number} minutes.');
t('Too many attempts try again in {number} hours.');
t('Too many attempts try again in {number} days.');
t('Too many different sign-in attempts, try again in {number} minutes');
t('Too many different sign-in attempts, try again in {number} hours');
t('Too many different sign-in attempts, try again in {number} days');
t('Failed to send magic link email');
}
};
Expand All @@ -78,7 +78,7 @@ export function chooseBestErrorMessage(error, alreadyTranslatedDefaultMessage, t
}
const number = message.match(/\d+/);
if (number) {
message = message.replace(number[0], '{{number}}');
message = message.replace(number[0], '{number}');
}
return {preparedMessage: message, number: number ? number[0] : null};
};
Expand Down

0 comments on commit 4c8f4ee

Please sign in to comment.