docs: document i18n videos (#43553)
* docs: document i18n videos * chore: apply oliver's review suggestions Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com> * docs: additional places to change * feat: add yml highlighting Co-authored-by: Shaun Hamilton <shauhami020@gmail.com> Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com> Co-authored-by: Shaun Hamilton <shauhami020@gmail.com>
This commit is contained in:
parent
f00edd6a3a
commit
cf3dc4d3b5
@ -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.
|
||||
|
@ -231,6 +231,7 @@
|
||||
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/components/prism-jsx.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/components/prism-typescript.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/components/prism-tsx.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/components/prism-yaml.min.js"></script>
|
||||
|
||||
<script src="https://unpkg.com/docsify-pagination/dist/docsify-pagination.min.js"></script>
|
||||
<script src="https://unpkg.com/docsify-remote-markdown/dist/docsify-remote-markdown.min.js"></script>
|
||||
|
Loading…
x
Reference in New Issue
Block a user