-
-
Notifications
You must be signed in to change notification settings - Fork 212
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a documentation about internationalisation
- Loading branch information
Showing
3 changed files
with
58 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# Internationalisation | ||
|
||
We're using the standard way of internationalising our app, as desbribed in the | ||
[official documentation)(https://docs.flutter.dev/ui/accessibility-and-internationalization/internationalization#setting-up). | ||
|
||
What is specific to this project is the way we produce the template `lib/l10n/app_en.arb` file. | ||
|
||
This file is generated by a script: `scripts/update-arb-from-crowdin.mjs` that fetches lichess translations from the [crowdin lichess project](https://crowdin.com/project/lichess). | ||
|
||
For now, only translations from the website are fetched. Mobile specific translations are yet to be created in crowdin. | ||
|
||
There is a ticket to create a mobile specific project in crowdin: https://github.com/lichess-org/mobile/issues/98 | ||
|
||
## How to update the translations | ||
|
||
There is a script that fetches the translations from crowdin and updates the `lib/l10n/app_en.arb` file. | ||
|
||
This file must not be edited manually, as it will be overwritten by the script. | ||
|
||
To update the translations, run the following commands: | ||
|
||
```bash | ||
./scripts/update-arb-from-crowdin.mjs | ||
flutter gen-l10n | ||
``` | ||
|
||
If the script does nothing (no changes), it means that the translations from the | ||
last crowdin export are already up to date. | ||
|
||
## How to add a new module from lila | ||
|
||
Translations in | ||
[lila](https://github.com/lichess-org/lila/tree/master/translation/source) are organised by module. | ||
|
||
The list of modules we're using in the app is defined in the `scripts/update-arb-from-crowdin.mjs` script. | ||
|
||
If you need to add a new module, you need to add it to the list of modules in the script. | ||
|
||
Note that a module can contain a lot of translations that we don't need in the app. In this case, you can filter the translations by adding the module to the `whitelist` defined in the script. | ||
|
||
Once you've added the module to the script, you can run the script to update the translations. | ||
|
||
```bash | ||
./scripts/update-arb-from-crowdin.mjs | ||
flutter gen-l10n | ||
``` | ||
|
||
You should see the new strings in the `lib/l10n/lila_*.arb` and `lib/l10n/lila_*.dart` files. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters