Page MenuHomePhabricator

Add separate 'language' param to pageterms & entityterms prop, to allow to differentiate from uselang
Closed, ResolvedPublic

Description

For both pageterms & entityterms API, the request language (or uselang) is used to determine which language to return the terms in.

Having a separate API param (as is already the case in some of the other APIs as well) would be convenient to allow differentiation from uselang.
E.g. consider a scenario where the request language (or uselang) is used to find (action=query&generator=search&uselang=en) entities in a certain languages, but print the results in another language (&prop=entityterms&wbetlanguage=fr)

I would imagine this new language param to default to the request language (or uselang), so it would remain perfectly backwards compatible.

Event Timeline

Change 682569 had a related patch set uploaded (by Matthias Mullie; author: Matthias Mullie):

[mediawiki/extensions/Wikibase@master] Add 'language' param to pageterms & entityterms prop

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

Unless there's something problematic about this feature request, I already have a patch for this. We're hoping to be able to leverage this to improve Commons' media search for other languages.

Hey hey @Lydia_Pintscher
In principle this as something to do looks fine to , but probably should land on campsite etc for real review (Looks like @Lucas_Werkmeister_WMDE already gave it an initial look)

Worth noting that a language parameter was suggested, but rejected, when the API module was first introduced: see https://gerrit.wikimedia.org/r/c/mediawiki/extensions/Wikibase/+/611282/4#message-542a6727bc575318493568cade5bd18638daee82 and reply.

Also, we should quickly check if “language” or “lang” as a parameter name is more common in other API modules.

Adding a Structured Data tag, because this feature request came from the Structured Data team, and code review is currently blocked on feedback from the patch author as well.

This comment was removed by Esc3300.

Worth noting that a language parameter was suggested, but rejected, when the API module was first introduced: see https://gerrit.wikimedia.org/r/c/mediawiki/extensions/Wikibase/+/611282/4#message-542a6727bc575318493568cade5bd18638daee82 and reply.

That looks to have been a very soft rejection, simply because there was no practical usecase.
There is one now, however, so I hope we can reconsider this!

Also, we should quickly check if “language” or “lang” as a parameter name is more common in other API modules.

In Wikibase: ModifyTerm, QuerySearchEntities, SearchEntities & SetAliases already have a "language" param. None use "lang", AFAICT.
In core: ApiQueryAllMessages, ApiQueryLangBacklinks, ApiQueryLangLinks & ApiSetPageLanguage have a "lang" param. None use "language", AFAICT.
I'd say consistency with other Wikibase APIs makes most sense here?

Moving back to peer review, as I see a "Done" comment on Gerrit!

Change 682569 merged by jenkins-bot:

[mediawiki/extensions/Wikibase@master] Add 'language' param to pageterms & entityterms prop

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