2. Using software other than XMLmind XML Editor to translate the messages
Prev |  | Next

## 2. Using software other than XMLmind XML Editor to translate the messages

As an example, we'll explain how to translate XXE messages to French[4].

1. Use Options → Install Add-ons to install the add-on called "Translate XMLmind XML Editor" then restart XMLmind XML Editor (XXE for short).

   After installing the add-on, the translatexxe command-line utility is found in the `translate_xxe/` subdirectory of one of the two `addon/` directories scanned by XXE during its startup.

   Use `translatexxe.bat` on Windows and the `translatexxe` shell script on Linux and on the Mac.

2. Create a new translation from scratch:

       C:\Prog…\translate_xxe> translatexxe -l fr -e windows-1252 \
           -m fr.txt

   Or update an existing translation. The existing translation is either found in a message Jar (example: `fr_translation.jar`) or in an add-on Zip (example: `fr_translation.zip`, itself containing `fr_translation/fr_translation.jar` and `fr_translation/fr_translation.xxe_addon`):

       C:\Prog…\translate_xxe> translatexxe -l fr -e windows-1252 \
           -m fr.txt \misc\fr_translation.jar

   or:

       C:\Prog…\translate_xxe> translatexxe -l fr -e windows-1252 \
           -m fr.txt \misc\fr_translation.zip

   All the above commands generate a text file. If you intend to use a specialized translation editor[5] rather than a text editor, you may want to generate an XLIFF file. In such case, specify a message file having a "`xlf`", "`xliff`" or "`xml`" extension. Example:

       C:\Prog…\translate_xxe> translatexxe -l fr \
           -m fr.xlf \misc\fr_translation.jar

   Message file `fr.txt` looks like this:

       ++++++++++com/xmlmind/guiutil/Messages.properties
       #################################################

       ### ChooseFile ---

       openFile=Open File
       openFile=

       CF.overwriteFile=Overwrite existing file\n\
       "{0}"?
       CF.overwriteFile=

       ----------com/xmlmind/guiutil/Messages.properties
       ++++++++++com/xmlmind/xml/dtd/Messages.properties

       invalidDefaultValue=default value "{0}" of attribute "{1}" of "{2}" is invalid: {3}
       invalidDefaultValue=

       ----------com/xmlmind/xml/dtd/Messages.properties

   | Beginning of first section: messages contained in the `com/xmlmind/guiutil/Messages.properties` resource file. As a translator, you can ignore these markers.
   | The title of the section is underlined using the '`#`' character. This means that it is recommended to translate the messages found in this section.
   | A comment added by the author of the English messages. As a translator, you can ignore these comments.
   | The ID of the message is "`openFile`".
   | English text of the message having "`openFile`" as its ID.
   | Placeholder for the French text of the message having "`openFile`" as its ID.
   | End of first section.
   | Beginning of next section: messages contained in the `com/xmlmind/xml/dtd/Messages.properties` resource file. Notice that the title of this section is not underlined. This means that this section does not contain messages which are worth translating.

3. Translate all the messages found the “recommended sections” (underlined section title). See Section 3, “How to correctly translate a message”.

       ++++++++++com/xmlmind/guiutil/Messages.properties
       #################################################

       ### ChooseFile ---

       openFile=Open File
       openFile=Ouvrir Fichier

       CF.overwriteFile=Overwrite existing file\n\
       "{0}"?
       CF.overwriteFile=Écraser le fichier existant\n\
       "{0}"?

       ----------com/xmlmind/guiutil/Messages.properties
       ++++++++++com/xmlmind/xml/dtd/Messages.properties

       invalidDefaultValue=default value "{0}" of attribute "{1}" of "{2}" is invalid: {3}
       invalidDefaultValue=

       ----------com/xmlmind/xml/dtd/Messages.properties

   In a text file, in addition to normal characters, it is possible to use the following escape sequences: '`\n`' (newline), '`\t`' (tab), '`\u`XXXX``' (where `XXXX` is the code of a Unicode character in 4-digit hexadecimal notation). '`\u`XXXX``' is especially useful because it's the only way to specify characters not supported by the encoding passed to the `-e` command-line option. Example: '`\u2192`' (right arrow).

4. Test your translation by first converting the text file to a message Jar:

       C:\Prog…\translate_xxe> translatexxe -l fr -e windows-1252 \
           -j ..\addon\fr_translation.jar fr.txt

   Make sure that the message Jar is found inside one of the two `addon/` directories scanned by XXE during its startup. Then start XXE, clear or disable its Quick Start cache [6] and restart XXE.

   If, after restarting XXE, you don't see its user interface translated to the target language, then this means that the locale of your computer (example: `en-US`) does not correspond to the target language (example: `fr`). When this is the case, use Options → Preferences, General section, to change the locale used by XXE from "(default)" to the locale corresponding to the target language (example: "français").

5. Finally convert the text file to a ready-to-deploy add-on Zip:

       C:\Prog…\translate_xxe> translatexxe -l fr -e windows-1252 \
           -p \misc\fr_translation.zip fr.txt

   You may want to specify for the name of the author of the add-on using the `-a` command-line option. A string starting with "`mailto:`" (example: "`mailto:jane@doe.name`") gets a special treatment. A string starting with "`<html>`" and followed by well-formed, properly escaped, XHTML (example: "`<html><a href='http://www.doe.name/'>Jane Doe &amp; al.</a>`") also gets a special treatment. Otherwise, the string is understood to be plain text (example: "`Jane Doe & al.`").

       C:\Prog…\translate_xxe> translatexxe -l fr -e windows-1252 \
           -a "mailto:jane@doe.name" -p \misc\fr_translation.zip fr.txt

[4] This is just en example because XXE has already been translated to French.

[5] Example: OmegaT, a free translation memory application written in Java™.

[6] See Options → Preferences, Advanced|Cached data.

Prev |  | Next
1. Using XMLmind XML Editor to translate the messages | Home | 3. How to correctly translate a message