Internationalisation - AtlasOfLivingAustralia/biocollect Wiki

Internationalisation or i18n for short is supported by Grails. However, its use is limited to server side i.e. GSP pages, controller methods etc. This wiki article explains how to implement it in JavaScript file and HTML.

Basic requirement

KnockoutJS is required. It also requires i18n.js file. It can be intialised by the following code.


Where URL is controller method that gets i18n file content.

NOTE This is already included in layout page. You can skip this step.

Usage in HTML

<strong data-bind="text: $i18n('', 'Your default text here')"></strong>

Where is the property name.

If your i18n code has HTML, then use KnockoutJS's html binding.

<strong data-bind="html: $i18n('', 'Your default text here')"></strong>

NOTE It is assumed that the above HTML is in a section activated by KnockoutJS.

Usage in JavaScript

$i18nAsync('', 'Your default text here', function (value) {