-
Notifications
You must be signed in to change notification settings - Fork 6
Localization
Daniel Weck edited this page Mar 9, 2022
·
11 revisions
See this wiki page: https://github.com/daisy/ace/wiki/Localization
The currently-supported languages are:
- English (credits @marisademeglio @rdeltour @danielweck)
- French (credits @danielweck @rdeltour)
- Spanish (credits @nvdaes)
- Portuguese-Brazil (credits @thiagoeec)
- Danish (credits @ddfreiling @MyDK)
- Japanese (credits @murata2makoto @shunito)
In both cases, GitHub Pull Requests must be created in order to propose edits to the JSON resources that contain the translated labels. The Ace GUI locales are:
https://github.com/daisy/ace-gui/tree/master/src/shared/l10n/locales
...please, also update the name of the language itself in this file:
https://github.com/daisy/ace-gui/blob/master/src/shared/l10n/localize.js
-
yarn i18n-sort
: this script ensures that thei18next
keys in all locale JSON files (e.g. primary English, as well as secondary French, Spanish, etc.) are sorted in alpha-numerical order. This script also forces consistent JSON formatting (4-spaces indentation, line break at the end of the file). So, this is effectively a normalization step that produces a consistent, (kind of) canonical representation of the l10n resources, which is not only useful for manual processing / comparison between languages, but also a prerequisite for the following scripts. -
yarn i18n-scan
: this script performs a static analysis of the codebase in order to extract alli18next
keys used in the software, builds a dummy language resource (temporary JSON file) containing all the hierarchical keys (with empty string values), which is then used as a "master" template to compare against the real JSON locales (e.g. primary English, as well as secondary French, Spanish, etc.). See the following script description to learn more about the outcome of the comparison process. -
yarn i18n-check
: this script compares the primary English locale JSON with the secondary languages. The script removes all unused keys, and adds missing keys (with empty string values). A simplegit --no-pager diff
can be used to visualize differences. Identifying keys that need translating is simply a matter of searching for empty string values.
Under the hood, Ace utilizes the i18next
library in order to handle the localization resources at runtime (i.e. JSON files). There are a number of utilities that can ease the process of comparing language keys / values, detecting missing entries, etc.: