Page MenuHomePhabricator

ContentTranslation doesn't adapt templates that are redirects in target wiki
Closed, ResolvedPublic

Description

For example: "Template:Citation needed" is mapped with "ઢાંચો:સંદર્ભ" for Gujarati language and despite of that, CX puts [citation needed] in translation. Also, same happens with en-eo.

Event Timeline

KartikMistry raised the priority of this task from to Needs Triage.
KartikMistry updated the task description. (Show Details)
KartikMistry subscribed.
Arrbee triaged this task as Medium priority.Apr 30 2015, 9:09 AM
Arrbee subscribed.
Amire80 renamed this task from [citation needed] is not adapted. to ContentTranslation doesn't adapt [citation needed].Oct 14 2015, 8:59 AM
Amire80 claimed this task.
Amire80 edited projects, added Essential-Work; removed ContentTranslation-Release6.
Amire80 subscribed.

Assigning to myself to test some time.

santhosh subscribed.

https://gu.wikipedia.org/w/api.php?action=templatedata&format=json&titles=%E0%AA%A2%E0%AA%BE%E0%AA%82%E0%AA%9A%E0%AB%8B%3ACitation+needed&redirects=true

gives

{"pages":{},"redirects":[{"from":"\u0aa2\u0abe\u0a82\u0a9a\u0acb:Citation needed","to":"\u0aa2\u0abe\u0a82\u0a9a\u0acb:\u0ab8\u0a82\u0aa6\u0ab0\u0acd\u0aad"}]}

This is a redirect. The template adaptation code is not taking care of redirect. That is the root cause

santhosh renamed this task from ContentTranslation doesn't adapt [citation needed] to ContentTranslation doesn't adapt templates that are redirects in target wiki.Aug 12 2016, 10:51 AM

I changed the title to reflect the general issue. While analysing I found that getTargetTemplate method in template tool module is unused now. It can be removed

This can be close then.

No, we need to support this cases and adapt them.

There are multiple issues here:
As the partial fix for this patch says ( https://gerrit.wikimedia.org/r/#/c/306188/ )

  • When the template is missing template data and is a redirect like Template:Citation needed in gu.wikipedia, the template mapping will not have 'title' key causing the entire template not mapped. This commit fixes it
  • When the target template does not accept any params, while source template has params, consider the template adaptation successful This also happens in the case of gu.wikipedia citation needed template. In English, this template accepts date parameter, while gu.wikipedia does not accept any params.

With the above fix, the template will start to get adapted, but when published, it wont appear in published article because, in publish module, we are blindly removing <link> tags saying they are useless.

But, the HTML for citation need template in gu wiki is like

<link about="#mwt9" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;સંદર્ભ&quot;,&quot;href&quot;:&quot;./Template:Citation_needed&quot;},&quot;params&quot;:{},&quot;i&quot;:0}}]}" href="./Category:All_articles_with_unsourced_statements" id="mwLw" rel="mw:PageProp/Category" contenteditable="false" typeof="mw:Transclusion"><link about="#mwt9" href="./Category:Articles_with_unsourced_statements_from_December_2011" rel="mw:PageProp/Category" contenteditable="false"><sup about="#mwt9" class="noprint Inline-Template Template-Fact" id="mwMA" style="white-space:nowrap;" contenteditable="false"><span typeof="mw:Entity">[</span><i><a class="cx-link cx-source-link cx-target-link" data-linkid="148" href="વિકિપીડિયા:Citation needed" rel="mw:WikiLink" title="વિકિપીડિયા:Citation needed"><span title="This claim needs references to reliable sources. (December 2011)">citation needed</span></a></i><span typeof="mw:Entity">]</span></sup></span></p>

The template definition is in <link> tag. Removing it makes the whole template a non-template. That need fix too

Change 306188 had a related patch set uploaded (by Santhosh):
Templates: Fixes for inline template adaptation

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

Change 306188 merged by jenkins-bot:
Templates: Fixes for inline template adaptation

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

Verified in production.