Adding new languages to the DITA Open Toolkit

Sarah O'Keefe / DITA, LocalizationLeave a Comment

The DITA Open Toolkit comes with support for many languages, but you can always find one that is not yet covered. Fortunately, adding a new language does not require any strange incantations. Actually, that last statement is valid only for languages that are written from left to right—I have not tested the other direction and I do not know whether there are other issues for right to left languages.

This content was originally published in German at Die Redakteuse as “DITA-OT um Sprachen erweitern.” It is reproduced here with permission. Translated by Sarah O’Keefe.

Find the language code

Each DITA topic must specify its language in the xml:lang attribute. There are different resources for the so-called “locale IDs”; for example, here. Let’s assume that I want to add Columbian Spanish, which has a language code of es-co.

Add the language in strings.xml

  1. In the DITA-OT folder, locate the xsl/common directory.
  2. Open the strings.xml file.
  3. Copy and paste the existing entry for Spanish to create a new language entry.
  4. Change the language code and the filename reference as shown here:


<lang xml:lang=”es” filename=”strings-es-es.xml”/>
<lang xml:lang=”es-es” filename=”strings-es-es.xml”/>
<lang xml:lang=”es-co” filename=”strings-es-co.xml”/>

Set up the new language file

  1. Copy one of the existing language files from xsl/common and create a new file, strings-es-co.xml in the same directory.
  2. Translate (or have translated!) the strings in the file into the specified language.

Done!

That’s it. You can now use the new language code in your topics and map files and strings such as “Tip” or “Note” will be localized according to the information in your new string file.>

About the Author

Sarah O'Keefe

Twitter

Content strategy consultant and founder of Scriptorium Publishing. Bilingual English-German, voracious reader, water sports, knitting, and college basketball (go Blue Devils!). Aversions to raw tomatoes, eggplant, and checked baggage.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.