Page History
...
Developer i18n How-to
Escaping
In Angular files (.html, .ts, ...) you need to escape
- Single quotes (') with \
- Double curly braces
Code Block |
---|
{{ 'copyright © 2002-{'+'{ year }'+'}' | translate:{year : dateObj | date:'y'} }} |
In .po/.pot files you need to escape
- Double quotes (") with \
- ...
Locating keys that have not been replaced
If you execute following command in the angular source directory, you get a list of keys that have not yet been replaced.
Code Block | ||||
---|---|---|---|---|
| ||||
grep -snRHIiE "'.*\.[^\s]+\.[^']+' \| translate" * |
Sample output looks like:
...
language | bash |
---|
...
When you create new keys, update existing keys or the meaning of existing messages, keep the following in mind.
Escaping
In the message catalogs, double quotes have to be escaped with \
Code Block |
---|
"submission.workflow.tasks.claimed.approve_help": "If you have reviewed the item and it is suitable for inclusion in the collection, select \"Approve\"." |
Syncing existing translations with changes to en.json5
Whenever you make one of following changes to en.json5:
- Introduce new keys & messages
- Change an existing key
- Change an existing message
Please run /scripts/sync-i18n-files.js
The results of your changes will be reflected in the catalogs of the other languages, so translators can pick up the work to:
- Provide translations for the new keys you just introduced
- Update existing translations in case you changed the message for an existing key
Future work
ICU Expressions and Pluralization
...