Content Server uses Xlates to facilitate the internationalization of its interface into other languages. Using Xlates, you can translate:
An OSpace or module may possess a properties file for each language (and optionally country)
into which it is translated. For example, for the Projects OSpace, project.oll
there is a corresponding properties file for English (Canada), called project_en_CA.properties
,
for German (Germany) called project_de_DE.properties
, and so on. A properties
file stores the information required to translate each string of user text in its
OSpace/module and corresponding HTML files. For each string, the properties file stores:
This set of information forms an Xlate. Xlates are organized into groups for easier management, and the groups in a properties file are given names that become part of the Xlate's key.
For the modules you create, you use the Xlate functions in CSIDE to replace all your user text with properties in a properties file.
By referencing an Xlate instead of the string itself, you can easily create versions of Content Server for different languages without having to make modifications to your code. Xlates should be used in your code instead of text, when displaying messages or prompts. Do note that if you replace all your strings with properties, you will need to create a properties file for the language you used to create the interface in addition to the localized languages
Furthermore, quoted strings tend to be more “translatable” due to differing word order across languages. As Xlates can only replace individual strings and if the text being displayed to a user includes variables, it makes sense to use Content Server's Str.Format() built-in function.
If your code had a line such as the following:
String toDisplay = "The item " + itemName + " could not be added to the " + folderName + " Folder."
... it would make sense to replace it with something like the following:
String toDisplay = Str.Format([MODULENAME_ERRMSG.TheItem1CouldNotBeAddedToThe2Folder], itemName, folderName)
... with the following being added to your module's property file:
MODULENAME_ERRMSG.TheItem1CouldNotBeAddedToThe2Folder = The item %1 could not be added to the %2 Folder.