From 7b4d274e810f0d104b653dfddc7dcf4bcd530571 Mon Sep 17 00:00:00 2001 From: sidemt <25644062+sidemt@users.noreply.github.com> Date: Tue, 4 Jul 2023 01:53:37 +0900 Subject: [PATCH] fix(docs): update docs for language leads (#50760) Co-authored-by: Naomi Carrigan --- docs/how-to-enable-new-languages.md | 5 ++- docs/language-lead-handbook.md | 60 ++++++++--------------------- 2 files changed, 19 insertions(+), 46 deletions(-) diff --git a/docs/how-to-enable-new-languages.md b/docs/how-to-enable-new-languages.md index bb24f663765..479d9da2d4f 100644 --- a/docs/how-to-enable-new-languages.md +++ b/docs/how-to-enable-new-languages.md @@ -122,7 +122,7 @@ export const rtlLangs = ['']; ### Set Translated SuperBlocks -In the [config/superblocks.ts](https://github.com/freeCodeCamp/freeCodeCamp/blob/main/config/superblocks.ts) file, add the new language to the `notAuditedSuperBlocks` object. This lists all the superblocks which are not fully translated. Add an array of superblocks which have not been fully translated to it: +In the [config/superblocks.ts](https://github.com/freeCodeCamp/freeCodeCamp/blob/main/config/superblocks.ts) file, add the new language to the `notAuditedSuperBlocks` object. This lists all the superblocks which are not fully translated. Add an array of superblocks which have not been fully translated to it. For example: ```js export const notAuditedSuperBlocks: NotAuditedSuperBlocks = { @@ -147,6 +147,8 @@ export const notAuditedSuperBlocks: NotAuditedSuperBlocks = { Be sure to only add the superblocks which are **not** fully translated and approved. The translated superblocks will be calculated from this object. When a new superblock is finished being fully translated, remove it from the array for that language. +See the `SuperBlocks` enum at the beginning of the same file for the full list of superblocks. + ### Configure Search Next, open the `client/src/utils/algolia-locale-setup.ts` file. This data is used for the search bar that loads `/news` articles. While it is unlikely that you are going to test this functionality, missing the data for your language can lead to errors when attempting to build the codebase locally. @@ -248,7 +250,6 @@ You will want to copy the following files from `/client/i18n/locales/english` to - `links.json` - `meta-tags.json` - `motivation.json` -- `trending.json` ## Testing Translations Locally diff --git a/docs/language-lead-handbook.md b/docs/language-lead-handbook.md index e7293b02561..9c47cd711cb 100644 --- a/docs/language-lead-handbook.md +++ b/docs/language-lead-handbook.md @@ -41,48 +41,9 @@ With `link` being the link of the original article. > [!TIP] > Changing the articles in the footer at least once a month means giving a boost to the linked articles on Google results. -There are two places in which to change the trending articles. +To update the trending articles in the footer, you need to update the [yaml file in the CDN repository](https://github.com/freeCodeCamp/cdn/tree/main/build/universal/trending) for your language. Both the curriculum and the publication reference this file. -- [The curriculum repository](https://github.com/freeCodeCamp/freeCodeCamp/) -- [The CDN repository](https://github.com/freeCodeCamp/cdn) - -For each article, you will need to create a shorter title to use in the footer. - -### Change Trending Articles in the Curriculum - -The trending articles in the curriculum footer can be changed by editing the file at `client/i18n/locales//trending.json`. - -This file is a `*.json` file that has the shape of an object with property keys in the shape `article0title` and `article0link`. - -Each number represents one of the 30 articles in the footer. Make sure to match the title and the link correctly. - -This is an example of how part of the `trending.json` file has to look. - -```json -{ - "article0title": "Unire CSV con Python", - "article0link": "https://www.freecodecamp.org/italian/news/come-combinare-file-multipli-in-formato-csv-con-8-righe-di-codice/", - "article1title": "Il comando Git push", - "article1link": "https://www.freecodecamp.org/italian/news/il-comando-git-push-spiegato/", - "article2title": "Centrare immagini in CSS", - "article2link": "https://www.freecodecamp.org/italian/news/come-centrare-un-immagine-usando/", - "article3title": "I codici Alt", - "article3link": "https://www.freecodecamp.org/italian/news/codici-alt/", - "article4title": "Tenere a bada il footer", - "article4link": "https://www.freecodecamp.org/italian/news/come-mantenere-il-footer-al-suo-posto/", - "article5title": "Cosa è un'API?", - "article5link": "https://www.freecodecamp.org/italian/news/cose-un-api-in-italiano-per-favore/", - ... -} -``` - -You will want to [build the translated client locally](how-to-enable-new-languages.md) to see if the titles have the right length. Each title must stay on a single line and not go to a new line. - -### How to Update the Trending Articles in the CDN - -The file in the CDN repository is the file `universal/trending/.yaml`. - -This file is shaped differently. For example, here is the file content for the first 6 articles: +For example, here is the file content for the first 6 articles: ```yaml article0title: 'Unire CSV con Python' @@ -99,10 +60,21 @@ article5title: 'Cosa è API?' article5link: 'https://www.freecodecamp.org/italian/news/cose-un-api-in-italiano-per-favore/' ``` -You can convert from one format to the other carefully changing it manually. Or you can use [the script in this repl](https://replit.com/@Ieahleen/convert-json-to-yaml). +Each number represents one of the 30 articles in the footer. Make sure to match the title and the link correctly. -> [!TIP] -> A new workflow is being worked on, there will be only one place to change in the future. +For each article, you will need to create a shorter title to use in the footer. Each title must stay on a single line and not go to a new line. + +You will want to [build the translated client locally](how-to-enable-new-languages.md) to see if the titles have the right length. You can preview the changes by editing the `trending.json` file in your local environment: + +1. Update your `.env` file to use your language for `CLIENT_LOCALE` and `CURRICULUM_LOCALE`. + +2. Run `pnpm run create:config`. This will automatically generate the `trending.json` file for your language under the `/client/i18n/locales/` directory. + +3. Start the server by running `pnpm run develop:server` in one terminal window. + +4. Edit the `trending.json` to contain the titles you want to preview. You may want to convert your `.yaml` file into JSON format with an automatic tool. + +5. In another terminal window, run `pnpm run clean:client`, and then `pnpm run develop:client` ## How to Translate Articles in the Footer Links