Page MenuHomePhabricator

Allow to translate text in a <tspan> element
Closed, DuplicatePublic

Description

What is the problem?

I tried to translate the city names in https://commons.wikimedia.org/wiki/File:Vertical_references_in_Europe.svg to English but it didn't let me. Looking at the SVG source it looks like this:

<text
   xml:space="preserve"
   style="font-size:91.67308044px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Times New Roman;-inkscape-font-specification:Times New Roman"
   x="3886.4937"
   y="2815.1726"
   id="text3908-1-5"
   sodipodi:linespacing="125%"><tspan
     sodipodi:role="line"
     id="tspan3910-7-0"
     style="font-size:122.2307663px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;fill:#000000;fill-opacity:1;stroke:none;font-family:DejaVu Sans;-inkscape-font-specification:DejaVu Sans"
     x="3886.4937"
     y="2815.1726">European Vertical </tspan><tspan
     sodipodi:role="line"
     style="font-size:122.2307663px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;fill:#000000;fill-opacity:1;stroke:none;font-family:DejaVu Sans;-inkscape-font-specification:DejaVu Sans"
     x="3886.4937"
     y="2967.9612"
     id="tspan4231">Reference System (EVRS)</tspan></text>
Steps to reproduce problem
  1. Go to https://svgtranslate.toolforge.org/
  2. type in Vertical_references_in_Europe.svg

Expected behavior: tool lets me translate the text because it's in a <text><tspan> element
Observed behavior: tool doesn't let me translate the file

Event Timeline

Aklapper renamed this task from [REQUEST] let me translate text in a <tspan> element to Allow to translate text in a <tspan> element.Apr 20 2021, 5:49 AM

The text element in the description looks acceptable: one text with single-level tspan elements and no #text.

Confirm that SVG Translate did not offer any translations.

The file had an empty text element in it. I removed that element.

Still fails.

The style elements have a * selector. Perhaps the CSS regex does not expect that?

Put fill="none" in svg element. Remove two CSS * {fill:none;} from style elements.

Still fails, but perhaps the SVG Translate cache has not emptied.

Ach! There is a third style element with a * selector. Removed it.

Still fails. Last test at 2:13 PM. Will wait and try again later.

Looked at third style block more closely. Do not see space issue (T271595). But it has CSS ID selectors!

<style
   id="style3795"
   type="text/css">
/* Default Definitions, can be overridden with the individual style selectors */
g.nationGroup path {fill:inherit;stroke:inherit}
g.nationGroup, path        { fill:#C0C0C0; stroke:white; stroke-width:8; } 
      /* stroke-width was originally at around 4px, but this makes it difficult to see when the image is smaller */
/* Geographic Features */
#ocean {opacity:1;fill:none;fill-opacity:1}
#lakes {opacity:0.4;fill:white;fill-opacity:1;stroke:none;stroke-width:8}

</style>

Therefore, I expect this issue is a duplicate of T221382.

replaced CSS ID selectors with class selectors of IDENTocean and IDENTlakes.

Removed many empty CSS ID selectors in another style element.

SVG Translate now offers translations.

Direct link for SVG Translate: