Collapse AllExpand All

Appendix C. Translating the messages generated by ditac Previous topic Parent topic Child topic Next topic

About this task

The messages generated by ditac (Table of Contents, List of Figures, Chapter, Appendix, etc) are available in English (en), French (fr), German (de), Spanish (es), etc. Now let's suppose that you are routinely authoring Portuguese documents and that you want ditac to also support this language.


  1. Go to the ditac_install_dir/xsl/common/messages/ directory.
    ~$ cd /opt/ditac/xsl/common/messages/
  2. Copy en.xml to pt.xml.
    Note that "pt" is the ISO 639-1 two-letter code of the Portuguese language.
    Country variants of a language are supported too. Example: pt-BR (Brazilian Portuguese). However, when this is the case, make sure that the name of the file containing your messages use lower-case characters. Example: pt-br.xml should be fine, while pt-BR.xml or pt_br.xml would not work.
    /opt/ditac/xsl/common/messages$ cp en.xml pt.xml
  3. Open pt.xml in a text or XML editor and translate to Portuguese all the messages found in this file.
    <?xml version="1.0" encoding="UTF-8"?>
    <messages xml:lang="pt">
      <!-- Task sections -->
      <message name="prereq">Pré-requisito</message>
    For some languages, like CJK languages, you'll have to insert variable %{N} in the localized text corresponding to numbered elements (Chapter, Appendix, Table, Figure, etc). This variable is replaced by the number of the element.
    Japanese example: excerpts of a possible ditac_install_dir/xsl/common/messages/ja.xml:
    <message name="chapter">%{N}</message>
    For the first chapter of the document, this gives "第1章", which means "The 1 Chapter".
  4. Open ditac_install_dir/xsl/common/commonUtil.xsl in a text or XML editor and add string 'pt' at the end of the messageFileNames list:
    <!-- localize ========================================================== -->
    <xsl:param name="messageFileNames" select="'en', 'fr', 'de', 'es', 'pt'"/>
  5. When done, please send us ( your translation (e.g. pt.xml) so we can add to the distribution of XMLmind DITA Converter.