32. translation

<translation
  location = anyURI matching [path/]resourcename_lang.properties
/>

Specifies how to translate messages found in menu item label, toolBar button toolTip, template name, elementTemplate name, css name, binding menu item label, etc.

Localizing configuration files works as follows:

  1. The location attribute points to a Java™ property file. XHTML example:

    <translation location="xhtml_en.properties" />
        ...
      <item label="Pre_view" icon="../common/icons/Refresh16.gif"
            command="xhtml.preview">
        <accelerator code="F5" />
      </item>
    </menu>
        ...

    Where xhtml_en.properties contains:

         ...
    preview=Pre_view
    convertToI=Convert to i
    convertToB=Convert to b
         ...

    The location URL specifies:

    • The reference language of the configuration file: a two-letter lower-case ISO code. In the above example: en.

    • A unique resource name used to find translations to other languages. In the above example: xhtml. More on this below.

    The reference property file is only used to map messages to message IDs. Example: message "Convert to i" has ID "convertToI".

  2. If, for example, XXE is started using a French locale, a property file called xhtml_fr.properties:

    • is searched in the same directory as the reference property file;

    • OR, if this file is not found there, this property file is searched as a resource using the CLASSPATH. That is, xhtml_fr.properties is supposed to be contained[10] in a jar file found in the CLASSPATH.

    For performance reasons, language variants such CA in fr-CA are not supported.

  3. For the localization to work, the translated property file must refer to the same IDs as those found in reference property file.

    For example, xhtml_fr.properties contains:

         ...
    preview=Prévisualiser
    convertToI=Convertir en i
    convertToB=Convertir en b
         ...


[10] Directly contained, and not contained in a ``folder''. That is, "jar tvf foo.jar" must display xhtml_fr.properties and not foo/bar/xhtml_fr.properties.