Page MenuHomePhabricator

CX2: Better support for Wikidata-based templates
Open, MediumPublic


Wikidata-based templates get their information from Wikidata instead of using local parameters. This reduces duplication making content easier to maintain. Based on the feedback from a translator, it seems that Wikidata-based templates are commonly used in Catalan Wikipedia. Editors can just add {{infotaula persona}} without any parameters on Uma Thurman page and get an infobox full of data extracted from Wikidata.

When translating an article with Content Translation the tool tries to map the source parameters to the target template. For the case of Wikidata templates this means that some parameters may be overriden by the local information that was added in the translation process. In these cases, it would be preferred for Content Translation to just add the Wikidata-based template without any parameters.

To properly support templates that use Wikidata:

  • One of the challenges to investigate is whether it is feasible to identify which templates are Wikidata-based in order to apply a custom strategy of adaptation (i.e., not adding parameters). This may require support in TemplateData (T69659)
  • Template based on Wikidata should render all the parameters that are coming from Wikidata in CX, in the same way as it will appear when article is published. This may require RESTBase-API support for Wikidata id

As shown in the example below (tested by translating "Uma Thurman" from English to Catalan in production), currently parameters from the source template are added to the translation (there is also a separate issue making parameters not being properly adapted, T199308):

Screen Shot 2018-07-11 at 11.47.40 2.png (511×1 px, 329 KB)

Screen Shot 2018-07-11 at 11.48.52.png (265×649 px, 50 KB)

Event Timeline

@Amire80 showed me a scenario in hewiki where this functionality may be important.

In order to support this we need:

  1. The Qid of the page being translated (this can be easily achieved based on the Qid of the source page being translated, if you dont already know it one way to get it is api.php?action=query&prop=pageprops&titles=SOURCE_PAGE&ppprop=wikibase_item)
  2. You need RESTBase-API support, in /transform/wikitext/to/html (or a new function) to support an additional optional wikibase parameter. Normally wikibase ID is derived based on title, but for a yet to be created page there is no Wikibase id (but we do know it because it is translation) [ maybe @mobrovac will have a better idea]

Assuming you have it, whenever user fill template, we use /transform/wikitext/to/html to get the result template, and by providing the Qid all the autofilled parameters will be rendered correctly.

Thanks @Izno this is good idea to use TemplateData. This is already used in some wikis and may be used more widely as more tools that relay on such mapping will be added. Here is JS snippet to heuristically determine whether template use Wikidata:

isUsingWikidata = templatedata.maps && templatedata.maps.wikidata

But it mainly requires more community adaptation. I added a question for cawiki in

Restricted Application changed the subtype of this task from "Deadline" to "Task". · View Herald TranscriptAug 21 2018, 11:19 PM