Solprovider Lenya Kongregate Registration for Free Flash Games and Chat with solprovider

Language Translation Files for i18n

Translation files

The global language files are at:
\build\lenya\webapp\lenya\resources\i18n

Publication-specific language files are at:
{pub}\lenya\resources\i18n
These files are only used if the corresponding global file exists. You cannot add a language to a publication if that language does not exist globally.

The files are named:
cmsui.xml (for the default language), and
cmsui_xx.xml (for all other languages, where xx is the abbreviation for the language.)
The next section describes what happens if there is a language file for the default language.

How Lenya chooses the files


See Language Issues for how Lenya chooses the language for i18n (and how to correct it.)

After the language is decided:
1. Lenya looks in the webapp\lenya\resources\i18n directory for a file with the correct language.
2. If the file was found, Lenya checks the {pub}\lenya\resources\i18n directory for a file with the same name.
3. If the file was not found, Lenya checks for webapp\lenya\resources\i18n\cmsui.xml.
4. If cmsui.xml was found, Lenya checks for {pub}\lenya\resources\i18n\cmsui.xml.

Case 1: There is no global language file for the specified language.
Use global and local cmsui.xml

Case 2: There is a global language file for the specified language "xx".
Use global and local cmsui_xx.xml

Lenya uses "en" as the default language. If there is a global file for the default language "cmsui_en.xml", then that file will be used when the language is not specified, and when the language is specified to be the default language. The default language files "cmsui.xml" will only be used when the language is specified and there is no language file.

Lenya is smart enough to use the local files for the current publication, so local translations are specific to the publication, and do not affect other publications.

Translation File Format


The file format is:
<?xml version="1.0" encoding="UTF-8"?>
<catalogue xml:lang="en">
<message key="This should be translated.">This must be translated to all languages or "untranslated" will appear.</message>
<message key="keyForThisText">This displays only for languages that include KeyforThisText.</message>
<message key="Submit">Submit</message>
<message key="Display this">This is what we really want displayed</message>
</catalogue>


You can also use HTML in your translation messages:
<message key="multiple-line-example"><b>I want</b> this<br/>displayed on<br/><i>three</i> lines.</message>

Your language file maintainers need to understand HTML for that, but it can be very useful.

We have some instructions on a Flow Form.The English instructions are 5 short words. The Russian instructions are 20 long words. The Russian Form had the Fields pushed to the right edge of the window. Adding 2 <br/> to the translated message greatly improved the formatting.

EVERY MESSAGE MUST HAVE A KEY!
One entry like:
<message>something</message>
will completely turn off translation for that language.

To add a new translation, just add another message tag to your publication's files.

"untranslated" Message from i18n

"untranslated" appears when key is the within the tag rather than a property, and the key does not exist in the appropriate language file.
These return blanks:
<i18n:text key="willNotBeFound"></i18n:text>
<i18n:text key="willNotBeFound"/>

This returns "untranslated":
<i18n:text>willNotBeFound</i18n:text>

"untranslated" also appears when i18n is used for a property, such as Value of a Button. The i18n tags are added around the label before it passes through i18n. "untranslated" is very useful for debugging.

It allows writing everything in the default language, adding the i18n tags around phrases needing translation, and seeing "untranslated" during testing. The <i18n:text key="some-key"/> is useful for when you want a phrase to appear only if a translation exists. It allows language-specific help, such as "Click here to return to the default language", and satisfies customer requests like "Can you add this option only to the German version of the layout?"

<< XMAP i18ni18n File Priority >>

Contact Solprovider
Paul Ercolino