feat(client): Translatable footer links

Modifies the translation schema to allow the
footer links (such as `about`) to be replaced
based on the client locale. Updates the snapshot
for the `Footer` component to reflect the changes.

Signed-off-by: nhcarrigan <nhcarrigan@gmail.com>
This commit is contained in:
nhcarrigan
2020-12-30 08:45:16 -08:00
committed by Mrugesh Mohapatra
parent 5950a397e6
commit 994b4c27df
6 changed files with 104 additions and 50 deletions

View File

@ -2,7 +2,27 @@
"meta": { "meta": {
"title": "免费学习编程 适合忙碌人士的编程课程", "title": "免费学习编程 适合忙碌人士的编程课程",
"description": "在家学习编程,构建项目,获得认证。自 2014 年以来,已有超过 40,000 名 freeCodeCamp 学员入职谷歌、苹果、亚马逊、微软等科技公司。", "description": "在家学习编程,构建项目,获得认证。自 2014 年以来,已有超过 40,000 名 freeCodeCamp 学员入职谷歌、苹果、亚马逊、微软等科技公司。",
"keywords": ["javascript", "js", "网站", "web", "开发", "free", "code", "camp", "课程", "html", "css", "react", "redux", "api", "前端", "后端", "学习", "教程", "编程"], "keywords": [
"javascript",
"js",
"网站",
"web",
"开发",
"free",
"code",
"camp",
"课程",
"html",
"css",
"react",
"redux",
"api",
"前端",
"后端",
"学习",
"教程",
"编程"
],
"youre-unsubscribed": "你已取消订阅" "youre-unsubscribed": "你已取消订阅"
}, },
"buttons": { "buttons": {
@ -220,16 +240,25 @@
"our-nonprofit": "关于我们", "our-nonprofit": "关于我们",
"links": { "links": {
"about": "简介", "about": "简介",
"about-url": "https://www.freecodecamp.org/news/about/",
"alumni": "校友网络", "alumni": "校友网络",
"open-source": "开源", "open-source": "开源",
"shop-url": "https://www.freecodecamp.org/shop/",
"shop": "商店", "shop": "商店",
"support": "支持", "support": "支持",
"support-url": "https://www.freecodecamp.org/news/support/",
"sponsors": "赞助商", "sponsors": "赞助商",
"sponsors-url": "https://www.freecodecamp.org/news/sponsors/",
"honesty": "学术诚信", "honesty": "学术诚信",
"honesty-url": "https://www.freecodecamp.org/news/academic-honesty-policy/",
"coc": "行为规范", "coc": "行为规范",
"coc-url": "https://www.freecodecamp.org/news/code-of-conduct/",
"privacy": "隐私条例", "privacy": "隐私条例",
"privacy-url": "https://www.freecodecamp.org/news/privacy-policy/",
"tos": "服务条款", "tos": "服务条款",
"copyright": "版权条例" "tos-url": "https://www.freecodecamp.org/news/terms-of-service/",
"copyright": "版权条例",
"copyright-url": "https://www.freecodecamp.org/news/copyright-policy/"
}, },
"language": "语言:" "language": "语言:"
}, },

View File

@ -242,16 +242,25 @@
"our-nonprofit": "Our Nonprofit", "our-nonprofit": "Our Nonprofit",
"links": { "links": {
"about": "About", "about": "About",
"about-url": "https://www.freecodecamp.org/news/about/",
"alumni": "Alumni Network", "alumni": "Alumni Network",
"open-source": "Open Source", "open-source": "Open Source",
"shop": "Shop", "shop": "Shop",
"shop-url": "https://www.freecodecamp.org/shop/",
"support": "Support", "support": "Support",
"support-url": "https://www.freecodecamp.org/news/support/",
"sponsors": "Sponsors", "sponsors": "Sponsors",
"sponsors-url": "https://www.freecodecamp.org/news/sponsors/",
"honesty": "Academic Honesty", "honesty": "Academic Honesty",
"honesty-url": "https://www.freecodecamp.org/news/academic-honesty-policy/",
"coc": "Code of Conduct", "coc": "Code of Conduct",
"coc-url": "https://www.freecodecamp.org/news/code-of-conduct/",
"privacy": "Privacy Policy", "privacy": "Privacy Policy",
"privacy-url": "https://www.freecodecamp.org/news/privacy-policy/",
"tos": "Terms of Service", "tos": "Terms of Service",
"copyright": "Copyright Policy" "tos-url": "https://www.freecodecamp.org/news/terms-of-service/",
"copyright": "Copyright Policy",
"copyright-url": "https://www.freecodecamp.org/news/copyright-policy/"
}, },
"language": "Language:" "language": "Language:"
}, },

View File

@ -2,7 +2,29 @@
"meta": { "meta": {
"title": "Learn to Code for Free Coding Courses for Busy People", "title": "Learn to Code for Free Coding Courses for Busy People",
"description": "Learn to code at home. Build projects. Earn certifications. Since 2014, more than 40,000 freeCodeCamp.org graduates have gotten jobs at tech companies including Google, Apple, Amazon, and Microsoft.", "description": "Learn to code at home. Build projects. Earn certifications. Since 2014, more than 40,000 freeCodeCamp.org graduates have gotten jobs at tech companies including Google, Apple, Amazon, and Microsoft.",
"keywords": ["javascript", "js", "website", "web", "development", "free", "code", "camp", "course", "courses", "html", "css", "react", "redux", "api", "front", "back", "end", "learn", "tutorial", "programming"], "keywords": [
"javascript",
"js",
"website",
"web",
"development",
"free",
"code",
"camp",
"course",
"courses",
"html",
"css",
"react",
"redux",
"api",
"front",
"back",
"end",
"learn",
"tutorial",
"programming"
],
"youre-unsubscribed": "You have been unsubscribed" "youre-unsubscribed": "You have been unsubscribed"
}, },
"buttons": { "buttons": {
@ -220,16 +242,25 @@
"our-nonprofit": "Our Nonprofit", "our-nonprofit": "Our Nonprofit",
"links": { "links": {
"about": "About", "about": "About",
"about-url": "https://www.freecodecamp.org/news/about/",
"alumni": "Alumni Network", "alumni": "Alumni Network",
"open-source": "Open Source", "open-source": "Open Source",
"shop": "Shop", "shop": "Shop",
"shop-url": "https://www.freecodecamp.org/shop/",
"support": "Support", "support": "Support",
"support-url": "https://www.freecodecamp.org/news/support/",
"sponsors": "Sponsors", "sponsors": "Sponsors",
"sponsors-url": "https://www.freecodecamp.org/news/sponsors/",
"honesty": "Academic Honesty", "honesty": "Academic Honesty",
"honesty-url": "https://www.freecodecamp.org/news/academic-honesty-policy/",
"coc": "Code of Conduct", "coc": "Code of Conduct",
"coc-url": "https://www.freecodecamp.org/news/code-of-conduct/",
"privacy": "Privacy Policy", "privacy": "Privacy Policy",
"privacy-url": "https://www.freecodecamp.org/news/privacy-policy/",
"tos": "Terms of Service", "tos": "Terms of Service",
"copyright": "Copyright Policy" "tos-url": "https://www.freecodecamp.org/news/terms-of-service/",
"copyright": "Copyright Policy",
"copyright-url": "https://www.freecodecamp.org/news/copyright-policy/"
}, },
"language": "Language:" "language": "Language:"
}, },

View File

@ -230,16 +230,25 @@ const translationsSchema = strictObject({
'our-nonprofit': stringType, 'our-nonprofit': stringType,
links: strictObject({ links: strictObject({
about: stringType, about: stringType,
'about-url': stringType,
alumni: stringType, alumni: stringType,
'open-source': stringType, 'open-source': stringType,
shop: stringType, shop: stringType,
'shop-url': stringType,
support: stringType, support: stringType,
'support-url': stringType,
sponsors: stringType, sponsors: stringType,
'sponsors-url': stringType,
honesty: stringType, honesty: stringType,
'honesty-url': stringType,
coc: stringType, coc: stringType,
'coc-url': stringType,
privacy: stringType, privacy: stringType,
'privacy-url': stringType,
tos: stringType, tos: stringType,
copyright: stringType 'tos-url': stringType,
copyright: stringType,
'copyright-url': stringType
}), }),
language: stringType language: stringType
}), }),

View File

@ -321,7 +321,7 @@ exports[`<Footer /> matches snapshot 1`] = `
className="our-nonprofit" className="our-nonprofit"
> >
<a <a
href="https://www.freecodecamp.org/news/about/" href="footer.links.about-url"
rel="noopener noreferrer" rel="noopener noreferrer"
target="_blank" target="_blank"
> >
@ -342,56 +342,56 @@ exports[`<Footer /> matches snapshot 1`] = `
footer.links.open-source footer.links.open-source
</a> </a>
<a <a
href="https://www.freecodecamp.org/shop/" href="footer.links.shop-url"
rel="noopener noreferrer" rel="noopener noreferrer"
target="_blank" target="_blank"
> >
footer.links.shop footer.links.shop
</a> </a>
<a <a
href="https://www.freecodecamp.org/news/support/" href="footer.links.support-url"
rel="noopener noreferrer" rel="noopener noreferrer"
target="_blank" target="_blank"
> >
footer.links.support footer.links.support
</a> </a>
<a <a
href="https://www.freecodecamp.org/news/sponsors/" href="footer.links.sponsors-url"
rel="noopener noreferrer" rel="noopener noreferrer"
target="_blank" target="_blank"
> >
footer.links.sponsors footer.links.sponsors
</a> </a>
<a <a
href="https://www.freecodecamp.org/news/academic-honesty-policy/" href="footer.links.honesty-url"
rel="noopener noreferrer" rel="noopener noreferrer"
target="_blank" target="_blank"
> >
footer.links.honesty footer.links.honesty
</a> </a>
<a <a
href="https://www.freecodecamp.org/news/code-of-conduct/" href="footer.links.coc-url"
rel="noopener noreferrer" rel="noopener noreferrer"
target="_blank" target="_blank"
> >
footer.links.coc footer.links.coc
</a> </a>
<a <a
href="https://www.freecodecamp.org/news/privacy-policy/" href="footer.links.privacy-url"
rel="noopener noreferrer" rel="noopener noreferrer"
target="_blank" target="_blank"
> >
footer.links.privacy footer.links.privacy
</a> </a>
<a <a
href="https://www.freecodecamp.org/news/terms-of-service/" href="footer.links.tos-url"
rel="noopener noreferrer" rel="noopener noreferrer"
target="_blank" target="_blank"
> >
footer.links.tos footer.links.tos
</a> </a>
<a <a
href="https://www.freecodecamp.org/news/copyright-policy/" href="footer.links.copyright-url"
rel="noopener noreferrer" rel="noopener noreferrer"
target="_blank" target="_blank"
> >

View File

@ -149,10 +149,7 @@ function Footer() {
<div className='col-header'>{t('footer.our-nonprofit')}</div> <div className='col-header'>{t('footer.our-nonprofit')}</div>
<div className='footer-divder' /> <div className='footer-divder' />
<div className='our-nonprofit'> <div className='our-nonprofit'>
<Link <Link external={false} to={t('footer.links.about-url')}>
external={false}
to={'https://www.freecodecamp.org/news/about/'}
>
{t('footer.links.about')} {t('footer.links.about')}
</Link> </Link>
<Link <Link
@ -168,50 +165,29 @@ function Footer() {
<Link <Link
external={false} external={false}
sameTab={false} sameTab={false}
to={'https://www.freecodecamp.org/shop/'} to={t('footer.links.shop-url')}
> >
{t('footer.links.shop')} {t('footer.links.shop')}
</Link> </Link>
<Link <Link external={false} to={t('footer.links.support-url')}>
external={false}
to={'https://www.freecodecamp.org/news/support/'}
>
{t('footer.links.support')} {t('footer.links.support')}
</Link> </Link>
<Link <Link external={false} to={t('footer.links.sponsors-url')}>
external={false}
to={'https://www.freecodecamp.org/news/sponsors/'}
>
{t('footer.links.sponsors')} {t('footer.links.sponsors')}
</Link> </Link>
<Link <Link external={false} to={t('footer.links.honesty-url')}>
external={false}
to={'https://www.freecodecamp.org/news/academic-honesty-policy/'}
>
{t('footer.links.honesty')} {t('footer.links.honesty')}
</Link> </Link>
<Link <Link external={false} to={t('footer.links.coc-url')}>
external={false}
to={'https://www.freecodecamp.org/news/code-of-conduct/'}
>
{t('footer.links.coc')} {t('footer.links.coc')}
</Link> </Link>
<Link <Link external={false} to={t('footer.links.privacy-url')}>
external={false}
to={'https://www.freecodecamp.org/news/privacy-policy/'}
>
{t('footer.links.privacy')} {t('footer.links.privacy')}
</Link> </Link>
<Link <Link external={false} to={t('footer.links.tos-url')}>
external={false}
to={'https://www.freecodecamp.org/news/terms-of-service/'}
>
{t('footer.links.tos')} {t('footer.links.tos')}
</Link> </Link>
<Link <Link external={false} to={t('footer.links.copyright-url')}>
external={false}
to={'https://www.freecodecamp.org/news/copyright-policy/'}
>
{t('footer.links.copyright')} {t('footer.links.copyright')}
</Link> </Link>
</div> </div>