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 OptionsInstall 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.properties1
    #################################################2
    
    ### ChooseFile ---3
    
    openFile4=Open File5
    openFile=6
    
    CF.overwriteFile=Overwrite existing file\n\
    "{0}"?
    CF.overwriteFile=
    
    ----------com/xmlmind/guiutil/Messages.properties7
    ++++++++++com/xmlmind/xml/dtd/Messages.properties8
    
    invalidDefaultValue=default value "{0}" of attribute "{1}" of "{2}" is invalid: {3}
    invalidDefaultValue=
    
    ----------com/xmlmind/xml/dtd/Messages.properties

    1

    Beginning of first section: messages contained in the com/xmlmind/guiutil/Messages.properties resource file. As a translator, you can ignore these markers.

    2

    The title of the section is underlined using the '#' character. This means that it is recommended to translate the messages found in this section.

    3

    A comment added by the author of the English messages. As a translator, you can ignore these comments.

    4

    The ID of the message is "openFile".

    5

    English text of the message having "openFile" as its ID.

    6

    Placeholder for the French text of the message having "openFile" as its ID.

    7

    End of first section.

    8

    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), '\uXXXX' (where XXXX is the code of a Unicode character in 4-digit hexadecimal notation). '\uXXXX' 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 OptionsPreferences, 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 OptionsPreferences, Advanced|Cached data.