I18n: Add Chinese (Simplified) (#56739)

* Prevent _old.json files from being created

* Add contrib docs for adding new locale

* add chinese (simplified)
This commit is contained in:
Josh Hunt
2022-10-12 11:12:46 +01:00
committed by GitHub
parent 85e3ed491d
commit 719769ee7c
10 changed files with 62 additions and 23 deletions

View File

@@ -38,6 +38,18 @@ const ErrorMessage = ({ id, message }) => <Trans id={`errors.${id}`}>There was a
3. Before submitting your PR, run the `yarn i18n:extract` command to extract the messages you added into the `messages.po` file and make them available for translation.
## How to add a new language
1. Add new locale in Crowdin and sync files to repo
1. Grafana OSS Crowdin project -> "dot dot dot" menu in top right -> Target languages
2. Grafana OSS Crowdin project -> Integrations -> Github -> Sync Now
3. If Crowdin's locale code is different from our IETF language tag, add a custom mapping in Project Settings -> Language mapping
2. Update `public/app/core/internationalization/constants.ts` (add new constant, and add to `VALID_LOCALES`)
3. Update `public/app/core/internationalization/index.tsx` to add the message loader for the new locale
4. Update `public/app/core/components/SharedPreferences/SharedPreferences.tsx` to add the new locale to the options.
5. Update `public/locales/i18next-parser.config.js` to add the new locale to `locales`
6. Run `yarn i18n:extract` and commit the result
## How translations work in Grafana
Grafana uses the [LinguiJS](https://github.com/lingui/js-lingui) framework for managing translating phrases in the Grafana frontend. It: