Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The PO Format

GNU gettext utilities

Developer i18n How-to

Escaping

In Angular files (.html, .ts, ...) you need to escape

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
languagebash
titleGrep command for identifying keys that have not yet been replaced
grep -snRHIiE "'.*\.[^\s]+\.[^']+' \| translate" *

Sample output looks like:

...

languagebash

...

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

...