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).
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.
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.
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.
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.
Layout, sizing and styling details
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.
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