Page History
...
When new keys are introduced, TODO messages are automatically added to the catalogs of other languages.
Background reading
Starting a new language translation from scratch
1. Create an empty file in resources/i18n and give it the two letter iso code of your language as the filename, for example nl.json5 or fr.json5
2. Preload your new catalog with all the messages in the en.json5 catalog by executing ../scripts/sync-i18n-files.js -t fr.json5, where fr.json5 is your empty file. The file should now be filled with all of the English messages, that are now present both as comments, as well as message, for you to translate.
3. Translate as many messages as you can. For every message you translate, remove the TODO comment from the catalog.
4. Activate the new language in environment.default.js
Code Block |
---|
{
code: 'nl',
label: 'Nederlands',
active: true,
} |
Where code is the two letter code for your language, also used as the filename for your translated catalog.
Label is the name of your language, written in that language.
Active set to true, so the language is visible in the language selector on the frontpage.GNU gettext utilities
Developer i18n How-to
When you create new keys, update existing keys or the meaning of existing messages, keep the following in mind.
...
- Introduce new keys & messages
- Change an existing key
- Change an existing message
Please run the node script: /scripts/sync-i18n-files.js
...
- Provide translations for the new keys you just introduced
- Update existing translations in case you changed the message for an existing key
By default, the execution of sync-i18n-files.js will:
- look at en.json5 as the authoritative source file
- will look at all catalogs present in /resources/i18n/ as target files to sync up with the latest changes in source.
- will execute these changes in-place, meaning that no backup etc is taken of the translation before the sync
If you want to alter this behaviour, you can:
- specify a different source file using -s
- specify a different target file using -t
- specify another output file using -o in case you want to avoid in place edit
Future work
ICU Expressions and Pluralization
...
Code Block | ||
---|---|---|
| ||
app/+community-page/delete-community-page/delete-community-page.component.html:5: <h2 id="header" class="border-bottom pb-2">{{ 'community.delete.head' | translate app/+community-page/delete-community-page/delete-community-page.component.html:7: <p class="pb-2">{{ 'community.delete.text' | translate:{ dso: dso.name } }}</p> app/+community-page/delete-community-page/delete-community-page.component.html:12: <button class="btn btn-primary" (click)="onCancel(dso)">{{'community.delete.cancel' | translate}} app/+community-page/edit-community-page/edit-community-page.component.html:4: <h2 id="header" class="border-bottom pb-2">{{ 'community.edit.head' | translate }}</h2> |
Background reading
...