Page MenuHomePhabricator

Wikidata autocomplete breaks with URL ...?uselang=en-US
Open, LowestPublic

Description

For some reason, I ended up with several browser tabs that all had ?uselang=en-US query param. Attempting to add a statement failed to show any suggestions until I manually removed the query param from the URL. Very confusing. I tried it in Chrome (logged in) and Firefox (not logged in), with the same result. There were no other statements on the item when i tried it, but not sure if that's relevant. Setting language to English would reload the page but wouldn't solve the problem.

Repo:

Related Objects

Event Timeline

Yurik renamed this task from Wikidata autocomplete breaks when with URL ...?uselang=en-US to Wikidata autocomplete breaks with URL ...?uselang=en-US.Jan 25 2017, 3:39 AM
Yurik updated the task description. (Show Details)

I can confirm the issue using Firefox. I checked my browser console during the loading of the page and the attempt to add a statement and I don't get any error messages.

thiemowmde triaged this task as Lowest priority.Feb 23 2018, 3:14 PM
thiemowmde moved this task from incoming to needs discussion or investigation on the Wikidata board.
thiemowmde added a subscriber: thiemowmde.

The reason for this behavior can be seen here: https://www.wikidata.org/w/api.php?action=wbsgetsuggestions&language=en-US. There is no language "en-US" in MediaWiki. Most code falls back to the default "en". But the API module that is responsible for suggesting properties does not.

I can see how confusing this is. Unfortunately I don't have an idea for an easy fix. The error message is neither in Wikibase nor in the PropertySuggester, but in the basic MediaWiki core API code.

  • We could try to teach the GetSuggestions.php API module to accept unknown language codes, but that alone would not fix the issue. The API would not fail any more, but still return nothing. It would need to fall back to English, and I don't know if this is a good idea.
  • We could try to validate the language code in the frontend JavaScript code before passing it to GetSuggestions.php. But since core seems to be fine with any string, I don't know how such a validation (against what?) would look like.

Just a note - this can be "achieved" by e.g. clicking wikidata link on openstreetmap.org.