Localizing the interface of a DITA Map to WebHelp Classic output: Adding a new language
To add a new language for WebHelp transformations, you need to create a DITA-OT extension plugin that uses the dita.xsl.messages extension point. The following sample procedure is for adding translation files for the Polish language, but you can adapt it for any language:
- Create a com.oxygenxml.webhelp.localization plugin directory inside the [DITA-OT DIR]/plugins/ location.
-
Create a plugin.xml file inside that
com.oxygenxml.webhelp.localization directory with the
following content:
<plugin id="com.oxygenxml.webhelp.localization"> <require plugin="com.oxygenxml.webhelp.classic"/> <require plugin="com.oxygenxml.webhelp.responsive"/> <feature extension="dita.xsl.strings" file="webhelp-extension-strings.xml"/> </plugin>
-
Create a webhelp-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>
- Copy the WebHelp strings file ([DITA-OT DIR]/plugins/com.oxygenxml.webhelp.classic/oxygen-webhelp/resources/localization/strings-en-us.xml) to your plugin directory, and rename it as strings-pl-pl.xml.
-
In the strings-pl-pl.xml file, change the
@xml:lang attribute on the root element that conforms with the
new language.
<strings xml:lang="pl-PL"> ... </strings>
-
Translate the content of each
<str>
element (make sure to leave the name attribute unchanged).<strings xml:lang="pl-PL"> ... <str name="webhelp.content" js="true" php="false">Polish translation for "Content".</str> <str name="webhelp.search" js="true" php="false">Polish translation for "Search"</str> ... </strings>
-
Copy the common DITA-OT strings defined in the [DITA-OT
DIR]/xsl/common/strings-en-us.xml file. It defines a set
generated text available for HTML based transformations (such as
note
,fig
, andtable
elements). Translate the content of each<str>
element.<strings xml:lang="pl-PL"> ... <str name="webhelp.content" js="true" php="false">Polish translation for "Content".</str> <str name="webhelp.search" js="true" php="false">Polish translation for "Search"</str> ... <str name="Figure">Polish translation for "Figure"</str> <str name="Table">Polish translation for "Table"</str> ... </strings>
- Within oXygen XML Editor, use the Run DITA-OT Integrator transformation scenario found in the DITA Map section in the Configure Transformation Scenario(s) dialog box.
-
In the [DITA-OT DIR]/bin directory of the DITA Open Toolkit, run one of the following scripts, depending on your
operating system:
- Windows: [DITA-OT DIR]/bin/dita.bat --install
- Linux: [DITA-OT DIR]/bin/dita.sh --install