Page MenuHomePhabricator

CX2: Communicate template exists in the target wiki but mapping could not be completed
Closed, ResolvedPublic

Description

When a template (block or in-line) is adapted, sometimes it is possible to find the equivalent one in the target wiki (thanks to Wikidata), but it may not be possible to map their parameters (because of the lack of templateData, or parameter aliases/names not matching). As part of the effort to communicate adaptation problems with templates (T192271), we want to communicate this better.

For cases where it is not possible to map the parameters, we want to let the user know that the adaptation process was completed only partially.

For example, when translating Tokyo from English to Spanish, adding the infobox with the city information (based on Infobox settlement template) results in an empty template (using Ficha de localidad template), with no warning or further explanation of what went wrong.

Screen Shot 2018-11-14 at 12.10.27.png (574×1 px, 261 KB)

Proposed solution

We want to show a warning when:

  • The target template is found, and no parameter could be transferred to the target template.
  • The target template is found and some parameters could be transferred but there are still empty fields which are marked as mandatory in the target template.

Each case will have a slightly different message:

Empty template

CX-warn-template-block-partial.png (720×1 px, 211 KB)

The target template gets added, and a warning encourage the user to complete the missing parameters:

Incomplete template
The information on the original template could not be transferred to the template in the translation since their structure is a bit different.
Please, edit the template in the translation to fill the missing information.

  • "Learn more" will direct the user to the corresponding point of the user documentation.
  • "Edit template" will open the template editing dialog (in the same way as the "edit" button on the template card would do)

Missing mandatory parameters

CX-warn-template-block-partial-mandatory.png (720×1 px, 236 KB)

Incomplete template
A template was added without some required information.
The missing details could not be obtained automatically from the original template since their structure is a bit different.
Please, edit the template in the translation to fill the missing information.

  • "Learn more" will direct the user to the corresponding point of the user documentation.
  • "Edit template" will open the template editing dialog (in the same way as the "edit" button on the template card would do)

Event Timeline

This require additional adaptation information passed from cxserver. I will work on that part.

Change 475312 had a related patch set uploaded (by Santhosh; owner: Santhosh):
[mediawiki/services/cxserver@master] Templates: If not all mandatory params are mapped, add partial=true

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

I am looking for a real example where cxserver could not map mandatory params.

Pginer-WMF raised the priority of this task from Medium to High.Nov 26 2018, 10:50 AM

Notes for front end changes:

cxserver passes the following additional information about Template adapatation status in data-cx

valueTrueFalse
adaptedif the target template exist and some params are adapted.If target template does not exist OR if none of the source params were mapped, when source has atleast one param to map
partialIf some mandatory source params are not mapped.If all mandatory params mapped
targetExistsIf target template exist.if target template does not exist

Change 475312 merged by jenkins-bot:
[mediawiki/services/cxserver@master] Templates: Pass additional data about adaptation status

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

(1) 'Incomplete template' warning seems to be reserved for those rare cases when a target template matches a source template but cannot be mapped - entirely or partially.

@santhosh It seems that the following case is not possible.

Incomplete template
A template was added without some required information.[..]

If mandatory field(s) are failed to be mapped from the source template, the template will be marked as unavailable. Please correct me if I am wrong.

(2) The matched template exists in Catalan - Template:Infobox settlement, but when translating from English-> Catalan, 'Tokyo', the 'Template unavailable' message is displayed. Is it a plain bug for this specific case or, in this case, mapping was not possible despite that the template is present in the target language?

Screen Shot 2018-12-06 at 4.13.32 PM.png (501×1 px, 104 KB)

@Pginer-WMF - please review the following cases (outside of this task scope) if they require some follow ups:
(3) There are cases when only required parameter in source template is mapped, so a user sees only a partially adopted template without any warning
Screen Shot 2018-12-06 at 4.00.36 PM.png (443×924 px, 46 KB)

(4) Another case of partially adopted template (no additional communication to users).
Screen Shot 2018-12-06 at 3.10.52 PM.png (465×931 px, 79 KB)

(2) The matched template exists in Catalan - Template:Infobox settlement, but when translating from English-> Catalan, 'Tokyo', the 'Template unavailable' message is displayed. Is it a plain bug for this specific case or, in this case, mapping was not possible despite that the template is present in the target language?

My guess is that the issues of T204937 are getting in the way here. T204937 was supposed to remove the template only when the template in the target language was not found, but currently removes the template also when there is not info to map the parameters, which is wrong and is in the process of fixing. @santhosh may correct me or expand on this.

@Pginer-WMF - please review the following cases (outside of this task scope) if they require some follow ups:
(3) There are cases when only required parameter in source template is mapped, so a user sees only a partially adopted template without any warning

Screen Shot 2018-12-06 at 4.00.36 PM.png (443×924 px, 46 KB)

Source and target templates may have a different structure, and there is no way to know if all the parameters in the source are expected to be transferred in the target. For example, a source template may have two parameters (e.g., "name" and "surname"), and the target template just one (e.g., "full name").

For this ticket we are focusing on the cases where there is a high certainty that there is a problem: the target template has mandatory parameters that have not been filled in, or is completely empty. Both provide undesirable results that make the content look broken. Other cases just lead to incomplete information, that the user can expand. We can consider better supporting those cases too in the future (being careful of not increasing false positives), but those would be out of the scope of the current ticket.

Thanks, @Pginer-WMF - I completely agree

For this ticket we are focusing on the cases where there is a high certainty that there is a problem: the target template has mandatory parameters that have not been filled in, or is completely empty

I guess that T204937 is, in fact, a real blocker for this task.

@santhosh - do you know of some cases when mandatory parameters were not mapped but others mapped? Or about the way to trigger it for testing?

Mentioned in SAL (#wikimedia-operations) [2018-12-20T12:48:15Z] <kartik@deploy1001> Finished deploy [cxserver/deploy@16f65cb]: Update cxserver to 803baa4 (T210581, T211889, T144467, T209473) (duration: 04m 42s)

Change 517353 had a related patch set uploaded (by Petar.petkovic; owner: Petar.petkovic):
[mediawiki/extensions/ContentTranslation@master] Communicate templates are not having all parameters mapped

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

@Nikerabbit asks a following question about UI messages on gerrit patch:
What's the motivation for including "a bit" here? They could be completely different.

I think this should be directed towards @Pginer-WMF.

@Nikerabbit asks a following question about UI messages on gerrit patch:
What's the motivation for including "a bit" here? They could be completely different.

A user looking to the empty template added, sees a weird piece of content, and may think that everything went wrong not being willing to edit it.

The motivation for presenting the message in this way is to communicate that the process has been partially successful (we were able to find the equivalent template and add it), and encourage the user to fill the missing parameters. Even if we are not able to map the parameters, we can assume that two equivalent templates about city information may not contain information that is that different. That assumption may be a bit optimistic, but I don't expect to be problematic.

That assumption may be a bit optimistic, but I don't expect to be problematic.

Okay, let's keep that wording then.

Change 517353 merged by jenkins-bot:
[mediawiki/extensions/ContentTranslation@master] Communicate about templates not having all parameters mapped

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

There was an error in the message in the spec for the "missing mandatory parameters" case:

The original message includes the term "reference" where it should be "template".

Original:

Incomplete template
A template was added without some required information.
The missing details could not be obtained automatically from the original reference since their structure is a bit different.
Please, edit the template in the translation to fill the missing information.

Updated:

Incomplete template
A template was added without some required information.
The missing details could not be obtained automatically from the original template since their structure is a bit different.
Please, edit the template in the translation to fill the missing information.

Change 521255 had a related patch set uploaded (by Petar.petkovic; owner: Petar.petkovic):
[mediawiki/extensions/ContentTranslation@master] Fix cx-tools-linter-template-missing-mandatory message

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

Change 521255 merged by jenkins-bot:
[mediawiki/extensions/ContentTranslation@master] Fix cx-tools-linter-template-missing-mandatory message

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

Jpita subscribed.

Tested the best I could in cx2-testing , need to make sure it's working once deployed in prod