Problem
Goal of this ticket is to understand what are the options available and decide what should be used for the Wikipedia Preview gallery caption information.
Context
We have researched what are the current captions being used with different Wikipedia galleries (such as in iOS, Android, mobile web). We think it's probably best to aim for consistency across galleries.
Here are some examples from the gallery of the Wikipedia article for "ivory":
https://commons.m.wikimedia.org/wiki/File:Cylindrical_Ivory_Casket.jpg
Mobile web | iOS | Android |
https://commons.wikimedia.org/wiki/File:Porphyrogenetus.jpg
Mobile web | iOS | Android |
https://commons.m.wikimedia.org/wiki/File:Vierge_a_l'Enfant_debout.jpg
Mobile web | iOS | Android |
As part of the research to simply understand what are the possible options, note that:
- I'm including the commons.wikimedia.org/wiki/File for each example. In that link, you can see that images have a 'Caption' table (sometime with more than one language) as well as a 'Description' field in the 'Summary' table [1]. We are looking at both of those to understand what's usable and available.
- We currently know that:
- we can obtain description value from Commons with query like this [2]
- we can obtain a caption value from media-list endpoint [3]
- It seems the mobile web gallery is the only one using media-list caption, where as Android and iOS use Commons data
Questions that need to be answered
- What is the caption value we should use for the Wikipedia Preview gallery? Is there a specific logic to follow if more than one value is available (for example, use description if available, otherwise use caption)?
- If we are to use the value from the 'Caption' table (sometime with more than one language) in Commons (as shown in [1]), what is the API query for that? We have reviewed the corresponding documentation [4] but haven't found any information with regard to that caption field
[1]
[2]
https://commons.wikimedia.org/w/api.php?action=query&format=json&iiextmetadatafilter=License|LicenseUrl|LicenseShortName|ImageDescription|Artist&iiextmetadatalanguage=en&iiextmetadatamultilang=1&iiprop=url|extmetadata|dimensions&iiurlwidth=640&prop=imageinfo&rawcontinue=&titles=File:Volc%C3%A1n_Ubinas,_Arequipa,_Per%C3%BA,_2015-08-02,_DD_50.JPG
[3]
https://en.wikipedia.org/api/rest_v1/#/Page%20content/getContent-media-list
[4]
API Documentation: https://www.mediawiki.org/wiki/API:Imageinfo
API Sandbox:
https://www.mediawiki.org/wiki/Special:ApiSandbox#action=query&format=json&prop=imageinfo&meta=&titles=File%3AAlbert%20Einstein%20Head.jpg&iiprop=url%7Cextmetadata&iiextmetadatafilter=Caption%7CLicense%7CImageDescription
Recommended Order
Use this order to determine what content to show for image descriptions:
- Commons captions.
- If that is not available; show the description from Commons.
- If that is not available; show the description from media-list.
Note
For optimization reasons, we are not following the above recommended order and keeping the gallery caption description similar to the iOS app.