Nothing Special   »   [go: up one dir, main page]

Page MenuHomePhabricator

Basic support for block templates in Section translation
Open, HighPublic

Description

As part of the support for templates in Section Translation (T275374), we want to provide basic support to block templates (infoboxes and other templates displayed as a separate paragraph).

Overview - mvp.png (768×1 px, 139 KB)

The key aspects to support are:

  • Highlight the whole template as a unit.
  • Show a specific template card with information and options. These will be based on the availability of the template and the parameter mappings in the target language.
  • Support editing the template using the standard editor with the "original" panel showing the source contents on top.

Highlight

Block templates should get highlighted as a unit when they become selected in the same way that sentences do. The interaction and styling should be consistent with those: taping them or moving to the previous or next element should move the highlight sequentially from sentences and templates in the order they appear in the article.

Template card

A custom card will replace the card proposing a translation. For templates, the contents fo the template are not shown translated due to the limited space. Instead, the following is shown:

  • Source template name with a template icon.
  • Suggested template with an option to edit it and an indicator communicating the parameter mapping.
    • If there is no equivalent template, a message indicating so will be shown.
  • Option to use a different template instead. This will open the dialog to insert a new template to replace the source one with it.

Template card.png (768×1 px, 69 KB)

Mapping success

The template card communicates the degree to which the template can be automatically transferred to the target language. It will cover the following cases:

  • No equivalent template. Wikidata shows no equivalent template for the source template.
  • No parameters match (for templates with parameters).
  • Parameters matching (indicating how much).

The percentage used to fill the circle will consider both, the parameters with data from the source template that can be mapped and the mandatory parameters form the target template that remain to be filled. For example, a
The formula for calculation could look similar to this:

success_percentage = source_filled_parameters_successfully_mapped / (source_filled_parameters + target_mandatory_empty)

For example, given a source template with 20 possible parameters where 10 are filled with data, if 6 parameters can be mapped to the target template and there are 2 mandatory parameters in the target template that cannot be filled, the circle will be 50% filled (6/(10 + 2)). This will give a sense of the pending work to be done for completing the translation of the template.

Especial consideration is needed for the cases where the source template has no filled parameters (or no parameters at all):

  • A source template with no parameters filed will be represented as 100% completed if there are no mandatory parameters unfilled in the target template.
  • A source template with no parameters filed will be represented as 0% completed if there are mandatory parameters unfilled in the target template.

Mapping.png (768×1 px, 73 KB)

Layout, sizing and styling details

Template card Layout.png (768×1 px, 87 KB)

Template editor

For the initial support, the standard Template editor of Visual editor will be reused when editing a template.
The "Original" panel will be added on top as with regular sentence editing to show the contents of the source template.

The contents of the source template will be displayed as key value pairs one after the other with the parameter name in bold above the value.

Template editor - mvp.png (768×1 px, 43 KB)


Until the current ticket is completed, we may want to hide the block templates (T294066).

Follow-up tickets will cover additional features not included in the scope of the current one:

  • Additional explanations when taping on the template mapping symbols (T295545)
  • Keeping the original panel in sync with the field selected in the template editor
  • Applying MT in the template editor

Event Timeline

Pginer-WMF triaged this task as Medium priority.Oct 29 2021, 3:41 PM
Pginer-WMF created this task.
Pginer-WMF updated the task description. (Show Details)
Pginer-WMF raised the priority of this task from Medium to High.Nov 2 2021, 8:40 AM
ngkountas removed ngkountas as the assignee of this task.
ngkountas subscribed.

Change 741946 had a related patch set uploaded (by Nik Gkountas; author: Nik Gkountas):

[mediawiki/extensions/ContentTranslation@master] SX: Support block template concept inside vuex and pageSection model

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

Change 741951 had a related patch set uploaded (by Nik Gkountas; author: Nik Gkountas):

[mediawiki/extensions/ContentTranslation@master] SX: Remove line breaks from \"fetchSegmentTranslation\" method response

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

Change 742179 had a related patch set uploaded (by Nik Gkountas; author: Nik Gkountas):

[mediawiki/extensions/ContentTranslation@master] SX translator api: Add adaptBlockTemplate method

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

Change 742180 had a related patch set uploaded (by Nik Gkountas; author: Nik Gkountas):

[mediawiki/extensions/ContentTranslation@master] SX: Remove blockTemplateProposedTranslation model

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

Change 742181 had a related patch set uploaded (by Nik Gkountas; author: Nik Gkountas):

[mediawiki/extensions/ContentTranslation@master] SX vuex translateTranslationUnitById action: support block templates

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

Change 742182 had a related patch set uploaded (by Nik Gkountas; author: Nik Gkountas):

[mediawiki/extensions/ContentTranslation@master] SX vuex actions: Adapt block template before applying edit

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

Change 741951 merged by Nik Gkountas:

[mediawiki/extensions/ContentTranslation@master] SX: Remove line breaks from \"fetchSegmentTranslation\" method response

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

Change 745934 had a related patch set uploaded (by Nik Gkountas; author: Nik Gkountas):

[mediawiki/extensions/ContentTranslation@master] CX3 Build 0.1.0+20211210

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

Change 745934 merged by jenkins-bot:

[mediawiki/extensions/ContentTranslation@master] CX3 Build 0.1.0+20211210

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

Change 747543 had a related patch set uploaded (by Nik Gkountas; author: Nik Gkountas):

[mediawiki/extensions/ContentTranslation@master] SX: Create a temporary fix for empty spans with template definition

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

Change 747547 had a related patch set uploaded (by Nik Gkountas; author: Nik Gkountas):

[mediawiki/extensions/ContentTranslation@master] SX suggestions api: Remove slice in fetchPageSuggestions method

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

Change 747543 abandoned by Nik Gkountas:

[mediawiki/extensions/ContentTranslation@master] SX: Create a temporary fix for empty spans with template definition

Reason:

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

Change 741946 merged by jenkins-bot:

[mediawiki/extensions/ContentTranslation@master] SX: Support block template concept inside vuex and pageSection model

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

Change 742179 merged by jenkins-bot:

[mediawiki/extensions/ContentTranslation@master] SX translator api: Add parseTemplateWikitext method

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

Change 742180 merged by jenkins-bot:

[mediawiki/extensions/ContentTranslation@master] SX: Remove blockTemplateProposedTranslation model

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

Change 742181 merged by jenkins-bot:

[mediawiki/extensions/ContentTranslation@master] SX vuex translateTranslationUnitById action: support block templates

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

Change 742182 merged by jenkins-bot:

[mediawiki/extensions/ContentTranslation@master] SX vuex actions: Rerender block template before applying edit

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

Change 754807 had a related patch set uploaded (by Santhosh; author: Santhosh):

[mediawiki/extensions/ContentTranslation@master] CX3 Build 0.1.0+20220118

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

Change 754807 merged by Santhosh:

[mediawiki/extensions/ContentTranslation@master] CX3 Build 0.1.0+20220118

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

Change 841170 had a related patch set uploaded (by Nik Gkountas; author: Nik Gkountas):

[mediawiki/extensions/ContentTranslation@master] SX Block templates support: Add mapping indicator

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

Change 841169 had a related patch set uploaded (by Santhosh; author: Nik Gkountas):

[mediawiki/extensions/ContentTranslation@master] SX UI lib: Add MWCircleProgressBar

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

Change 841169 merged by Nik Gkountas:

[mediawiki/extensions/ContentTranslation@master] SX UI lib: Add MWCircleProgressBar

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

Change 850987 had a related patch set uploaded (by Santhosh; author: Santhosh):

[mediawiki/extensions/ContentTranslation@master] CX3 Build 0.2.0+20221031

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

Change 850987 merged by jenkins-bot:

[mediawiki/extensions/ContentTranslation@master] CX3 Build 0.2.0+20221031

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

Change 841170 merged by jenkins-bot:

[mediawiki/extensions/ContentTranslation@master] SX Block templates support: Add mapping indicator

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

Change 853935 had a related patch set uploaded (by Santhosh; author: Santhosh):

[mediawiki/extensions/ContentTranslation@master] CX3 Build 0.2.0+20221107

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

Change 853935 merged by jenkins-bot:

[mediawiki/extensions/ContentTranslation@master] CX3 Build 0.2.0+20221107

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