Edit online

Localization

DITA-OT supports more than 40 languages. The full list of supported languages (and their codes) is available here: https://www.dita-ot.org/dev/topics/globalization-languages.

There are two ways to switch the labels to a specific language:
  • Set the @xml:lang attribute on the DITA maps and/or topics root element with one of the supported values (e.g. de, fr-FR, ru, zh-CN).
  • Set the default.language parameter in the transformation dialog box to the desired language code.

You can create language-dependent CSS rules in your customization CSS by adding rules using the :lang pseudo-class (see https://developer.mozilla.org/en-US/docs/Web/CSS/:lang).

Tip: It is recommended that you do this customization on a DITA-OT distribution deployed outside of the Oxygen installation. Otherwise, you will lose the customization when upgrading Oxygen. You can contact the Oxygen support team to ask for the Oxygen Publishing Engine package.
Edit online

How to Customize CSS Strings

Some of the labels come from CSS files located in the DITA-OT-DIR/plugins/com.oxygenxml.pdf.css/css/print/i18n directory. These strings can be overridden directly from a custom CSS stylesheet. Simply identify (by debugging the CSS) and copy the rules that apply on your content and change their values. For example:
*[class ~= "toc/title"][empty]:before {
  content: "Agenda";
}
/* Title of the TOC page */
*[class ~= "toc/title"][empty]:lang(es):before {
  content: "Contenidos";
}
Note: If you want to use a language without a corresponding p-i18n-xx.css stylesheet, follow these instructions:
  1. Copy one of the available stylesheets (located in the DITA-OT-DIR/plugins/com.oxygenxml.pdf.css/css/print/i18n directory) into your CSS customization (other than the English one because it does not have the :lang pseudo-class since it is the default language).
  2. For each rules, replace the :lang(xx) pseudo-class with your expected language code, then replace each property value with the expected label.
Edit online

How to Modify Existing Strings

If the label you want to modify is not available from the CSS, you need to modify the XML strings. The default XML strings are available at the following two locations:
  • DITA-OT-DIR/plugins/org.dita.base/xsl/common
  • DITA-OT-DIR/plugins/com.oxygenxml.pdf.css/resources/localization

To modify the generated text, you need to create a DITA-OT extension plugin that uses the dita.xsl.strings extension point. The following example uses English, but you can adapt it for any language:

  1. In the DITA-OT-DIR\plugins\ folder, create a folder for this plugin (for example, com.oxygenxml.pdf.css.localization).
  2. Create a plugin.xml file (in the folder you created in step 1) that specifies the extension points, your parameter file, and your customization stylesheet. For example:
    <plugin id="com.oxygenxml.pdf.css.localization">
      <require plugin="com.oxygenxml.pdf.css"/>
    
      <feature extension="dita.xsl.strings" file="pdf-extension-strings.xml"/>
    </plugin>
  3. Create a pdf-extension-strings.xml file with the following content:
    <langlist>
      <lang xml:lang="en"     filename="strings-en-us.xml"/>
      <lang xml:lang="en-us"  filename="strings-en-us.xml"/>
    </langlist>
  4. Copy the strings you want to change from the default files to the strings-en-us.xml file, then replace their values:
    <strings xml:lang="en-US">
      <str name="Figure">Fig</str>
      <str name="Table">Array</str>
    </strings>
    Warning: Make sure the string @name attribute remains the same, it is used by the process as a key to retrieve the strings text.
  5. Use the Integrate/Install DITA-OT Plugins transformation scenario found in the DITA Map section in the Configure Transformation Scenario(s) dialog box.
  6. Run the DITA Map PDF - based on HTML5 & CSS transformation scenario.
Edit online

How to Add New Strings

Some strings are not translated in all languages. In this case, they will appear in English. To add a new language for a given string, you need to create a DITA-OT extension plugin that uses the dita.xsl.strings extension point. The following example uses Polish, but you can adapt it for any language:

  1. In the DITA-OT-DIR\plugins\ folder, create a folder for this plugin (for example, com.oxygenxml.pdf.css.localization).
  2. Create a plugin.xml file (in the folder you created in step 1) that specifies the extension points, your parameter file, and your customization stylesheet. For example:
    <plugin id="com.oxygenxml.pdf.css.localization">
      <require plugin="com.oxygenxml.pdf.css"/>
    
      <feature extension="dita.xsl.strings" file="pdf-extension-strings.xml"/>
    </plugin>
  3. Create a pdf-extension-strings.xml file with the following content:
    <langlist>
      <lang xml:lang="pl"     filename="strings-pl-pl.xml"/>
      <lang xml:lang="pl-pl"  filename="strings-pl-pl.xml"/>
    </langlist>
  4. Copy the strings you want to change from the default files to the strings-pl-pl.xml file, then replace their values:
    <strings xml:lang="pl-PL">
      <str name="Continued">(ciąg dalszy)</str>
    </strings>
    Warning: Make sure the string @name attribute remains the same, it is used by the process as a key to retrieve the strings text.
  5. Use the Integrate/Install DITA-OT Plugins transformation scenario found in the DITA Map section in the Configure Transformation Scenario(s) dialog box.
  6. Run the DITA Map PDF - based on HTML5 & CSS transformation scenario.