Skip to content

Localisation

Linda Alblas edited this page Aug 10, 2017 · 5 revisions

DMIS makes use of Angular 4's internationalisation tools.

Annotate the HTML of translatable content

Example: <h1 i18n="An introduction header for this sample@@introductionHeader">Hello i18n!</h1>

Provide a description ('An introduction header for this sample' followed by an ID ('introductionHeader') prefixed with @@. Please see the Angular Internationalisation documentation for more details.

You can give strings that are the same, the same ID so it only needs to get translated once.

Generate/update the messages file by extracting translatable content

  • Go to the client folder cd client
  • Extract the translatable content ng xi18n --output-path src/locale

Create the Khmer version of the messages file

Copy the messages.xlf from the output location of step one (src/locale/messages.xlf) and translate into Khmer. There are editors out there for .xlf files that can help with this.

Run the localised version

ng serve --aot --locale km --i18n-format xlf --i18n-file src/locale/messages.km.xlf

Commit updated messages files

Commit the updated messages file. When the code gets deployed, it will automatically build the English and Khmer version of the code.