Page MenuHomePhabricator

Wikilambda fetch fails to correctly filter languages and provide fallbacks
Closed, ResolvedPublicBUG REPORT

Description

What happens?:
When calling the wikilambda_fetch api, and specifying a language only the 'object label' value is language filtered / fallback language provided. All of an objects key labels are returned with all languages available and no language fallback functionality is provided.

Example
I will provide an example to make things clearer using this api call: https://www.wikifunctions.org/wiki/Special:ApiSandbox#action=wikilambda_fetch&format=json&zids=Z7&language=en-gb&formatversion=2.

When you call wikilambda_fetch on the object Z7 with language set to en-gb, it first returns a single object label which in this case is "Function call" and is returned with the language object "Z1199" (British english) when Z7 does not have any en-gb values entered so this is a fallback to the en label value. This all works as expected.

However, when you look at the key labels that it returns, all language key labels which have been entered are provided instead of just a single result. And beyond this there is no en-gb (Z1199) object returned so there has been no fallback to en returned (In this case the en (Z1002) value of "function" has been returned separately).

It is therefore impossible to get the object key label in en when the language is set to en-gb since there is no connection between Z1199 & Z1002 provided making it impractical to manually create a fallback user side.

Event Timeline

Jdforrester-WMF moved this task from To triage to Backlog on the Abstract Wikipedia team board.

Change #1015320 had a related patch set uploaded (by Genoveva Galarza; author: Genoveva Galarza):

[mediawiki/extensions/WikiLambda@master] Fix language filtering for zobject fetching APIs (public and private)

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

Jdforrester-WMF changed the task status from Open to In Progress.Mar 28 2024, 2:12 PM
Jdforrester-WMF moved this task from Backlog to In Progress on the Abstract Wikipedia team board.

Change #1015320 merged by jenkins-bot:

[mediawiki/extensions/WikiLambda@master] Fix language filtering for zobject fetching APIs (public and private)

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