Cyclone3 Skin

Module template internationalization

From Cyclone3 Wiki

  • Extension: *.xlng (see Naming conventions)
  • Location: _mdl
  • Mandatory: no
  • Caching: may be cached (depends on master module's setup)

A functional module can internationalize strings in the used Module template output by itself, but it is strongly recommended, that it uses the Cyclone3 built-in template internationalization system. This way, the web designers don't have to edit the functional module part to change the internationalization strings output, they only change the internationalization file for the given module.

Here is an example of an article list search internationalization file:


<VALUE lng="sk" id="search_button">Hľadaj</VALUE>
<VALUE lng="en" id="search_button">Search</VALUE>
<VALUE lng="de" id="search_button">Suche</VALUE>

<VALUE lng="sk" id="search">Vyhľadávanie</VALUE>
<VALUE lng="en" id="search">Search</VALUE>
<VALUE lng="de" id="search">Suche</VALUE>

<VALUE lng="sk" id="found">Počet nájdených záznamov:</VALUE>
<VALUE lng="en" id="found">Number of items:</VALUE>
<VALUE lng="de" id="found">Anzahl der gefundenen Dokumente:</VALUE>
<VALUE lng="sk" id="next">ďalšie</VALUE>
<VALUE lng="en" id="next">next</VALUE>
<VALUE lng="de" id="next">nächste</VALUE>

<VALUE lng="sk" id="prev">predchádzajúce</VALUE>
<VALUE lng="en" id="prev">previous</VALUE>
<VALUE lng="de" id="prev">vorherige</VALUE>


As you probably already realized, this file is able to provide internationalized strings for three languages - Slovak, German and English.

The file structure is simple. The main XML_LANGUAGE_DEFINITION contains a lngs attribute with comma-separated list of languages available inside. For each specific VALUE string, a lng (language the string is in) and id (internationalization file's unique string identifier which will be used in the module template as a placeholder for the translated string. The inside content of the VALUE tag is the actual representation of the identifier's translation for the given language, this will display in the position of the placeholder in the module's final template output.

Example of use

As first, you need to add a specific parameter into the type for the given module. You should see the parameter in the module's documentation. The standard variable is:

<VAR id="-xlng_load" value="1" />

In some older applications, you would use

<VAR id="xt_xlng" value="1" />

In the module's template, add an internationalization placeholder, always beginning with XLNG-, the identificator itself is up to you:

   <a href="?|?type=article_view&ID=<%ID%>"><%name%></a>
<a href="?|?type=article_view&ID=<%ID%>"><%XLNG-read_more%></a>

Specify the translations in the internationalization file:

<VALUE lng='en' id="read_more">Read more</VALUE>
<VALUE lng='de' id="read_more">Mehr lesen</VALUE>
<VALUE lng='sk' id="read_more">Čítať viac</VALUE>

This altogether, will, in the final output on the german version of the page, produce this (we'll ignore the other % gateways for clarification purposes):

   <a href="?|?type=article_view&ID=<%ID%>"><%name%></a>
<a href="?|?type=article_view&ID=<%ID%>">Mehr lesen</a>