Page MenuHomePhabricator

Parsoid HTML doesn't show localized SVG thumbnails
Closed, ResolvedPublicBUG REPORT

Description

Look at Parsoid's output below for a localized thumbnail on cswiki.

$ echo "[[Soubor:Global_Temperature_Anomaly.svg|lang=cs|320px|okraj]]" | php bin/parse.php --domain cs.wikipedia.org 
<p data-parsoid='{"dsr":[0,61,0,0]}'><span class="mw-image-border" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"lang","ak":"lang=cs"},{"ck":"width","ak":"320px"},{"ck":"border","ak":"okraj"}],"dsr":[0,61,null,null]}'><a href="./Soubor:Global_Temperature_Anomaly.svg" data-parsoid="{}"><img resource="./Soubor:Global_Temperature_Anomaly.svg" src="//upload.wikimedia.org/wikipedia/commons/thumb/f/f8/Global_Temperature_Anomaly.svg/320px-Global_Temperature_Anomaly.svg.png" decoding="async" lang="cs" data-file-width="1440" data-file-height="1000" data-file-type="drawing" height="222" width="320" srcset="//upload.wikimedia.org/wikipedia/commons/thumb/f/f8/Global_Temperature_Anomaly.svg/480px-Global_Temperature_Anomaly.svg.png 1.5x, //upload.wikimedia.org/wikipedia/commons/thumb/f/f8/Global_Temperature_Anomaly.svg/640px-Global_Temperature_Anomaly.svg.png 2x" data-parsoid='{"a":{"resource":"./Soubor:Global_Temperature_Anomaly.svg","lang":"cs","height":"222","width":"320"},"sa":{"resource":"Soubor:Global_Temperature_Anomaly.svg","lang":"lang=cs"}}'/></a></span></p>

The image resource doesn't have a language specific thumbnail (it has the lang="cs" attribute) whereas the legacy parser uses https://upload.wikimedia.org/wikipedia/commons/thumb/f/f8/Global_Temperature_Anomaly.svg/langcs-320px-Global_Temperature_Anomaly.svg.png. https://cs.wikipedia.org/api/rest_v1/page//Wikipedista:SSastry_(WMF)/Sandbox has this wikitext for testing purposes.

Thanks to @vadim-kovalenko for the investigation.


Original Bug Report

Steps to Reproduce:

  1. Go to "Skleníkový efekt" (permalink) on cswiki.
  2. Trigger preview of "globální oteplování" at the end of the third paragraph (links to Globální oteplování on cswiki).

Actual Results:

  • The preview image (a multilingual SVG file) is displayed with English captions.

Expected Results:

  • The preview image is displayed with Czech (local) captions, just like it's displayed in the linked article.
previewarticle
obrazek.png (383×491 px, 73 KB)
obrazek.png (326×442 px, 52 KB)

This could be related to T208620 but I'm reporting it separate for Page-Previews.
If resolving the other task would also resolve this one, there is no other way to fix this and no need to track them separately, they can be merged.

Event Timeline

Jdlrobson changed the task status from Open to Stalled.Dec 4 2020, 9:40 PM
Jdlrobson added a project: Web-Team-Backlog.
Jdlrobson subscribed.

Yeh this is blocked on T208620

vadim-kovalenko changed the task status from Stalled to In Progress.Dec 28 2021, 1:19 PM

This issue is not about Popups extension but how the Parsoid renders this template.
Compare the article from the description ( it was updated, so I put old revision here ) and Parsoid output. Parsoid outputs English version of an image. When checked src attribute for both versions of a thumbnail, I found that Parsoid missed langcs prefix ( see the shot ). Seems that this prefix crucial in order to set the image localization. Could we address this issue to Parsoid-Rendering team?

thumbnail-multilang.png (1×3 px, 1 MB)

cc: @MSantos , @Jgiannelos

ssastry renamed this task from Page previews don't show localized SVG thumbnails to Parsoid HTML doesn't show localized SVG thumbnails.Jan 25 2022, 4:04 PM
ssastry added a project: Parsoid.