Page MenuHomePhabricator

Default alignment of images does not respect the page title language and uses the content language alignment
Closed, ResolvedPublic

Description

In translatable pages, when the language is RTL, the image alignment is not flipped. This leads to an awkward reading experience[1].

Thumbs have "common/shared.css:/* @noflip */ div.tright", which is why the thumb is not flipped. The wanted behaviour is that image alignment on *only* translatable pages is flipped.

[1] https://meta.wikimedia.org/wiki/Wikimedia_Highlights,_May_2012/ar


Version: unspecified
Severity: normal
URL: https://meta.wikimedia.org/wiki/Wikimedia_Highlights,_May_2012/ar

Details

Reference
bz38351

Event Timeline

bzimport raised the priority of this task from to High.Nov 22 2014, 1:08 AM
bzimport set Reference to bz38351.
bzimport added a subscriber: Unknown Object (MLST).

No, that's not the problem. On rtl pages where you use 'thumb', it should output a tleft instead of a tright. Yet on these 'translatable' pages, it adds a tright anyways. That means that something is still in ltr mode while generating the page, instead of in rtl mode.

Linker::makeImageLink2:

621                         if ( $fp['align'] == '' ) {
622                                 $fp['align'] = $wgContLang->alignEnd();
623                         }

This should use the page language from the parser.

Throwing to MediaWiki/Parser. Robin introduced the concept, so maybe he can give some comments.

Yes, I am aware of this, and I wanted to fix this already, however the problem is that Linker functions are static so you'd need to know the Title context somehow.

This particular function is only used in the parser (afaict) and in Incubator extension. Maybe it could be moved to the parser itself.

It is used in the parser, the Incubator extension (where I will likely remove it anyway), and two old(er) extensions in SVN (Wikilog and FCKeditor).

Moving it to the parser would solve it, but the function "belongs" to Linker (I mean, all similar functions are in Linker, Parser doesn't contain such functions). I'd add a parameter to the function where you pass the parser object.

(Relatedly, makeThumbLink2() below it adds magnify-clip.png or magnify-clip-rtl.png based on the wiki content language.. That function could also be changed to use the page content or user language, but in fact I don't see much need for separate images here, IMHO the RTL version can just be removed.)

Marking as FIXED, the change is merged.

I note that I had to purge the original reported page, before the change took affect.