feat(client): Translatable donation link

Replaces the "other ways to donate" link with a
swappable translation token - allowing us to use
localised versions of the news article when
they are available.

Signed-off-by: nhcarrigan <nhcarrigan@gmail.com>
This commit is contained in:
nhcarrigan
2020-12-30 09:01:29 -08:00
committed by Mrugesh Mohapatra
parent 994b4c27df
commit 03fa21a565
5 changed files with 29 additions and 23 deletions

View File

@ -345,6 +345,7 @@
"why-donate-2": "你也帮助我们创建新的学习资源,你可以利用这些资源拓展自己的技术能力。", "why-donate-2": "你也帮助我们创建新的学习资源,你可以利用这些资源拓展自己的技术能力。",
"bigger-donation": "Want to make a bigger one-time donation, mail us a check, or give in other ways?", "bigger-donation": "Want to make a bigger one-time donation, mail us a check, or give in other ways?",
"other-ways": "Here are many <0>other ways we could support our non-profit's mission</0>.", "other-ways": "Here are many <0>other ways we could support our non-profit's mission</0>.",
"other-ways-url": "https://www.freecodecamp.org/news/how-to-donate-to-free-code-camp",
"failed-pay": "呃,你的转账似乎没有成功。可以再试一次吗?", "failed-pay": "呃,你的转账似乎没有成功。可以再试一次吗?",
"try-again": "请重试。", "try-again": "请重试。",
"card-number": "你的卡号:", "card-number": "你的卡号:",

View File

@ -347,6 +347,7 @@
"why-donate-2": "You also help us create new resources for you to use to expand your own technology skills.", "why-donate-2": "You also help us create new resources for you to use to expand your own technology skills.",
"bigger-donation": "Want to make a bigger one-time donation, mail us a check, or give in other ways?", "bigger-donation": "Want to make a bigger one-time donation, mail us a check, or give in other ways?",
"other-ways": "Here are many <0>other ways you can support our non-profit's mission</0>.", "other-ways": "Here are many <0>other ways you can support our non-profit's mission</0>.",
"other-ways-url": "https://www.freecodecamp.org/news/how-to-donate-to-free-code-camp",
"failed-pay": "Uh - oh. It looks like your transaction didn't go through. Could you please try again?", "failed-pay": "Uh - oh. It looks like your transaction didn't go through. Could you please try again?",
"try-again": "Please try again.", "try-again": "Please try again.",
"card-number": "Your Card Number:", "card-number": "Your Card Number:",

View File

@ -347,6 +347,7 @@
"why-donate-2": "You also help us create new resources for you to use to expand your own technology skills.", "why-donate-2": "You also help us create new resources for you to use to expand your own technology skills.",
"bigger-donation": "Want to make a bigger one-time donation, mail us a check, or give in other ways?", "bigger-donation": "Want to make a bigger one-time donation, mail us a check, or give in other ways?",
"other-ways": "Here are many <0>other ways we could support our non-profit's mission</0>.", "other-ways": "Here are many <0>other ways we could support our non-profit's mission</0>.",
"other-ways-url": "https://www.freecodecamp.org/news/how-to-donate-to-free-code-camp",
"failed-pay": "Uh - oh. It looks like your transaction didn't go through. Could you please try again?", "failed-pay": "Uh - oh. It looks like your transaction didn't go through. Could you please try again?",
"try-again": "Please try again.", "try-again": "Please try again.",
"card-number": "Your Card Number:", "card-number": "Your Card Number:",

View File

@ -335,6 +335,7 @@ const translationsSchema = strictObject({
'why-donate-2': stringType, 'why-donate-2': stringType,
'bigger-donation': stringType, 'bigger-donation': stringType,
'other-ways': stringType, 'other-ways': stringType,
'other-ways-url': stringType,
'failed-pay': stringType, 'failed-pay': stringType,
'try-again': stringType, 'try-again': stringType,
'card-number': stringType, 'card-number': stringType,

View File

@ -24,30 +24,32 @@ export const DonationText = () => {
); );
}; };
export const DonationOptionsText = () => ( export const DonationOptionsText = () => {
<> const { t } = useTranslation();
<h4> return (
<b> <>
<Trans>donate.bigger-donation</Trans> <h4>
</b> <b>
</h4> <Trans>donate.bigger-donation</Trans>
</b>
</h4>
<p>
<Trans i18nKey='donate.other-ways'>
<a href={t('donate.other-ways-url')}>placeholder</a>
</Trans>
</p>
</>
);
};
export const DonationOptionsAlertText = () => {
const { t } = useTranslation();
return (
<p> <p>
<Trans>donate.bigger-donation</Trans>{' '}
<Trans i18nKey='donate.other-ways'> <Trans i18nKey='donate.other-ways'>
<a href='https://www.freecodecamp.org/news/how-to-donate-to-free-code-camp'> <a href={t('donate.other-ways-url')}>placeholder</a>
placeholder
</a>
</Trans> </Trans>
</p> </p>
</> );
); };
export const DonationOptionsAlertText = () => (
<p>
<Trans>donate.bigger-donation</Trans>{' '}
<Trans i18nKey='donate.other-ways'>
<a href='https://www.freecodecamp.org/news/how-to-donate-to-free-code-camp'>
placeholder
</a>
</Trans>
</p>
);