diff --git a/client/i18n/allLangs.js b/client/i18n/allLangs.js index 59bbc95864..3dc937fffd 100644 --- a/client/i18n/allLangs.js +++ b/client/i18n/allLangs.js @@ -8,7 +8,7 @@ const availableLangs = { // Each client language needs an entry in the rest of the variables below -/* These strings set the i18next langauge. It needs to be the two character +/* These strings set the i18next language. It needs to be the two character * string for the language to take advantage of available functionality. * Use a 639-1 code here https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes */ diff --git a/client/i18n/config.js b/client/i18n/config.js index e2b38a2120..d80027720c 100644 --- a/client/i18n/config.js +++ b/client/i18n/config.js @@ -12,10 +12,11 @@ i18n.use(initReactI18next).init({ // we only load one language since each language will have it's own server resources: { [i18nextCode]: { - translations: require(`./locales/${clientLocale}/translations.json`) + translations: require(`./locales/${clientLocale}/translations.json`), + trending: require(`./locales/${clientLocale}/trending.json`) } }, - ns: ['translations'], + ns: ['translations', 'trending'], defaultNS: 'translations', returnObjects: true, debug: environment === 'development', diff --git a/client/i18n/locales.test.js b/client/i18n/locales.test.js index 20d697fb0d..9c127809e6 100644 --- a/client/i18n/locales.test.js +++ b/client/i18n/locales.test.js @@ -7,6 +7,7 @@ import { langDisplayNames, langCodes } from './allLangs'; +import { trendingSchema } from './trending-schema'; const fs = require('fs'); const { expectToMatchSchema, setup } = require('jest-json-schema-extended'); @@ -21,6 +22,10 @@ const filesThatShouldExist = [ { name: 'motivation.json', schema: motivationSchema + }, + { + name: 'trending.json', + schema: trendingSchema } ]; diff --git a/client/i18n/locales/chinese/trending.json b/client/i18n/locales/chinese/trending.json new file mode 100644 index 0000000000..e0a12d9d2e --- /dev/null +++ b/client/i18n/locales/chinese/trending.json @@ -0,0 +1,62 @@ +{ + "article1title": "Chinese: Git Clone", + "article1link": "https://www.freecodecamp.org/news/git-clone-branch-how-to-clone-a-specific-branch/", + "article2title": "Chinese: Agile Methods", + "article2link": "https://www.freecodecamp.org/news/agile-methods-and-methodology-for-beginners/", + "article3title": "Chinese: Python Main", + "article3link": "https://www.freecodecamp.org/news/if-name-main-python-example/", + "article4title": "Chinese: Callback", + "article4link": "https://www.freecodecamp.org/news/javascript-callback-functions-what-are-callbacks-in-js-and-how-to-use-them/", + "article5title": "Chinese: Debounce", + "article5link": "https://www.freecodecamp.org/news/debounce-javascript-tutorial-how-to-make-your-js-wait-up/", + "article6title": "Chinese: URL Encode", + "article6link": "https://www.freecodecamp.org/news/javascript-url-encode-example-how-to-use-encodeuricomponent-and-encodeuri/", + "article7title": "Chinese: Blink HTML", + "article7link": "https://www.freecodecamp.org/news/make-it-blink-html-tutorial-how-to-use-the-blink-tag-with-code-examples/", + "article8title": "Chinese: Python Tuple", + "article8link": "https://www.freecodecamp.org/news/python-returns-multiple-values-how-to-return-a-tuple-list-dictionary/", + "article9title": "Chinese: JavaScript Push", + "article9link": "https://www.freecodecamp.org/news/javascript-array-insert-how-to-add-to-an-array-with-the-push-unshift-and-concat-functions/", + "article10title": "Chinese: Java List", + "article10link": "https://www.freecodecamp.org/news/java-list-tutorial-util-list-api-example/", + "article11title": "Chinese: UX", + "article11link": "https://www.freecodecamp.org/news/learn-ux-design-self-taught-user-experience-designer/", + "article12title": "Chinese: Design Thinking", + "article12link": "https://www.freecodecamp.org/news/what-is-design-thinking-an-introduction-to-the-design-process-for-entrepreneurs-and-developers/", + "article13title": "Chinese: Prime Number List", + "article13link": "https://www.freecodecamp.org/news/prime-numbers-list-chart-of-primes/", + "article14title": "Chinese: Product Design", + "article14link": "https://www.freecodecamp.org/news/product-design-explained-in-plain-english/", + "article15title": "Chinese: Digital Design", + "article15link": "https://www.freecodecamp.org/news/what-is-digital-design-and-why-does-it-matter/", + "article16title": "Chinese: Coding Games", + "article16link": "https://www.freecodecamp.org/news/best-coding-games-online-adults-learn-to-code/", + "article17title": "Chinese: SVM", + "article17link": "https://www.freecodecamp.org/news/svm-machine-learning-tutorial-what-is-the-support-vector-machine-algorithm-explained-with-code-examples/", + "article18title": "Chinese: JavaScript forEach", + "article18link": "https://www.freecodecamp.org/news/javascript-foreach-how-to-loop-through-an-array-in-js/", + "article19title": "Chinese: Google BERT", + "article19link": "https://www.freecodecamp.org/news/google-bert-nlp-machine-learning-tutorial/", + "article20title": "Chinese: Create Table SQL", + "article20link": "https://www.freecodecamp.org/news/sql-create-table-statement-with-example-syntax/", + "article21title": "Chinese: Responsive Web Design", + "article21link": "https://www.freecodecamp.org/news/responsive-web-design-how-to-make-a-website-look-good-on-phones-and-tablets/", + "article22title": "Chinese: What Is an SVG File?", + "article22link": "https://www.freecodecamp.org/news/svg-basics-what-are-scalable-vector-graphics-and-how-do-you-use-them/", + "article23title": "Chinese: PDF Password Remover", + "article23link": "https://www.freecodecamp.org/news/pdf-password-remover-guide-how-to-remove-password-protection-from-a-pdf/", + "article24title": "Chinese: What Is a PDF?", + "article24link": "https://www.freecodecamp.org/news/what-is-a-pdf-file-and-how-do-you-open-it-solved/", + "article25title": "Chinese: What Is Python?", + "article25link": "https://www.freecodecamp.org/news/what-is-python-used-for-10-coding-uses-for-the-python-programming-language/", + "article26title": "Chinese: What Is TLS?", + "article26link": "https://www.freecodecamp.org/news/what-is-tls-transport-layer-security-encryption-explained-in-plain-english/", + "article27title": "Chinese: What Is a LAN?", + "article27link": "https://www.freecodecamp.org/news/what-is-a-lan-local-area-network-explained-in-plain-english/", + "article28title": "Chinese: What Is npm?", + "article28link": "https://www.freecodecamp.org/news/what-is-npm-a-node-package-manager-tutorial-for-beginners/", + "article29title": "Chinese: RSync Examples", + "article29link": "https://www.freecodecamp.org/news/rsync-examples-rsync-options-and-how-to-copy-files-over-ssh/", + "article30title": "Chinese: Random Forest", + "article30link": "https://www.freecodecamp.org/news/how-to-use-the-tree-based-algorithm-for-machine-learning/" +} diff --git a/client/i18n/locales/english/trending.json b/client/i18n/locales/english/trending.json new file mode 100644 index 0000000000..65c39fab6f --- /dev/null +++ b/client/i18n/locales/english/trending.json @@ -0,0 +1,62 @@ +{ + "article1title": "Git Clone", + "article1link": "https://www.freecodecamp.org/news/git-clone-branch-how-to-clone-a-specific-branch/", + "article2title": "Agile Methods", + "article2link": "https://www.freecodecamp.org/news/agile-methods-and-methodology-for-beginners/", + "article3title": "Python Main", + "article3link": "https://www.freecodecamp.org/news/if-name-main-python-example/", + "article4title": "Callback", + "article4link": "https://www.freecodecamp.org/news/javascript-callback-functions-what-are-callbacks-in-js-and-how-to-use-them/", + "article5title": "Debounce", + "article5link": "https://www.freecodecamp.org/news/debounce-javascript-tutorial-how-to-make-your-js-wait-up/", + "article6title": "URL Encode", + "article6link": "https://www.freecodecamp.org/news/javascript-url-encode-example-how-to-use-encodeuricomponent-and-encodeuri/", + "article7title": "Blink HTML", + "article7link": "https://www.freecodecamp.org/news/make-it-blink-html-tutorial-how-to-use-the-blink-tag-with-code-examples/", + "article8title": "Python Tuple", + "article8link": "https://www.freecodecamp.org/news/python-returns-multiple-values-how-to-return-a-tuple-list-dictionary/", + "article9title": "JavaScript Push", + "article9link": "https://www.freecodecamp.org/news/javascript-array-insert-how-to-add-to-an-array-with-the-push-unshift-and-concat-functions/", + "article10title": "Java List", + "article10link": "https://www.freecodecamp.org/news/java-list-tutorial-util-list-api-example/", + "article11title": "UX", + "article11link": "https://www.freecodecamp.org/news/learn-ux-design-self-taught-user-experience-designer/", + "article12title": "Design Thinking", + "article12link": "https://www.freecodecamp.org/news/what-is-design-thinking-an-introduction-to-the-design-process-for-entrepreneurs-and-developers/", + "article13title": "Prime Number List", + "article13link": "https://www.freecodecamp.org/news/prime-numbers-list-chart-of-primes/", + "article14title": "Product Design", + "article14link": "https://www.freecodecamp.org/news/product-design-explained-in-plain-english/", + "article15title": "Digital Design", + "article15link": "https://www.freecodecamp.org/news/what-is-digital-design-and-why-does-it-matter/", + "article16title": "Coding Games", + "article16link": "https://www.freecodecamp.org/news/best-coding-games-online-adults-learn-to-code/", + "article17title": "SVM", + "article17link": "https://www.freecodecamp.org/news/svm-machine-learning-tutorial-what-is-the-support-vector-machine-algorithm-explained-with-code-examples/", + "article18title": "JavaScript forEach", + "article18link": "https://www.freecodecamp.org/news/javascript-foreach-how-to-loop-through-an-array-in-js/", + "article19title": "Google BERT", + "article19link": "https://www.freecodecamp.org/news/google-bert-nlp-machine-learning-tutorial/", + "article20title": "Create Table SQL", + "article20link": "https://www.freecodecamp.org/news/sql-create-table-statement-with-example-syntax/", + "article21title": "Responsive Web Design", + "article21link": "https://www.freecodecamp.org/news/responsive-web-design-how-to-make-a-website-look-good-on-phones-and-tablets/", + "article22title": "What Is an SVG File?", + "article22link": "https://www.freecodecamp.org/news/svg-basics-what-are-scalable-vector-graphics-and-how-do-you-use-them/", + "article23title": "PDF Password Remover", + "article23link": "https://www.freecodecamp.org/news/pdf-password-remover-guide-how-to-remove-password-protection-from-a-pdf/", + "article24title": "What Is a PDF?", + "article24link": "https://www.freecodecamp.org/news/what-is-a-pdf-file-and-how-do-you-open-it-solved/", + "article25title": "What Is Python?", + "article25link": "https://www.freecodecamp.org/news/what-is-python-used-for-10-coding-uses-for-the-python-programming-language/", + "article26title": "What Is TLS?", + "article26link": "https://www.freecodecamp.org/news/what-is-tls-transport-layer-security-encryption-explained-in-plain-english/", + "article27title": "What Is a LAN?", + "article27link": "https://www.freecodecamp.org/news/what-is-a-lan-local-area-network-explained-in-plain-english/", + "article28title": "What Is npm?", + "article28link": "https://www.freecodecamp.org/news/what-is-npm-a-node-package-manager-tutorial-for-beginners/", + "article29title": "RSync Examples", + "article29link": "https://www.freecodecamp.org/news/rsync-examples-rsync-options-and-how-to-copy-files-over-ssh/", + "article30title": "Random Forest", + "article30link": "https://www.freecodecamp.org/news/how-to-use-the-tree-based-algorithm-for-machine-learning/" +} diff --git a/client/i18n/locales/espanol/trending.json b/client/i18n/locales/espanol/trending.json new file mode 100644 index 0000000000..30a5adfdcb --- /dev/null +++ b/client/i18n/locales/espanol/trending.json @@ -0,0 +1,62 @@ +{ + "article1title": "Spanish: Git Clone", + "article1link": "https://www.freecodecamp.org/news/git-clone-branch-how-to-clone-a-specific-branch/", + "article2title": "Spanish: Agile Methods", + "article2link": "https://www.freecodecamp.org/news/agile-methods-and-methodology-for-beginners/", + "article3title": "Spanish: Python Main", + "article3link": "https://www.freecodecamp.org/news/if-name-main-python-example/", + "article4title": "Spanish: Callback", + "article4link": "https://www.freecodecamp.org/news/javascript-callback-functions-what-are-callbacks-in-js-and-how-to-use-them/", + "article5title": "Spanish: Debounce", + "article5link": "https://www.freecodecamp.org/news/debounce-javascript-tutorial-how-to-make-your-js-wait-up/", + "article6title": "Spanish: URL Encode", + "article6link": "https://www.freecodecamp.org/news/javascript-url-encode-example-how-to-use-encodeuricomponent-and-encodeuri/", + "article7title": "Spanish: Blink HTML", + "article7link": "https://www.freecodecamp.org/news/make-it-blink-html-tutorial-how-to-use-the-blink-tag-with-code-examples/", + "article8title": "Spanish: Python Tuple", + "article8link": "https://www.freecodecamp.org/news/python-returns-multiple-values-how-to-return-a-tuple-list-dictionary/", + "article9title": "Spanish: JavaScript Push", + "article9link": "https://www.freecodecamp.org/news/javascript-array-insert-how-to-add-to-an-array-with-the-push-unshift-and-concat-functions/", + "article10title": "Spanish: Java List", + "article10link": "https://www.freecodecamp.org/news/java-list-tutorial-util-list-api-example/", + "article11title": "Spanish: UX", + "article11link": "https://www.freecodecamp.org/news/learn-ux-design-self-taught-user-experience-designer/", + "article12title": "Spanish: Design Thinking", + "article12link": "https://www.freecodecamp.org/news/what-is-design-thinking-an-introduction-to-the-design-process-for-entrepreneurs-and-developers/", + "article13title": "Spanish: Prime Number List", + "article13link": "https://www.freecodecamp.org/news/prime-numbers-list-chart-of-primes/", + "article14title": "Spanish: Product Design", + "article14link": "https://www.freecodecamp.org/news/product-design-explained-in-plain-english/", + "article15title": "Spanish: Digital Design", + "article15link": "https://www.freecodecamp.org/news/what-is-digital-design-and-why-does-it-matter/", + "article16title": "Spanish: Coding Games", + "article16link": "https://www.freecodecamp.org/news/best-coding-games-online-adults-learn-to-code/", + "article17title": "Spanish: SVM", + "article17link": "https://www.freecodecamp.org/news/svm-machine-learning-tutorial-what-is-the-support-vector-machine-algorithm-explained-with-code-examples/", + "article18title": "Spanish: JavaScript forEach", + "article18link": "https://www.freecodecamp.org/news/javascript-foreach-how-to-loop-through-an-array-in-js/", + "article19title": "Spanish: Google BERT", + "article19link": "https://www.freecodecamp.org/news/google-bert-nlp-machine-learning-tutorial/", + "article20title": "Spanish: Create Table SQL", + "article20link": "https://www.freecodecamp.org/news/sql-create-table-statement-with-example-syntax/", + "article21title": "Spanish: Responsive Web Design", + "article21link": "https://www.freecodecamp.org/news/responsive-web-design-how-to-make-a-website-look-good-on-phones-and-tablets/", + "article22title": "Spanish: What Is an SVG File?", + "article22link": "https://www.freecodecamp.org/news/svg-basics-what-are-scalable-vector-graphics-and-how-do-you-use-them/", + "article23title": "Spanish: PDF Password Remover", + "article23link": "https://www.freecodecamp.org/news/pdf-password-remover-guide-how-to-remove-password-protection-from-a-pdf/", + "article24title": "Spanish: What Is a PDF?", + "article24link": "https://www.freecodecamp.org/news/what-is-a-pdf-file-and-how-do-you-open-it-solved/", + "article25title": "Spanish: What Is Python?", + "article25link": "https://www.freecodecamp.org/news/what-is-python-used-for-10-coding-uses-for-the-python-programming-language/", + "article26title": "Spanish: What Is TLS?", + "article26link": "https://www.freecodecamp.org/news/what-is-tls-transport-layer-security-encryption-explained-in-plain-english/", + "article27title": "Spanish: What Is a LAN?", + "article27link": "https://www.freecodecamp.org/news/what-is-a-lan-local-area-network-explained-in-plain-english/", + "article28title": "Spanish: What Is npm?", + "article28link": "https://www.freecodecamp.org/news/what-is-npm-a-node-package-manager-tutorial-for-beginners/", + "article29title": "Spanish: RSync Examples", + "article29link": "https://www.freecodecamp.org/news/rsync-examples-rsync-options-and-how-to-copy-files-over-ssh/", + "article30title": "Spanish: Random Forest", + "article30link": "https://www.freecodecamp.org/news/how-to-use-the-tree-based-algorithm-for-machine-learning/" +} diff --git a/client/i18n/trending-schema.js b/client/i18n/trending-schema.js new file mode 100644 index 0000000000..bf7d90fd84 --- /dev/null +++ b/client/i18n/trending-schema.js @@ -0,0 +1,70 @@ +/* eslint-disable camelcase */ +/* This is used for testing. If a trending.json file doesn't match the + * structure here exactly, the tests will fail. + */ +const { strictObject, stringType } = require('jest-json-schema-extended'); + +const trendingSchema = strictObject({ + article1title: stringType, + article1link: stringType, + article2title: stringType, + article2link: stringType, + article3title: stringType, + article3link: stringType, + article4title: stringType, + article4link: stringType, + article5title: stringType, + article5link: stringType, + article6title: stringType, + article6link: stringType, + article7title: stringType, + article7link: stringType, + article8title: stringType, + article8link: stringType, + article9title: stringType, + article9link: stringType, + article10title: stringType, + article10link: stringType, + article11title: stringType, + article11link: stringType, + article12title: stringType, + article12link: stringType, + article13title: stringType, + article13link: stringType, + article14title: stringType, + article14link: stringType, + article15title: stringType, + article15link: stringType, + article16title: stringType, + article16link: stringType, + article17title: stringType, + article17link: stringType, + article18title: stringType, + article18link: stringType, + article19title: stringType, + article19link: stringType, + article20title: stringType, + article20link: stringType, + article21title: stringType, + article21link: stringType, + article22title: stringType, + article22link: stringType, + article23title: stringType, + article23link: stringType, + article24title: stringType, + article24link: stringType, + article25title: stringType, + article25link: stringType, + article26title: stringType, + article26link: stringType, + article27title: stringType, + article27link: stringType, + article28title: stringType, + article28link: stringType, + article29title: stringType, + article29link: stringType, + article30title: stringType, + article30link: stringType +}); + +exports.trendingSchema = trendingSchema; diff --git a/client/src/components/Footer/__snapshots__/Footer.test.js.snap b/client/src/components/Footer/__snapshots__/Footer.test.js.snap index 311b756b8d..a89aec9589 100644 --- a/client/src/components/Footer/__snapshots__/Footer.test.js.snap +++ b/client/src/components/Footer/__snapshots__/Footer.test.js.snap @@ -77,148 +77,148 @@ exports[` matches snapshot 1`] = ` className="footer-col footer-col-1" > - Git Clone + trending:article1title - Agile Methods + trending:article2title - Python Main + trending:article3title - Callback + trending:article4title - Debounce + trending:article5title - URL Encode + trending:article6title - Blink HTML + trending:article7title - Python Tuple + trending:article8title - JavaScript Push + trending:article9title - Java List + trending:article10title