diff options
-rw-r--r-- | support/doc/development/localization.md | 28 |
1 files changed, 11 insertions, 17 deletions
diff --git a/support/doc/development/localization.md b/support/doc/development/localization.md index 1664532fe..8aeb0c771 100644 --- a/support/doc/development/localization.md +++ b/support/doc/development/localization.md | |||
@@ -1,40 +1,34 @@ | |||
1 | # Application localization documentation | 1 | # Application localization documentation |
2 | 2 | ||
3 | Source files are in `client/src/locale/source` and translated files pulled from [Zanata](https://trad.framasoft.org/zanata/iteration/view/peertube/develop/languages/fr?dswid=-1605) in `client/src/locale/target`. | 3 | Source files are in `client/src/locale` and translated files merged from [Weblate](https://weblate.framasoft.org/translate/peertube). |
4 | 4 | ||
5 | ## Generation | ||
6 | 5 | ||
7 | Will generate XLIFF files for Angular and escape inner elements in `source` tag because Zanata does not support them. | 6 | ## Generation |
8 | 7 | ||
9 | This script will create `player_en_US.xml` XLIFF file using custom strings (VideoJS plugins) and strings from `videojs_en_US.json` file. | 8 | Will generate XLIFF base files for Angular (`angular.xlf`) and JSON files for the player (`player.en-US.json`) and the server (`server.en-US.json`). |
9 | Then, it will merge new translation keys into localized Angular files (`angular.fr-FR.xlf` etc). | ||
10 | 10 | ||
11 | It will also create `server_en_US.xml` and `iso639_en_US.xml` XLIFF file using server strings and custom strings (defined inside the script, we did not find a way to extract them from TypeScript server files). | 11 | **Only generate new translations after a Weblate pull to avoid conflicts** |
12 | 12 | ||
13 | ``` | 13 | ``` |
14 | $ npm run i18n:generate | 14 | $ npm run i18n:generate |
15 | ``` | 15 | ``` |
16 | 16 | ||
17 | ## Upload on Zanata | ||
18 | 17 | ||
19 | Push source source files (en-US) on Zanata: | 18 | ## Upload on Weblate |
19 | |||
20 | Nothing to do here, Github will automatically send a webhook to Weblate that will pull changes. | ||
20 | 21 | ||
21 | ``` | ||
22 | $ zanata-cli push | ||
23 | ``` | ||
24 | 22 | ||
25 | ## Pull translation | 23 | ## Pull translation |
26 | 24 | ||
27 | Pull XLIFF files from Zanata, and unescape them (so we retrieve inner elements in `source` tag, used by Angular). | 25 | * First, save translations on Weblate so it commits changes. |
28 | A hook converts `player` and `server`, `iso639` translation files to JSON (needed by Video.JS, and our application to have efficient runtime translation). | 26 | * Then, fetch these commits: `git fetch weblate && git merge weblate/develop` |
29 | Then, `iso639` files will be merged in `server` files (so we have only one JSON file to serve server translations). | ||
30 | 27 | ||
31 | ``` | ||
32 | $ zanata-cli pull | ||
33 | ``` | ||
34 | 28 | ||
35 | ## Support a new language | 29 | ## Support a new language |
36 | 30 | ||
37 | * Add it to [/shared/models/i18n/i18n.ts](/shared/models/i18n/i18n.ts) | 31 | * Add it to [/shared/models/i18n/i18n.ts](/shared/models/i18n/i18n.ts) |
38 | * Add it to [/scripts/build/client.sh](/scripts/build/client.sh) | 32 | * Add it to [/scripts/build/client.sh](/scripts/build/client.sh) |
39 | * Pull using zanata (that will execute hooks to correctly generate files of this new language) | 33 | * Add it to [/client/angular.json](/client/angular.json) in `xliffmergeOptions` section, then **pull** and **generate** |
40 | * Build the application and check the new language correctly works | 34 | * Build the application and check the new language correctly works |