Page MenuHomePhabricator

[BUG] SVG translate does not recognize labels in text elements rather than tspan
Closed, ResolvedPublic8 Estimated Story PointsBUG REPORT

Description

Current behavior

If you go to https://tools.wmflabs.org/svgtranslate/File:Anatomy_of_the_Human_Ear.svg, you will see -

Screen Shot 2019-02-15 at 11.50.00 AM.png (1×2 px, 857 KB)

Notice that the input labels for several words are missing like Tympanic, Cochlear, Round, vestibular, Semicircular etc. Mostly the first half in a two-part phrase.

Looking at the file code, these phrases are structured as:

<text systemLanguage="en">Tympanic<tspan x="0" y="20">membrane</tspan></text>
...
<text systemLanguage="en">Cochlear<tspan x="0" y="20">nerve</tspan></text>
...
<text systemLanguage="en">Vestibular<tspan x="0" y="20">nerve</tspan></text>
...
<text systemLanguage="en">Semicircular<tspan x="0" y="20">canals</tspan></text>

etc.

It seems like the tool is missing words that appear outside of tspan elements but within text elements.

Expected behavior

All text labels are preserved.

Event Timeline

Niharika created this task.
Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Niharika set the point value for this task to 8.Feb 20 2019, 12:12 AM
Niharika moved this task from Needs Discussion to Up Next (June 3-21) on the Community-Tech board.
MBinder_WMF changed the subtype of this task from "Task" to "Bug Report".Mar 28 2019, 11:11 PM

I notice in the SVG linked in the description that translations inside a <switch> span don't always have the same number of separate text spans (either inside <text> or <tspan> elements).

Here is a part of the SVG (some translations removed):

<switch transform="translate(206 401)" text-anchor="middle">
  <text systemLanguage="fi" x="15">Korvakäytävä</text>
  <text systemLanguage="ta">அவுட்<tspan x="0" y="20">எக்ஸ்பிரஸ்</tspan><tspan x="0" y="40">சேனல்</tspan></text>
  <text>External<tspan x="0" y="20">auditory canal</tspan></text>
</switch>

The default has 2 separate text spans.

When selecting the Tamil translation (either From or To), which has 3 text spans, the final <tspan> ("சேனல்") is missing from the form (although it does appear in the image preview):

anatomy_ear_tamil.png (916×1 px, 81 KB)

Presumably this would prevent anyone editing the 3rd Tamil translation.

When selecting Finnish, which has 1 text span, you see an extra input field:

anatomy_ear_finnish.png (932×1 px, 95 KB)

(This might not be a bad thing)

I am assuming the number of separate input fields in the form is based on the number of separate text spans in the default language.

I wondered if the number of text inputs in the form could be based on the currently selected "From" translation. However, that wouldn't help if the "To" translation requires more input fields (e.g. it needs to be broken over more lines than the original language).

@Niharika @MaxSem Any thoughts?

EDIT: Here's a minimal version of the SVG as a demonstration of what I am talking about https://tools.wmflabs.org/svgtranslate-test/File:Anatomy_of_the_Human_Ear_minimal.svg

I vaguely remember us discussing this and recognizing it as a limitation of the tool which we weren't prepared to tackle yet.

I might be confusing that with something similar.

@dom_walden Good catch! @MaxSem Do you know if we deliberate limit the number of inputs based on number of tspan elements in the default translation and if it's possible to change it based on the number of tspans in the currently selected From translation?

@aezell You're right that we briefly discussed this broader issues of what if the number of translation labels for a language need to be more than the number of existing inputs for it. We decided to not do anything about that at the moment because it's not clear how we can handle that.

/me scratches head super hard. I'm pretty sure that there's no good way to support translating messages with more tspans than in fallback. We therefore don't support such situations.

@dom_walden Good catch! @MaxSem Do you know if we deliberate limit the number of inputs based on number of tspan elements in the default translation and if it's possible to change it based on the number of tspans in the currently selected From translation?

/me scratches head super hard. I'm pretty sure that there's no good way to support translating messages with more tspans than in fallback. We therefore don't support such situations.

@Niharika How should we handle this? I'd done everything I wanted to QA-wise.

Niharika moved this task from Product sign-off to Done on the Community-Tech-Sprint board.

@dom_walden I think we can call this done. We'll hear about it from users if this is a big problem.