Skip to content

Latest commit

 

History

History
77 lines (50 loc) · 3.47 KB

internationalisation.md

File metadata and controls

77 lines (50 loc) · 3.47 KB

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.

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: lichess-org#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:

./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 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.

./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.

Adding mobile-specific translations

Note

When working on a new feature, you should start with hardcoding English texts first. Once the feature is done, released and even used for a while, we can add translations, in order to avoid useless translating work.

There are some strings that appear only in this app, but not on lichess.org.

If you have a new string to be translated, add it to translations/source.mobile.xml. Make sure to include a comment attribute, describing the usage of the string and its contents (e.g. placeholders). Some strings also must not exceed a certain width due to UI constraints, use the maxLength attribute for that.

After updating translations as described above, they can be used like the other translations, however a mobile prefix is added in dart. For example, "foo" in mobile.xml turns into mobileFoo in dart.

Note

We do not translate error messages that are not critically important, such as "could not load XY" when screen "XY" failed to load. Translating work is done by a team of volunteers and we try to focus on quality rather than quantity. Such messages are mostly edge cases in the sense they should be rarely seen and people would understand that something went wrong and could not load without understanding the actual meaning of the error message.

Note Do not translate names such as "Puzzle Storm" and "Puzzle Streak". If such names appear in a translation string, add a comment that they should not be translated.