From 994b4c27df1469269896ddc42bc01a4a5b05c21d Mon Sep 17 00:00:00 2001 From: nhcarrigan Date: Wed, 30 Dec 2020 08:45:16 -0800 Subject: [PATCH] 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 --- client/i18n/locales/chinese/translations.json | 35 ++++++++++++++-- client/i18n/locales/english/translations.json | 11 ++++- client/i18n/locales/espanol/translations.json | 37 ++++++++++++++-- client/i18n/translations-schema.js | 11 ++++- .../Footer/__snapshots__/Footer.test.js.snap | 18 ++++---- client/src/components/Footer/index.js | 42 ++++--------------- 6 files changed, 104 insertions(+), 50 deletions(-) diff --git a/client/i18n/locales/chinese/translations.json b/client/i18n/locales/chinese/translations.json index 2f01d3f628..4584264700 100644 --- a/client/i18n/locales/chinese/translations.json +++ b/client/i18n/locales/chinese/translations.json @@ -2,7 +2,27 @@ "meta": { "title": "免费学习编程 – 适合忙碌人士的编程课程", "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": "你已取消订阅" }, "buttons": { @@ -72,7 +92,7 @@ "big-heading-2": "构建项目", "big-heading-3": "获得认证", "h2-heading": "自 2014 年以来,已有超过 40,000 名 freeCodeCamp.org 学员入职科技公司,例如:", - "hero-img-description" : "韩国的 freeCodeCamp 学员在当地一个学习小组的交流活动上", + "hero-img-description": "韩国的 freeCodeCamp 学员在当地一个学习小组的交流活动上", "as-seen-in": "这些媒体曾对 freeCodeCamp 进行报道:", "testimonials": { "heading": "freeCodeCamp 校友感言:", @@ -220,16 +240,25 @@ "our-nonprofit": "关于我们", "links": { "about": "简介", + "about-url": "https://www.freecodecamp.org/news/about/", "alumni": "校友网络", "open-source": "开源", + "shop-url": "https://www.freecodecamp.org/shop/", "shop": "商店", "support": "支持", + "support-url": "https://www.freecodecamp.org/news/support/", "sponsors": "赞助商", + "sponsors-url": "https://www.freecodecamp.org/news/sponsors/", "honesty": "学术诚信", + "honesty-url": "https://www.freecodecamp.org/news/academic-honesty-policy/", "coc": "行为规范", + "coc-url": "https://www.freecodecamp.org/news/code-of-conduct/", "privacy": "隐私条例", + "privacy-url": "https://www.freecodecamp.org/news/privacy-policy/", "tos": "服务条款", - "copyright": "版权条例" + "tos-url": "https://www.freecodecamp.org/news/terms-of-service/", + "copyright": "版权条例", + "copyright-url": "https://www.freecodecamp.org/news/copyright-policy/" }, "language": "语言:" }, diff --git a/client/i18n/locales/english/translations.json b/client/i18n/locales/english/translations.json index d91eb50b6d..8f064dbd4c 100644 --- a/client/i18n/locales/english/translations.json +++ b/client/i18n/locales/english/translations.json @@ -242,16 +242,25 @@ "our-nonprofit": "Our Nonprofit", "links": { "about": "About", + "about-url": "https://www.freecodecamp.org/news/about/", "alumni": "Alumni Network", "open-source": "Open Source", "shop": "Shop", + "shop-url": "https://www.freecodecamp.org/shop/", "support": "Support", + "support-url": "https://www.freecodecamp.org/news/support/", "sponsors": "Sponsors", + "sponsors-url": "https://www.freecodecamp.org/news/sponsors/", "honesty": "Academic Honesty", + "honesty-url": "https://www.freecodecamp.org/news/academic-honesty-policy/", "coc": "Code of Conduct", + "coc-url": "https://www.freecodecamp.org/news/code-of-conduct/", "privacy": "Privacy Policy", + "privacy-url": "https://www.freecodecamp.org/news/privacy-policy/", "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:" }, diff --git a/client/i18n/locales/espanol/translations.json b/client/i18n/locales/espanol/translations.json index 55fb499bd2..c224925112 100644 --- a/client/i18n/locales/espanol/translations.json +++ b/client/i18n/locales/espanol/translations.json @@ -2,7 +2,29 @@ "meta": { "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.", - "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" }, "buttons": { @@ -72,7 +94,7 @@ "big-heading-2": "Build projects.", "big-heading-3": "Earn certifications.", "h2-heading": "Since 2014, more than 40,000 freeCodeCamp.org graduates have gotten jobs at tech companies including:", - "hero-img-description" : "freeCodeCamp students at a local study group in South Korea.", + "hero-img-description": "freeCodeCamp students at a local study group in South Korea.", "as-seen-in": "As seen in:", "testimonials": { "heading": "Here is what our alumni say about freeCodeCamp:", @@ -220,16 +242,25 @@ "our-nonprofit": "Our Nonprofit", "links": { "about": "About", + "about-url": "https://www.freecodecamp.org/news/about/", "alumni": "Alumni Network", "open-source": "Open Source", "shop": "Shop", + "shop-url": "https://www.freecodecamp.org/shop/", "support": "Support", + "support-url": "https://www.freecodecamp.org/news/support/", "sponsors": "Sponsors", + "sponsors-url": "https://www.freecodecamp.org/news/sponsors/", "honesty": "Academic Honesty", + "honesty-url": "https://www.freecodecamp.org/news/academic-honesty-policy/", "coc": "Code of Conduct", + "coc-url": "https://www.freecodecamp.org/news/code-of-conduct/", "privacy": "Privacy Policy", + "privacy-url": "https://www.freecodecamp.org/news/privacy-policy/", "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:" }, diff --git a/client/i18n/translations-schema.js b/client/i18n/translations-schema.js index 9928f23e78..6027924cce 100644 --- a/client/i18n/translations-schema.js +++ b/client/i18n/translations-schema.js @@ -230,16 +230,25 @@ const translationsSchema = strictObject({ 'our-nonprofit': stringType, links: strictObject({ about: stringType, + 'about-url': stringType, alumni: stringType, 'open-source': stringType, shop: stringType, + 'shop-url': stringType, support: stringType, + 'support-url': stringType, sponsors: stringType, + 'sponsors-url': stringType, honesty: stringType, + 'honesty-url': stringType, coc: stringType, + 'coc-url': stringType, privacy: stringType, + 'privacy-url': stringType, tos: stringType, - copyright: stringType + 'tos-url': stringType, + copyright: stringType, + 'copyright-url': stringType }), language: stringType }), diff --git a/client/src/components/Footer/__snapshots__/Footer.test.js.snap b/client/src/components/Footer/__snapshots__/Footer.test.js.snap index a89aec9589..fe62053524 100644 --- a/client/src/components/Footer/__snapshots__/Footer.test.js.snap +++ b/client/src/components/Footer/__snapshots__/Footer.test.js.snap @@ -321,7 +321,7 @@ exports[`