Page MenuHomePhabricator

[BUG] text element not recognised
Closed, DuplicatePublicBUG REPORT

Description

What is the problem?

The text elements in the svg Herzlinie.svg in wikicommons (https://commons.wikimedia.org/wiki/File:Herzlinie.svg) are not recognized. Therefore I translated it by hand. The tool also did not recognized it after I added the translation.
If this is the intended behavior it would be helpful if there is a description of the conditions for the tool to be used. e.g. which tags should not be used. Maybe the g tag is part of the problem.

Steps to reproduce problem
  1. open https://cmmons.wikimedia.org/wiki/File:Herzlinie.svg
  2. click on the plus sign in front of "This SVG file contains embedded text that can be translated into your language, using an SVG supportive editor (like XML or text). For more information see: About translating SVG files."

or go directly to https://tools.wmflabs.org/svgtranslate/File:Herzlinie.svg

  1. Message: "This file does not have any labels available for translation. Please pick another image. "

Expected behavior:
Recognition of the two embedded languages German and English.

Observed behavior:
Error Message: "This file does not have any labels available for translation. Please pick another image. "

Environment

Operating system:
Windows 10 1903
Browser:
Google chrome Version 76.0.3809.100 (Offizieller Build) (64-Bit)
Wiki(s):
Editor, if applicable:
https://tools.wmflabs.org/svgtranslate/File:Herzlinie.svg

Screenshots (if applicable):

Translation Tool failed.png (1×3 px, 249 KB)

Event Timeline

Restricted Application changed the subtype of this task from "Task" to "Bug Report". · View Herald TranscriptAug 24 2019, 3:34 PM
Restricted Application added a subscriber: Aklapper. · View Herald Transcript

Bug hunting is made tedious by the inability to flush the tool's cache. The file must be uploaded to Commons to run the tool, so I've been overwriting the original file and overwriting Test.svg to do tests. After two tests, I need to wait half a day. I did not want to upload a bunch of spurious files just to test ideas.

I made several changes to the SVG file to try to find the bug. After some changes, the SVG Translate Tool would offer one line of text, which happened to the be just the second tspan in a text element; the first tspan was lost. Downloading the SVG from the tool and then looking at it showed data corruption. All three of the switch elements looked the same and had no significant content. Interestingly, the first switch had tspan elements (the source SVG does not have any tspan elements there) and the wrong` class` attribute. It looked the tool was conflating.

I tried assigning id attributes to see if the switch elements would differentiate, but that did not work.

The SVG file has a style element Within that style element were some rules with id selectors:

#middleMarker { fill: red; }
#Person { stroke: black; }

Removing those CSS rules (but leaving the other CSS rules intact) allows the SVG Translate Tool to work on the file.

Adding back the #middleMarker rule causes the SVG Translate Tool to fail (it offers only one translation line and shows "$1 $2" strings).

There is some interaction with CSS id rules and other parts of the translation tool. Perhaps both use the same object name for different purposes.

The workaround is to avoid using CSS id rules.

Bug hunting is made tedious by the inability to flush the tool's cache. The file must be uploaded to Commons to run the tool, so I've been overwriting the original file and overwriting Test.svg to do tests. After two tests, I need to wait half a day. I did not want to upload a bunch of spurious files just to test ideas.

Note that there is a staging installation of the tool at https://tools.wmflabs.org/svgtranslate-test/ which uses Beta Commons and so you can upload as many test files as you want. Doesn't get around the annoying cache issue though (I think); we should add a purge option!

possibly same issue as T221382 which identifies CSS selectors as a problem and points to a discrepancy in appConfig.translations

Problem was traced to using CSS ID selectors.

Closing this issue as a dup of T221382.