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.
- 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.
- 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
- 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
- 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
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.
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.