Page MenuHomePhabricator

CX2: Don't add block templates to the translation if equivalent template is missing
Open, HighPublic

Description

Templates are not available in all languages, and we want to communicate these issues to the user (T192271). In addition, we want to provide a default behaviour that is useful and creates the least confusion.

Currently, block level templates for which there is no equivalent template in the target wiki get copied over to the translation. For example the Curiosity rover article on English has an Infobox spaceflight template which is missing in Spanish. When translating the Curiosity rover article from English to Spanish, the original English template is added to the Spanish translation (as shown below). The template name is shown in red text without any of the original information being visible, but it can be inspected showing the parameters are filled. This can be confusing and make the tool look broken.

Screen Shot 2018-09-20 at 13.15.54.png (600×1 px, 284 KB)

Proposed solution

When a block template does not have a corresponding template for the target language, it should not be added to the translation. This combined with the warnings for template adaptation (T192271) should lead the user to a less confusing situation and reduce the chances of the wrong template to leak into the translation.

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

  • "Add new template" action will open the new template dialog in order to insert a new template to the translated paragraph, in the same way as if the user accessed the option to add a template from the edit toolbar.

Note that this proposal is only for those cases where we cannot find a corresponding template. If we can find the right template, it will be added to the translation (even if the mapping of all the parameters could not be complete).

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes

Change 472075 had a related patch set uploaded (by Petar.petkovic; owner: Petar.petkovic):
[mediawiki/extensions/ContentTranslation@master] Remove missing block templates

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

Change 472075 merged by jenkins-bot:
[mediawiki/extensions/ContentTranslation@master] Remove missing block templates

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

After doing QA, this ticket should be moved to In progress column to implement "Add new template" action inside an issue card.

Change 473154 had a related patch set uploaded (by Nikerabbit; owner: Santhosh):
[mediawiki/extensions/ContentTranslation@master] ve.ce.CXTransclusionBlockNode: Prevent js error when the model is null

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

Change 473154 merged by jenkins-bot:
[mediawiki/extensions/ContentTranslation@master] ve.ce.CXTransclusionBlockNode: Prevent js error when the model is null

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

Etonkovidova closed this task as Resolved.EditedNov 15 2018, 1:10 AM
Etonkovidova subscribed.

@Pginer-WMF - "Add new template" and "Learn more" options are not displayed on the "Template unavailable" issue card. The template might be added via Insert-Tempalte menu, so for now I am marking this ticket as 'Resolved' (unless you still want these options to be part of the ticket) .

Screen Shot 2018-11-14 at 5.06.39 PM.png (713×1 px, 324 KB)

I tried this in production and the basics are there, but found a couple aspects to improve:

  • The empty paragraph should be editable and focused. Currently, an empty area is generated on the translation paragraph, but the user cannot type immediately there, and the associated issue card is not shown as expanded because the input focus is not in the paragraph. This makes it hard to orient and understand what's going on. The expected result is for the input focus to be in the empty paragraph (similar to when a text paragraph is added with the "No MT option"), which will show the warning card expanded with all the details, and users can just type the content they want to.
  • Keep the target template if there is an equivalent template. The approach described in this ticket was intended for block templates for which the equivalent template does not exist, and only for such case. However, for cases where the equivalent template exists according to Wikidata it seems that the template is also removed currently. I used Tokyo (en -> es) as an example, where the Infobox settlement is available in Spanish among other languages. In such cases we should keep the template (even if the parameters could not be transferred to the target template), for the user to add the details manually. More details about this scenario are covered in T209473: CX2: Communicate template exists in the target wiki but mapping could not be completed).

Change 475987 had a related patch set uploaded (by Santhosh; owner: Santhosh):
[mediawiki/extensions/ContentTranslation@master] Remove the template only if target template does not exit

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

Pginer-WMF raised the priority of this task from Medium to High.Dec 5 2018, 10:11 AM

Change 475987 merged by jenkins-bot:
[mediawiki/extensions/ContentTranslation@master] Remove the template only if target template does not exist

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

Change 486204 had a related patch set uploaded (by Petar.petkovic; owner: Petar.petkovic):
[mediawiki/extensions/ContentTranslation@master] Put "Add new template" button inside missing block template issue card

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

Change 488068 had a related patch set uploaded (by Petar.petkovic; owner: Petar.petkovic):
[mediawiki/extensions/ContentTranslation@master] Use empty paragraph for unadapted block templates

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

Change 486204 merged by Nikerabbit:
[mediawiki/extensions/ContentTranslation@master] Put "Add new template" button inside missing block template issue card

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

@Petar.petkovic are we stuck on reviews here?

While it's true that the patch haven't got much reviews, the patch is causing some problems with saving user edits when block template is missing and that part needs to be fixed before merging.

Change 488068 had a related patch set uploaded (by Nikerabbit; owner: Petar.petkovic):
[mediawiki/extensions/ContentTranslation@master] Use empty paragraph for unadapted block templates

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

There seems to be some issues identifying and distinguishing the cases of templates not being found vs. templates being found but not filled. I created a separate ticket (T224437: Incomplete template adaptation presented as missing) but this may be relevant for the current one too.

Patch for this ticket is in progress for a long time because there are transaction problems when missing block template is replaced with empty paragraph and user starts typing. @Esanders could you take a look to see what the problem is?

JTannerWMF moved this task from To Triage to Needs Discussion/Analysis on the VisualEditor board.
JTannerWMF subscribed.

Adding this to our board for visibility

So what you approach is trying to do is take an infobox, e.g. <table typeof="transclusion">...</table> and parse this as a paragraph-like node. However on the first parse you want to ignore the contents of the <table> so you disallowed the paragraph from containing any child nodes. The problem with this approach is it doesn't work for subsequent parses, i.e. when the document is written to/read from the database. You now have <p typeof="unadapted-transclusion"> which will use the same toDomElements/toDataElements paths, and so try to throw away the contents.

I think you have two options:

  1. Implement this logic on the server and throw away infobox contents before it even gets to the client.
  2. Have the initial toDataElements return a different type of node. This may still not work as I'm pretty sure the converter looks at what node type it gets back, and the proceeds to use the rules associated with that type (e.g. if you return a paragraph, it will parse the contents as a paragraph).

Change 488068 abandoned by Petar.petkovic:
Use empty paragraph for unadapted block templates

Reason:
Need to explore different approaches

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

Removing our tag as it seems the Language team got a desired response.