A modified version of Wafrn used on https://wf.jbc.lol (mirror of https://git.jbc.lol/jbcrn/wf.jbc.lol which is a mirror of https://codeberg.org/jbcarreon123/wf.jbc.lol)
at development 38 lines 2.2 kB view raw view rendered
1# Translating Wafrn 2 3Wafrn translations are done via JSON files located at `packages/frontend/src/assets/i18n/`. The primary language of Wafrn is English so there are a lot of small places where the translation files are not used yet. 4 5- [Contributing to an existing language](#contributing-to-an-existing-language) 6- [Adding a new language](#adding-a-new-language) 7- [Enabling a language on the frontend](#enabling-a-language-on-the-frontend) 8 9Note that adding languages is not as simple as creating the JSON file, you must follow the steps under the header [Enabling a language on the frontend](#enabling-a-language-on-the-frontend) due to technical reasons. 10 11## Contributing to an existing language 12 13First, locate the language you wish to add translations for in the `packages/frontend/src/assets/i18n/` folder. The language should be stored under its country code as a JSON file. 14 15The translations on the `en.json` file are often not matched on other translation files due to being constantly updated. To add the missing keys, use the following commands: 16 17```bash 18npm run frontend:translations:patch -- YOUR_LANGUAGE_HERE.json 19npm run frontend:translations:format 20``` 21 22After this, you can edit the new translation keys and contribute through Git commands as normal. 23 24## Adding a new language 25 26To add a new language, copy the current `en.json` with a new name from the [country code](https://www.fincher.org/Utilities/CountryLanguageList.shtml). You may abbreviate to just the first part if there are no others under that name. Then simply use the English file to translate. 27 28If you would rather start from a different language, follow the header [Adding a new language](#adding-a-new-language) to patch the language you wish to start from, then run: 29 30```bash 31npm run frontend:translations:patch -- THE_LANGUAGE_YOU_ARE_STARTING_FROM.json YOUR_NEW_LANGUAGE.json 32``` 33 34You should now have a JSON file with up-to-date keys which you can start to translations on. 35 36## Enabling a language on the frontend 37 38Languages are enabled in `packages/frontend/src/app/lists/languages.ts` by adding them to the variable `supportedLanguages` and then filling out the variable `languageMap` with its native name.