Page MenuHomePhabricator

Wikibase UI API calls should request a specific errorformat and uselang
Closed, ResolvedPublic

Description

Problem:

While investigating T170424 I deep dove (description at T170424#5802420) and found that most of our UI calls to the API are probably using the backward compatibility layer.
In order to solve T170424 and get more relevant and translated errors to our users we should specify an errorformat so that the newer code for error output in the MediaWiki API is used.

Example:

New format : https://test.wikidata.org/w/api.php?action=wbparsevalue&format=json&parser=globecoordinate&values=%1F36&options=%7B%22lang%22%3A%22de%22%7D&errorformat=plaintext&uselang=de

Old Format: https://test.wikidata.org/w/api.php?action=wbparsevalue&format=json&parser=globecoordinate&values=%1F36&options=%7B%22lang%22%3A%22de%22%7D&uselang=de

Look at the first error to appear in the JSON output

Acceptance criteria:

  • All Wikidata / WMDE owned UI code calling APIs should specify an errorformat and a uselang parameter

Related Objects

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

Just uselang should be fine IMHO, any reason for adding errorlang?

Just uselang should be fine IMHO, any reason for adding errorlang?

Uselang should indeed be fine :).
I doubt there are any cases where the default en behaviour of the general MediaWiki language in the API processing is needed by the UI... But in theroy could be possible!

Infact, checking back 1 more time uselang is not needed.
Simply passing errorformat= is enough and then the user language is already automatically used without needing to be passed.

Addshore renamed this task from Wikidata UI API calls should request a specific errorformat & uselang / errorlang to Wikidata UI API calls should request a specific errorformat.Jan 14 2020, 8:12 PM
Addshore updated the task description. (Show Details)
Addshore renamed this task from Wikidata UI API calls should request a specific errorformat to Wikibase UI API calls should request a specific errorformat.Jan 14 2020, 8:56 PM

Simply passing errorformat= is enough and then the user language is already automatically used without needing to be passed.

…unless the user loaded the current page with a ?uselang parameter different from what’s stored in the session – at least I assume that’s why we already pass uselang to our API requests?

Simply passing errorformat= is enough and then the user language is already automatically used without needing to be passed.

…unless the user loaded the current page with a ?uselang parameter different from what’s stored in the session – at least I assume that’s why we already pass uselang to our API requests?

Sounds like that might be the reasoning

Change 570053 had a related patch set uploaded (by Silvan Heintze; owner: Silvan Heintze):
[wikibase/javascript-api@master] Change wbparsevalue API call to request plaintext errorformat

https://gerrit.wikimedia.org/r/570053

Change 570053 merged by jenkins-bot:
[wikibase/javascript-api@master] Change wbparsevalue API call to request plaintext errorformat

https://gerrit.wikimedia.org/r/570053

Change 570620 had a related patch set uploaded (by Silvan Heintze; owner: Silvan Heintze):
[wikibase/javascript-api@master] Add errorformat parameter to wikibase API requests

https://gerrit.wikimedia.org/r/570620

Change 570907 had a related patch set uploaded (by Silvan Heintze; owner: Silvan Heintze):
[mediawiki/extensions/Wikibase@master] Add errorformat parameter to wikibase API requests

https://gerrit.wikimedia.org/r/570907

Change 570620 merged by jenkins-bot:
[wikibase/javascript-api@master] Add errorformat parameter to wikibase API requests

https://gerrit.wikimedia.org/r/570620

Change 570907 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@master] Add errorformat parameter to wikibase API requests

https://gerrit.wikimedia.org/r/570907

Change 572662 had a related patch set uploaded (by Silvan Heintze; owner: Silvan Heintze):
[wikibase/javascript-api@master] Use message parameters when creating RepoApiError

https://gerrit.wikimedia.org/r/572662

Change 572662 merged by jenkins-bot:
[wikibase/javascript-api@master] Use message parameters when creating RepoApiError

https://gerrit.wikimedia.org/r/572662

Silvan_WMDE renamed this task from Wikibase UI API calls should request a specific errorformat to Wikibase UI API calls should request a specific errorformat and uselang.Feb 20 2020, 8:48 AM
Silvan_WMDE updated the task description. (Show Details)

Change 574708 had a related patch set uploaded (by Silvan Heintze; owner: Silvan Heintze):
[data-values/value-view@master] Add errorformat parameter to wikibase API request

https://gerrit.wikimedia.org/r/574708

Change 574712 had a related patch set uploaded (by Silvan Heintze; owner: Silvan Heintze):
[mediawiki/extensions/WikibaseLexeme@master] Add errorformat parameter to wikibase API request

https://gerrit.wikimedia.org/r/574712

Change 574730 had a related patch set uploaded (by Silvan Heintze; owner: Silvan Heintze):
[mediawiki/extensions/Wikibase@master] Add errorformat parameter to wikibase API request

https://gerrit.wikimedia.org/r/574730

The three related patch sets are needed, as three different projects are affected:

After the first one (574708) has been merged, an additional update of the data-values/value-view submodule will be needed in Wikibase, to activate the changes.

Change 574708 merged by jenkins-bot:
[data-values/value-view@master] Add errorformat parameter to wikibase API request

https://gerrit.wikimedia.org/r/574708

Change 574730 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@master] Add errorformat parameter to wikibase API request

https://gerrit.wikimedia.org/r/574730

Change 574712 merged by jenkins-bot:
[mediawiki/extensions/WikibaseLexeme@master] Add errorformat parameter to wikibase API request

https://gerrit.wikimedia.org/r/574712

Change 574759 had a related patch set uploaded (by Silvan Heintze; owner: Silvan Heintze):
[mediawiki/extensions/Wikibase@master] Update data-values/value-view submodule

https://gerrit.wikimedia.org/r/574759

Change 574759 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@master] Update data-values/value-view submodule

https://gerrit.wikimedia.org/r/574759

Resolving this as it is done, but also noting that T247690 has been created which might relate to the code that was touched in this ticket.