As part of the template translation improvements (T139332), this ticket explores how to provide support the translation of block templates such as infoboxes. This involves providing a way to include/remove them as well as editing them in the context of a translation (allowing to compare source and translated content in a fluent experience).
[[ http://pauginer.github.io/prototypes/translation/templates/index.html | A prototype ]] allows you to try the main concept also captured below:
{F4367691, size=full}
# Design goals
- **Edit as usual.** Templates contain content that users want to translate/adapt. Having an initial translation for it, getting links properly adapted and edit content as rich text is expected when manipulating the content inside a template. That is, the editing support that Content Translation provides should still be available when editing content even if it is part of a template.
- **Fluent editing.** Editing in place without blocking the user contributes to a more fluent experience.
- **User control.** The user should be in charge on deciding which templates to include and how to adapt them.
# Proposed solution
{F4402726}
I'm illustrating a solution in three scenarios:
**Template cannot be adapted**
{F4276653, width=600}
- After adding a section to translate, the translation shows a block indicating that the template was not adapted.
- A template card in the tools panel provides options on how to adapt it:
-- "Keep original template" will keep the source template as is. After publishing, a reminder (guided tour or notification) will encourage the user to adapt the template manually.
-- "Skip template" will remove the template and skip it from being included when publishing.
- The template card may include a link to "translate missing templates" to lead the user towards the process of providing the mapping information for this kind of templates if such process exist (as part of CSX or separate tool).
**Template is adapted**
{F4402882, width=600}
- By default, a block template such as an infobox can be added to the translation as any other paragraph. The equivalent template in the target language will be used and the information will be translated according to the Automatic translation" strategy used by the user (e.g., translated with Apertium or using source text).
- When the template is added to the translation, it becomes in the selected state (notice the blue highlight), and one more click will trigger the editing mode (more on this later).
- A special template card will show the corresponding templates and provide control on the template presence (adapt, keep original or skip).
**Editing a template**
{F4376173, width=600}
- When the template is not the active paragraph, hovering the template will invite the user to edit its contents. Clicking will change the template to the selected mode.
{F4402882, width=600}
- The selected mode provides information and actions at the template level, and provides access to the editing mode.
- The editing mode actions should be accessible though keyboard interactions (delete would change the strategy to "skip template" and enter would go to the editing mode).
- Clicking outside the paragraph will make the template to become unselected.
{F4402911, width=600}}
- Editing mode a layer under the document to edit the internals of the template.
- Template content is presented as a connected list of rich text editable sections with a label. Users can edit their content but not the labels.
- For block templates, the editing mode replaces the rendered template (this is different for inline templates T144004).
- In editing mode, both source and target templates are presented in this tabular format (only target being editable).
- Sections are aligned between source and target templates. The equivalent parameters are shown side by side and editing the target content will make both expand to keep them aligned.
- Only the parameters used in the source will be shown in the target. The target template will have a "View more properties" that will list the remaining parameters for the target template. This allows the user to fill some parameters that do not exist in the source (or were not filled) but are necessary for the target wiki.
- There will be only one template in edit mode at a time. Moving out of the section or editing a different template will restore the template to display mode. Similarly, editing a template inside a template will replace the whole block (the back action can be used to go back to the previous context).