Localizing the Xaira Client

The XAIRA Resource Translator

The Xaira Resource Translator (xrt) is a Windows application program which can be used to translate strings used by the Windows client user interface so that the client can be used in a different locale. download xrt

There are many ways to edit the resources in a Windows executable: the purpose of the xrt is to create an xml database of translations that can be reused as the xaira program is enhanced. This note uses French as an example locale, but any locale available on the processing system can be used.

The program must be executed from the command line with the name of a job file as follows:
xrt -j jobfile
where jobfile is the path to an XML file containing instructions for the xrt process.

This zip contains two demonstration job files that should be adequate for the development of a localized version.

Localization using xrt is carried out as follows:
  • text resources are extracted from the client executable into a modifiable XML resource file
  • the XML resource file created by the first step is modified, using any XML editor, to include translations for each resource
  • the new resource file created by the second step is merged with the client executable to produce a new version of it localized for a specified language.
Steps 1 and 3 in this list are performed by the xrt program, using the jobfiles export.xml and import.xml respectively.
The procedure is as follows:
  • Extract the contents of the zip archive to a new folder called (say) xrt
  • copy the xaira executable (xaira.exe) that you want to localize into this same directory
  • at the command line prompt, type the following commands:
    cd xrt xrt -j export.xml

    This will produce a file xaira-strings.xml in the same directory

  • In the strings file a resource string is represented as in the following example:
    <string><location id1="0002" id2="E110" id3="0000" s1="1" s2="14" type="oldmenu"/><version lang="ENG"><line>Recent File</line></version></string>

    Note: The xrt program groups <string> elements to make it easier to find where they occur. But when processing input, the xrt program simply scans the file for all <string>elements irrespective of their context.

  • It is now necessary, using any XML editor, to find all the strings that have no translated version and supply one. You do this by adding a new <version> element within the <string> element. For example:
    <string><location id1="0002" id2="E110" id3="0000" s1="1" s2="14" type="oldmenu"/> <version lang="ENG"><line>Recent File</line></version> <version lang="FRA"><line>Fichier recent</line></version> </string>

    The three letter code used to identify the language of each version must be a ‘short language name’ (or TLA, as defined here) and must correspond with a locale installed on your system. Note that this is not necessarily an ISO 639 language code: see further this blog entry

    Save this new version of the XML resource file under a different name (say xaira-strings-fra.xml.

  • Edit the file import.xml if necessary so that it specifies the right name for the resource file to be imported, the language to be used, and the right name for the new executable to be generated
  • Now execute the command:
    xrt -j import.xml

    A new executable xaira-fra.exe will be created, using the translated strings for French.

A few strings have special significance to Windows and will resist translation! These should have the comment system in the xrt output.

Please don't expect this to work on anything other than Xaira. It is a quite general program but I have not bothered with a few obscure resource types that Xaira does not use.

The Windows Help system is managed separately, using the Windows HTML Help Editor. However, context-sensitive help strings are exported. Context-sensitive help strings should have a comment associating them with a named dialog.

This version can process accelerator keys. This is intended only as a way of reprogramming combinations like Ctrl-O that invoke the open dialog in English.

There will still be some strings hard-coded: the only way to find all these is to test the translation thoroughly. Please report all strings that could not be translated.

Note finally that the system for internationalisation in Windows is changing. The fashion used to be for an international executable that contained all resource versions and used whichever were appropriate depending on the locale set from the control panel. It is now thought better to supply a resource-only DLL for each supported locale. At some point we shall have to switch to the new mechanism, but we will make sure that existing string files go on working.