Page MenuHomePhabricator

Gallery always uses user language (as opposed to say content lang)
Open, LowPublic

Description

ImageGallery use appropriate lang.

ImageGallery always uses the user interface language, which sometimes is
bad if the gallery is on a content page via <gallery> or an extension.

I have a patch to fix this, but I'm not sure I like it (attached) So adding to bug for now while i think about it.

This issue is rather minor since it mainly affects the showfilesize
option, which is not triggerable from the <gallery> tag hook,
however some extensions output galleries in content pages too.

what this patch does is:

Add a method to trigger using content language instead, and also
get the language object from parser if parser object is available.

(Would Context something or other be better?)


Version: 1.20.x
Severity: normal

attachment gallerylang.patch ignored as obsolete

Details

Reference
bz38652

Event Timeline

bzimport raised the priority of this task from to Low.Nov 22 2014, 12:59 AM
bzimport added projects: MediaWiki-Parser, I18n.
bzimport set Reference to bz38652.
bzimport added a subscriber: Unknown Object (MLST).
Bawolff created this task.Jul 24 2012, 9:36 PM

did you finish thinking? :P Please push to gerrit if you find it good enough.

I got sidetracked [I'm a bit of a flitty person and have a tendency of doing that], but basically I don't really like it - it seems ugly to me - using lang globals instead of context, and the distinction between parser vs non-parser. OTOH I'm not sure what a better method would be

In which cases it ImageGallery used not in the content? Because, if it's only on special pages, you can just use the page content language (i.e. parser language) because that is the same as the user language on special pages.

(In reply to comment #3)

In which cases it ImageGallery used not in the content? Because, if it's only
on special pages, you can just use the page content language (i.e. parser
language) because that is the same as the user language on special pages.

Also category pages at the bottom of the page. (However in that case it is also not passed a parser object as well.)

(In reply to comment #4)

Also category pages at the bottom of the page. (However in that case it is also
not passed a parser object as well.)

So we might just do: if parser object, use parser language; else use the user language.

(More generally, category pages are a bit troublesome since they are a mix of content and user language, so the page content language for categories is the site language by default though a lot of it is in the user language...)

sumanah wrote:

about to mark patch obsolete, removing tags.

sumanah wrote:

Comment on attachment 10884
ImageGallery use appropriate lang.

Author said "basically I don't really like it".

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptSep 14 2015, 11:12 PM
Restricted Application added a project: Multimedia. · View Herald TranscriptOct 13 2017, 11:00 PM
Ramsey-WMF moved this task from Untriaged to Tracking on the Multimedia board.Oct 13 2017, 11:02 PM