Page MenuHomePhabricator

ImageInfo query does not respond to variants
Open, MediumPublic

Description

We are working on allowing users to choose their preferred language variant via the iOS app, which should reflect in all related article calls. I notice regardless of how we send in the Accept-Language header, the response characters are the same for the imageinfo endpoint. Is this ability possible and are we requesting it incorrectly? Here are details pasted, attached files include the captured session with more information if it's helpful.

Request: GET https://zh.wikipedia.org/w/api.php?action=query&format=json&iiextmetadatafilter=License%7CLicenseUrl%7CLicenseShortName%7CImageDescription%7CArtist&iiextmetadatalanguage=zh&iiextmetadatamultilang=1&iiprop=url%7Cextmetadata%7Cdimensions&iiurlwidth=640&prop=imageinfo&rawcontinue=&titles=File%3AThe_Adventures_of_Hello_Kitty_%26_Friends.jpg&converttitles=1
Headers: Accept-Language: zh-hant
Response

{
  "query-continue": {
    "imageinfo": {
      "iistart": "2011-02-14T14:24:38Z"
    }
  },
  "query": {
    "normalized": [
      {
        "from": "File:The_Adventures_of_Hello_Kitty_&_Friends.jpg",
        "to": "File:The Adventures of Hello Kitty & Friends.jpg"
      }
    ],
    "pages": {
      "1521852": {
        "pageid": 1521852,
        "ns": 6,
        "title": "File:The Adventures of Hello Kitty & Friends.jpg",
        "imagerepository": "local",
        "imageinfo": [
          {
            "size": 35370,
            "width": 335,
            "height": 305,
            "thumburl": "https://upload.wikimedia.org/wikipedia/zh/3/31/The_Adventures_of_Hello_Kitty_%26_Friends.jpg",
            "thumbwidth": 335,
            "thumbheight": 305,
            "url": "https://upload.wikimedia.org/wikipedia/zh/3/31/The_Adventures_of_Hello_Kitty_%26_Friends.jpg",
            "descriptionurl": "https://zh.wikipedia.org/wiki/File:The_Adventures_of_Hello_Kitty_%26_Friends.jpg",
            "descriptionshorturl": "https://zh.wikipedia.org/w/index.php?curid=1521852",
            "extmetadata": {
              "ImageDescription": {
                "value": "<p>宣傳海報\n</p>",
                "source": "commons-desc-page",
                "hidden": ""
              },
              "LicenseShortName": {
                "value": "合理使用",
                "source": "commons-desc-page",
                "hidden": ""
              },
              "LicenseUrl": {
                "value": "//zh.wikipedia.org/wiki/File:The_Adventures_of_Hello_Kitty_%26_Friends.jpg",
                "source": "commons-desc-page",
                "hidden": ""
              }
            }
          }
        ]
      }
    }
  }
}

Request: GET https://zh.wikipedia.org/w/api.php?action=query&format=json&iiextmetadatafilter=License%7CLicenseUrl%7CLicenseShortName%7CImageDescription%7CArtist&iiextmetadatalanguage=zh&iiextmetadatamultilang=1&iiprop=url%7Cextmetadata%7Cdimensions&iiurlwidth=640&prop=imageinfo&rawcontinue=&titles=File%3AThe_Adventures_of_Hello_Kitty_%26_Friends.jpg&converttitles=1
Headers: Accept-Language: zh-hans
Response

{
  "query-continue": {
    "imageinfo": {
      "iistart": "2011-02-14T14:24:38Z"
    }
  },
  "query": {
    "normalized": [
      {
        "from": "File:The_Adventures_of_Hello_Kitty_&_Friends.jpg",
        "to": "File:The Adventures of Hello Kitty & Friends.jpg"
      }
    ],
    "pages": {
      "1521852": {
        "pageid": 1521852,
        "ns": 6,
        "title": "File:The Adventures of Hello Kitty & Friends.jpg",
        "imagerepository": "local",
        "imageinfo": [
          {
            "size": 35370,
            "width": 335,
            "height": 305,
            "thumburl": "https://upload.wikimedia.org/wikipedia/zh/3/31/The_Adventures_of_Hello_Kitty_%26_Friends.jpg",
            "thumbwidth": 335,
            "thumbheight": 305,
            "url": "https://upload.wikimedia.org/wikipedia/zh/3/31/The_Adventures_of_Hello_Kitty_%26_Friends.jpg",
            "descriptionurl": "https://zh.wikipedia.org/wiki/File:The_Adventures_of_Hello_Kitty_%26_Friends.jpg",
            "descriptionshorturl": "https://zh.wikipedia.org/w/index.php?curid=1521852",
            "extmetadata": {
              "ImageDescription": {
                "value": "<p>宣傳海報\n</p>",
                "source": "commons-desc-page",
                "hidden": ""
              },
              "LicenseShortName": {
                "value": "合理使用",
                "source": "commons-desc-page",
                "hidden": ""
              },
              "LicenseUrl": {
                "value": "//zh.wikipedia.org/wiki/File:The_Adventures_of_Hello_Kitty_%26_Friends.jpg",
                "source": "commons-desc-page",
                "hidden": ""
              }
            }
          }
        ]
      }
    }
  }
}

One other thing to note - for Restbase calls (like https://zh.wikipedia.org/api/rest_v1/page/mobile-html/Hello_Kitty%E6%84%9B%E6%BC%AB%E9%81%8A), we receive an "Accept-Language" value for the "Vary" key in the response header, which indicates that the response changes depending on what we send in the "Accept-Language" request header. The response for this MediaWiki call does not have "Accept-Language" in its "Vary" response header, so we are possibly calling this improperly. Is there a way to request, for example, a Chinese Traditional character set over Chinese Simplified in the ImageDescription, LicenseShortName values for this imageinfo call?


Note: this might be related to whatever is causing T273557.

Event Timeline

Tsevener created this task.Wed, Feb 17, 8:02 PM
Restricted Application added subscribers: Cosine02, Aklapper. · View Herald TranscriptWed, Feb 17, 8:02 PM
Tsevener triaged this task as Medium priority.Wed, Feb 17, 8:04 PM
Tsevener updated the task description. (Show Details)Wed, Feb 17, 10:03 PM
Tsevener updated the task description. (Show Details)
Tsevener added a project: Platform Engineering.
Shizhao moved this task from Backlog to Apps on the Chinese-Sites board.Thu, Feb 18, 2:37 AM