Localisation

Previous Next

USoft version 9 contains emerging support for multilingual pages. The method setLanguage() allows the user to change the language. It returns nothing. Its call syntax is:

.setLanguage( language, target )

The required language is a string representing the language.

The optional target is a jQuery object (its value starts with the '$' symbol) referring to the part of the DOM that must be translated into language.

Examples

$.udb.ui.setLanguage("en-GB");

$.udb.ui.setLanguage("en-GB", $("button, input[type="button"]"));

 

 

When the user changes the language the application loads a translation file from the server that is stored in the 'lang' directory. What file to load for a specific language is stored in internal.xml.

The mechanism behind the ability to translate pages is that the factories surround parts of the DOM that can be translated with markers.

<script class="translate-start text" type="text/x-handlebars-template">
 <!-- original content-->
</script>
<!-- translated content-->
<script class="translate-end" type="text/x-handlebars-template"></script>

As mentioned in the first sentence, the multilingual functionality is not yet finished. There are some areas that are not covered. The biggest problem is that the current language cannot be passed to the server. Messages from the rulesservice are always returned in the language of the rulesengine.

Furthermore it would be convenient when translations could be added per page. At this moment all the translations for a language are stored in one single file.

Finally there is an omission when dealing with attributes of DOM elements. Some attributes like for instance 'placeholder' and 'title' contain content that must be translated. This has not been implemented yet.