Page MenuHomePhabricator

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

Description

Current behavior

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

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.Feb 15 2019, 9:13 PM
Niharika triaged this task as High priority.
Restricted Application added a project: Community-Tech. · View Herald TranscriptFeb 15 2019, 9:13 PM
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
MaxSem claimed this task.Mar 15 2019, 12:25 AM
MaxSem moved this task from Ready to In Development on the Community-Tech-Sprint board.
MBinder_WMF changed the subtype of this task from "Task" to "Bug Report".Mar 28 2019, 11:11 PM
dom_walden added a subscriber: dom_walden.EditedApr 12 2019, 10:29 AM

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):

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

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

(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

aezell added a subscriber: aezell.Apr 12 2019, 2:27 PM

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 closed this task as Resolved.Sun, May 19, 11:07 AM
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.