2.14.9. Localisation

GateIn can localise modules on the server. The JavaScript of each module is rewritten and replaces keys with values borrowed from resource bundles. Each script will be available under a different URL for each localisation to provide the maximum caching of the resource.

The localisation of a script is activated with the resource-bundle XML tag along with the path tag. Resources bundles are declared by the supported-locale tag and must be available in the web application classpath:


GateIn will escape any key of the {key} form and will look up the value in the resource bundles. For instance, one can easily build a JSON object containing localised values:

function() {
 return {
 "hello": "${hello}",
 "goodbye": "${goodbye}"

At runtime, different versions of this script will be served by GateIn with the properly escaped values.

Scripts in GateIn

Whenever possible, JavaScript should be written as an AMD module. This is the best practice which helps to manage dependencies, organize code, but not pollute the global scope and do parallel loading.


GateIn also supports the custom adapter mechanism to adapt traditional script into GateIn module.

However, in some specific cases, you may want to use the old way which loads the scripts as non-AMD module. GateIn still supports this and allows you to manage those js dependencies:


You can also use a script provided on the internet by using the url tag instead of the script tag:

Copyright ©. All rights reserved. eXo Platform SAS
blog comments powered byDisqus