Extract SVG

10 views
Skip to first unread message

Manuel Souto Pico

unread,
Mar 21, 2022, 12:07:06 PM3/21/22
to okapi-users
Dear all,

I am trying to prepare an XLIFF file out of SVG, but to no avail. Could someone please tell me what I'm doing wrong?

This is a simplified version of the source file:

<?xml version="1.0" encoding="UTF-8"?>
<svg width="250" height="40" viewBox="0 0 250 40"
xmlns="http://www.w3.org/2000/svg" version="1.1">
<style>
<![CDATA[
text{
font: 20px Verdana, Helvetica, Arial, sans-serif;
}
tspan{
fill: red;
font-weight: bold
}
]]>
</style>
<text x="15" y="30">
You are <tspan>not</tspan> a banana
</text>
</svg>

This is the filter I'm using (okf_xml):

<?xml version="1.0" encoding="UTF-8" standalone="no"?><its:rules xmlns:its="http://www.w3.org/2005/11/its" xmlns:itsx="http://www.w3.org/2008/12/its-extensions" xmlns:okp="okapi-framework:xmlfilter-options" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.0">
 <!-- See ITS specification at: http://www.w3.org/TR/its/ -->
<its:translateRule selector="//style" translate="no"/>
<its:translateRule selector="//text" translate="yes"/>
<its:withinTextRule selector="//tspan" withinText="yes"/>
</its:rules>

This is what I would expect:

<?xml version="1.0" encoding="UTF-8"?>
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:okp="okapi-framework:xliff-extensions" xmlns:its="http://www.w3.org/2005/11/its" xmlns:itsxlf="http://www.w3.org/ns/its-xliff/" its:version="2.0">
<file original="markup_inline.svg" source-language="en" target-language="fr" datatype="xml">
<body>
<trans-unit id="1:1">
<source xml:lang="en">You are <g id="1">not</g> a banana</source>
<target xml:lang="fr"></target>
</trans-unit>
</body>
</file>
</xliff>

This is what I get:

<?xml version="1.0" encoding="UTF-8"?>
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:okp="okapi-framework:xliff-extensions" xmlns:its="http://www.w3.org/2005/11/its" xmlns:itsxlf="http://www.w3.org/ns/its-xliff/" its:version="2.0">
<file original="markup_inline.svg" source-language="en" target-language="fr" datatype="xml">
<body>
<trans-unit id="1:1">
<source xml:lang="en">text{ font:</source>
<target xml:lang="fr"></target>
</trans-unit>
<trans-unit id="1:2">
<source xml:lang="en">20px Verdana, Helvetica, Arial, sans-serif; } tspan{ fill: red; font-weight: bold }</source>
<target xml:lang="fr"></target>
</trans-unit>
<trans-unit id="2:1">
<source xml:lang="en">You are</source>
<target xml:lang="fr"></target>
</trans-unit>
<trans-unit id="3:1">
<source xml:lang="en">not</source>
<target xml:lang="fr"></target>
</trans-unit>
<trans-unit id="4:1">
<source xml:lang="en">a banana</source>
<target xml:lang="fr"></target>
</trans-unit>
</body>
</file>
</xliff>

Thanks in advance.
Cheers, Manuel

Manuel Souto Pico

unread,
Mar 21, 2022, 4:31:03 PM3/21/22
to okapi-users
To answer my own question, it seems I needed a namespace (not sure why):

<?xml version="1.0" encoding="UTF-8" standalone="no"?><its:rules xmlns:its="http://www.w3.org/2005/11/its" xmlns:itsx="http://www.w3.org/2008/12/its-extensions" xmlns:okp="okapi-framework:xmlfilter-options" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.0">
<its:translateRule selector="//svg:style" translate="no"/>
<its:translateRule selector="//svg:text" translate="yes"/>
<its:withinTextRule selector="//svg:tspan|//svg:span" withinText="yes"/>
<okp:options escapeGT="yes" escapeQuotes="no" inlineCdata="yes"/>
</its:rules>
Reply all
Reply to author
Forward
0 new messages