Page MenuHomePhabricator

Multilanguage SVG images should be rendered in the wiki's content language
Closed, ResolvedPublicFeature

Description

See https://de.wikipedia.org/wiki/Benutzer:Rezonansowy/Sandbox . This image should display in German, not in my useragent lang (English).


Version: 1.23.0
Severity: enhancement
URL: https://de.wikipedia.org/w/index.php?title=Benutzer:Rezonansowy/Sandbox&oldid=127767323

Details

Reference
bz61649

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 2:54 AM
bzimport set Reference to bz61649.
bzimport added a subscriber: Unknown Object (MLST).

I don't think it follows anything at the moment, just takes the first language from the SVG. You can override with [[File:Multilingual_SVG_example.svg|lang=de]].

(Btw note that this image does not have fallback text so it would not display any text at all if your language does not happen to be one of en, de, es, fr.)

(In reply to Tisza Gergő from comment #1)

I don't think it follows anything at the moment, just takes the first
language from the SVG. You can override with
[[File:Multilingual_SVG_example.svg|lang=de]].

(Btw note that this image does not have fallback text so it would not
display any text at all if your language does not happen to be one of en,
de, es, fr.)

No, its hardcoded en (i think this bug might be a dupe of something)

I generally agree in principle that it should use content lang by default. I would be ok with possibly using userlang on sites like commons that are multilingual, but it would have to be evaluated carefully if that would cause confusion

FYI: I have written svg-sieve a script that does what bug 4688 suggests, select which layers to display, and by extension, bug 16052, select messages in a particular language. See bug 4688.

Bug 58920 points out that the browser implementation of the "lang" option is inconsistent. In theory, embedding an SVG in a page with the "lang" attribute set at top-level would result in the behavior you want. In practice, the browser uses the user-specific preferred language --- so, as bawolff points out in comment 2, the first thing we should decide is which of these semantics we want. Should we use the wiki language or the browser's language?

  • Bug 66041 has been marked as a duplicate of this bug. ***

(In reply to C. Scott Ananian from comment #4)

Bug 58920 points out that the browser implementation of the "lang" option is
inconsistent. In theory, embedding an SVG in a page with the "lang"
attribute set at top-level would result in the behavior you want. In
practice, the browser uses the user-specific preferred language --- so, as
bawolff points out in comment 2, the first thing we should decide is which
of these semantics we want. Should we use the wiki language or the
browser's language?

Definitely the wiki language, to keep the consistency with the rest of the page content.

Another annoying point is you can't set at minimum a fallback or default language. It is always English (if present) so I still can't prefer SVG lang switch.

Aklapper changed the subtype of this task from "Task" to "Feature Request".Feb 4 2022, 12:23 PM

I believe this feature has been working for a couple of years now, so I would close this issue. The feature was needed to make SVG Translate work seamlessly.

Follow the link in the de.Wiki in the task description, and it now displays in German.

TheDJ claimed this task.
TheDJ subscribed.

This is indeed already working

Mention it here as these need to be confirmed:

Does it work properly with:

  • User-selected language variant / Page view language
  • Page language (when different with site language)

@Winston_Sung
This issue is about a wiki page displaying the SVG in the wiki language if that language is available in the SVG. That functionality works.

An explicit user-selected language such as [[File:Foo.svg|lang=de|...] has worked for a long time.

There are other issues such as MultiMedia Viewer and the MW API using the wrong language, but they are distinct issues.

  • User-selected language variant / Page view language
  • Page language (when different with site language)

As tested:

  • It respect page language (when different with site language).
  • It doesn't respect user-selected language variant / page view language, which is specified by ?variant= , user content language variant preference, ?uselang= if is a valid variant of current page language, browser language detection.

@Glrx

User-selected language variant means the ?variant= one, which is different from the |lang= in wikitext.

Here are five cases of a Serbian wiki referencing a multilingual SVG.

The Serbian source references File:First Ionization Energy.svg without a |lang=sr parameter. The SVG file has Latin and Cyrillic Serbian text.

The src attribute used in all five cases is

  • src="//upload.wikimedia.org/wikipedia/commons/thumb/1/1d/First_Ionization_Energy.svg/langsr-500px-First_Ionization_Energy.svg.png

That URL requests generic sr Serbian.

I do not see .../langsr-latn-500px... or .../langsr-cyrl-500px....

To me, seeking specific scripts is a separate issue from this one. The original issue complained about English showing up rather German; that has been fixed.

For the uselang issue, I have some trouble there. I would like to have my user interface language be English, but I may also want to view SVG in different languages while keeping my English UI. Commons does that with uselang and lang. We may want an unspecified lang to default to something based on a specified uselang, but that also seems like a different issue.

To me, seeking specific scripts is a separate issue from this one.

Yes.

Should I file a separate ticket?

Filed T310453 Show SVGs in page view language for language variants if available .