Page MenuHomePhabricator

Query service does not use language fallback when fetching examples
Open, Needs TriagePublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

  • Open https://query.wikidata.org/
  • Set the interface language to zh-tw
  • Refresh the page to make sure everything is using the right language
  • Open the examples dialog

What happens?:

The examples are displayed in English.

What should have happened instead?:

The examples should be displayed in Chinese (at least the first 15 on https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/zh are translated).

Software version (on Special:Version page; skip for WMF-hosted wikis like Wikipedia):

Other information (browser name/version, screenshots, etc.):

In the code, it first tries to fetch the subpage for the current language, and then falls back to the base page:
https://gerrit.wikimedia.org/g/wikidata/query/gui/+/master/wikibase/queryService/api/QuerySamples.js#39

Using "Special:Mylanguage/Wikidata:SPARQL_query_service/queries/examples" as the page and uselang=zh-tw seems to return the page in Chinese:
https://www.wikidata.org/wiki/Special:ApiSandbox#action=parse&format=json&uselang=zh-tw&page=Special:Mylanguage%2FWikidata:SPARQL%20query%20service%2Fqueries%2Fexamples&redirects=1&prop=text&wrapoutputclass=&disableeditsection=1&disabletoc=1&formatversion=2