From 28ec2b361a29b92a860f0f21fdcebbfcb528fcea Mon Sep 17 00:00:00 2001 From: Tomer Ben-Rachel Date: Tue, 31 Oct 2023 15:53:44 +0200 Subject: [PATCH] Enhance Readme To Explain How To Contribute Translations (#4918) * feature/translations-contribution adding steps on how to contribute a translation * feature/translations-contribution added fruther detail of location of json file * feature/translations-contribution updating snapshots * feature/translations-contribution adding step to run updating snapshot command * feature/translations-contribution reverting snapshot changes * feature/translations-contribution reverting snapshot changes --- README.md | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 45008bb76..ec34c2ac7 100644 --- a/README.md +++ b/README.md @@ -138,7 +138,19 @@ Before checking in commits, run `make ci`, which is similar to the `.gitlab-ci.y ### Translating -Help translate Focalboard! The plugin is already translated into several languages. We welcome corrections and new language translations submitted against the [appropriate language JSON file](https://github.com/mattermost/focalboard/tree/main/webapp/i18n) in this repository. +Help translate Focalboard! The plugin is already translated into several languages. We welcome corrections and new language translations submitted against the [appropriate language JSON file](https://github.com/mattermost/focalboard/tree/main/webapp/i18n) in this repository. To add a new language, follow the steps below: + +- Create a new file with the language code (I.E. `en.json`) inside `webapp/i18n` directory +- Copy the contents of the en.json file into your newly created file +- Leave the keys in this file as they are and replace all the values with the translated strings +- Go to `webapp/src/constants.ts` and add an entry for the language you are translating into under the **languages** array +- This array needs to consist of three keys: the language code, the name of the language and the display name of the language +- Go to `webapp/src/i18n.tsx`: + - import the json of the language translation you have just added + - Add the language code to the `supportedLanguages` array + - Add another case to the switch case matching the language you added inside `getMessages` +- Once you are done, you need to update the snapshot by using this command `npm run updatesnapshot` + ### Staying informed