I'm trying to use itstool to translate some attributes from a XML file like this one:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE dlg:window PUBLIC "-//OpenOffice.org//DTD OfficeDocument1.0//EN" "dialog.dtd">
<dlg:window xmlns:dlg="http://openoffice.org/2000/dialog" xmlns:script="http://openoffice.org/2000/script" dlg:id="settings" dlg:left="106" dlg:top="80" dlg:width="283" dlg:height="214" dlg:closeable="true" dlg:moveable="true" dlg:withtitlebar="false">
<dlg:bulletinboard>
<dlg:textfield dlg:id="token" dlg:tab-index="9" dlg:left="48" dlg:top="42" dlg:width="216" dlg:height="40" dlg:multiline="true"/>
<dlg:text dlg:id="label1" dlg:tab-index="0" dlg:left="5" dlg:top="25" dlg:width="40" dlg:height="14" dlg:value="Save path" dlg:align="right" dlg:valign="center"/>
<dlg:text dlg:id="label5" dlg:tab-index="7" dlg:left="5" dlg:top="190" dlg:width="40" dlg:height="14" dlg:value="URL" dlg:align="right" dlg:valign="center"/>
</dlg:bulletinboard>
</dlg:window>
The translatable part here is dlg:value
.
For now, the rule I tried, that doesn't select any sentence to translate is:
<?xml version="1.0"?>
<its:rules xmlns:its="http://www.w3.org/2005/11/its" version="1.0">
<its:translateRule selector="//dlg:text/@value" translate="yes"/>
</its:rules>
Seems my xpath selector is incorrect here.
EDIT: The problem seems to come from the namespace dlg
here.
Thanks to both @alejandro and @kjhughes this problem is solved.
I had to declare the namespace (used with the colon in dlg:text
) in the header of the ITS rule.
<?xml version="1.0"?>
<its:rules xmlns:its="http://www.w3.org/2005/11/its" version="1.0"
xmlns:dlg="http://openoffice.org/2000/dialog">
<its:translateRule selector="//dlg:text/dlg:@value translate="yes"/>
</its:rules>