Page MenuHomePhabricator

Allow wikibase to render entities for an arbitrary target language, instead of the user's UI language
Open, LowPublic

Description

Wikibase in many cases relies on the uer's UI language as defined by the RequestContext and $wgLang for output generation, via WikibaseRepo::getUserLanguage().

However, when generating ParserOutput, it also uses ParserOptions::getUserLangObject() - which may be different from the current user's language, particularly when rendering "canonical" output. In that case, the output will use one language for some parts of the output, and the other language for others, which cased T199983: Wikidata showing wrong language for page elements.

The immediate solution for that issue was to disallow caching of such inconsistent output, and hope that it's never actually shown to the user.

The correct solution would be to actually use the language passed to EntityParserOutputGeneratorFactory::getEntityParserOutputGenerator() for all output generation. This would require some service interfaces to be changed, particularly ones that have a target language injected into the constructor, like MessageParameterFormatter.

Event Timeline

Change 449780 had a related patch set uploaded (by Daniel Kinzler; owner: Daniel Kinzler):
[mediawiki/extensions/Wikibase@master] WIP DNM EXP Use parser target language, not user language.

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

Addshore added a project: Wikidata-Campsite.
Addshore moved this task from Incoming to Needs Work on the Wikidata-Campsite board.

Change 449780 abandoned by Addshore:
[mediawiki/extensions/Wikibase@master] WIP DNM EXP Use ParserOption's user language, not global user language.

Reason:

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