From cf3dc4d3b5656a9aa95bd7b76f6098d0f560a3a5 Mon Sep 17 00:00:00 2001 From: "Nicholas Carrigan (he/him)" Date: Fri, 24 Sep 2021 10:27:20 -0700 Subject: [PATCH] docs: document i18n videos (#43553) * docs: document i18n videos * chore: apply oliver's review suggestions Co-authored-by: Oliver Eyton-Williams * docs: additional places to change * feat: add yml highlighting Co-authored-by: Shaun Hamilton Co-authored-by: Oliver Eyton-Williams Co-authored-by: Shaun Hamilton --- docs/how-to-test-translations-locally.md | 54 ++++++++++++++++++++++++ docs/index.html | 1 + 2 files changed, 55 insertions(+) diff --git a/docs/how-to-test-translations-locally.md b/docs/how-to-test-translations-locally.md index 17309e06f5..612b7562d6 100644 --- a/docs/how-to-test-translations-locally.md +++ b/docs/how-to-test-translations-locally.md @@ -127,6 +127,60 @@ CLIENT_LOCALE="dothraki" CURRICULUM_LOCALE="dothraki" ``` +## Enabling Localized Videos + +For the video challenges, you need to change a few things. First add the new locale to the GraphQL query in the `client/src/templates/Challenges/video/Show.tsx` file. For example, adding Dothraki to the query: + +```tsx + query VideoChallenge($slug: String!) { + challengeNode(fields: { slug: { eq: $slug } }) { + videoId + videoLocaleIds { + espanol + italian + portuguese + dothraki + } + ... +``` + +Then add an id for the new language to any video challenge in an audited block. For example, if `auditedCerts` in `all-langs.js` includes `scientific-computing-with-python` for `dothraki`, then you must add a `dothraki` entry in `videoLocaleIds`. The frontmatter should then look like this: + +```yml +videoLocaleIds: + espanol: 3muQV-Im3Z0 + italian: hiRTRAqNlpE + portuguese: AelGAcoMXbI + dothraki: new-id-here +dashedName: introduction-why-program +--- +``` + +Update the `VideoLocaleIds` interface in `client/src/redux/prop-types` to include the new language. + +```ts +export interface VideoLocaleIds { + espanol?: string; + italian?: string; + portuguese?: string; + dothraki?: string; +} +``` + +And finally update the challenge schema in `curriculum/schema/challengeSchema.js`. + +```js +videoLocaleIds: Joi.when('challengeType', { + is: challengeTypes.video, + then: Joi.object().keys({ + espanol: Joi.string(), + italian: Joi.string(), + portuguese: Joi.string(), + dothraki: Joi.string() + }) +}), +``` + ## Loading Translations Because the language has not been approved for production, our scripts are not automatically downloading the translations yet. Only staff have the access to directly download the translations - you are welcome to reach out to us in our [contributors chat room](https://chat.freecodecamp.org/channel/contributors), or you can translate the English markdown files locally for testing purposes. diff --git a/docs/index.html b/docs/index.html index 71718aecd9..d9bea94b08 100644 --- a/docs/index.html +++ b/docs/index.html @@ -231,6 +231,7 @@ +