(Go: >> BACK << -|- >> HOME <<)

Page MenuHomePhabricator

CX2: Convert inline templates into text if equivalent template is missing
Closed, ResolvedPublic

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 templates in the source article for which a corresponding templates do not exist in the target wiki, are copied verbatim. For example, the 2nd paragraph of Curiosity (rover) from English into Spanish has the Curiosity Mission Timer template (calculating the number in the "2183 sols" text of the example) which is a template only available in English, but it is copied into the translation as "Plantilla:Curiosity Mission Timer". A similar issue happens for the Time interval template in the same sentence.

Screen Shot 2018-09-28 at 13.17.35.png (381×1 px, 123 KB)

Proposed solution

When an inline template does not have a corresponding template for the target language, it should be added to the translation as a plain text version of the rendered template to avoid losing the information.

It is important to avoid adding HTML tags and attributes since these could pollute the final wikitext. So let's make sure the content is added as plain text. It is preferred to lose the styling (and even some content) in the process, rather than producing dirty wikitext.

The added content will be highlighted as part of the issue card shown for the user to review for the user to review and adjust. (Highlight support is not part of this ticket. Alternatives will be explored in T210600)

CX-warn-template-inline.png (720×1 px, 270 KB)

Message:

Content added as text for unavailable templates
The original article uses templates to structure the content, but some of these do not exist in the destination wiki.
The content from the missing templates has been added as regular text. Make sure to review the result.

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

Change 473723 had a related patch set uploaded (by Santhosh; owner: Santhosh):
[mediawiki/extensions/ContentTranslation@master] Convert inline templates into text if equivalent template is missing

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

The patch which is in review correctly replaces the inline templates of en:Curiosity_(rover) when translating to Spanish.

However, plaintext which replaced the inline template is not highlighted with sentence highlighting.

inline-templates.png (271×848 px, 37 KB)

However, plaintext which replaced the inline template is not highlighted with sentence highlighting.

Fixed that.

image.png (223×511 px, 42 KB)

Supporting the regular highlight is great since it helps to find what is the corresponding content in the source text. In addition to that, I wanted to clarify one part of the spec regarding highlighting:

The added content will be highlighted as part of the issue card shown for the user to review for the user to review and adjust

Here the goal is for the use to know which part of the paragraph was the one affected by the conversion to plain text. Otherwise, users had to waste time moving around the text to figure out which exact content we are referring to.
In order to support this what's proposed is for the plain text generated to be highlighted as long as the yellow marker appears next to the paragraph. That is, this "persistent warning highlight" will only go away when the user marks the warning as resolved. Visually this warning looks like the sentence highlighting but it should be possible to differentiate it internally in case that we decide to change the way we signal warnings.

santhosh removed santhosh as the assignee of this task.EditedNov 28 2018, 8:20 AM
santhosh added subscribers: pau, santhosh.

In order to support this what's proposed is for the plain text generated to be highlighted as long as the yellow marker appears next to the paragraph. That is, this "persistent warning highlight" will only go away when the user marks the warning as resolved. Visually this warning looks like the sentence highlighting but it should be possible to differentiate it internally in case that we decide to change the way we signal warnings.

This is non trivial. Plaintext cannot be highlighted, so we need a wrapper tag around that, define model, ce model for that and then define the interaction for it.
@Pginer-WMF, Either we need to create a new ticket for this and live with what we have now. Or revert the patch and re-address with new scope.

In order to support this what's proposed is for the plain text generated to be highlighted as long as the yellow marker appears next to the paragraph. That is, this "persistent warning highlight" will only go away when the user marks the warning as resolved. Visually this warning looks like the sentence highlighting but it should be possible to differentiate it internally in case that we decide to change the way we signal warnings.

This is non trivial. Plaintext cannot be highlighted, so we need a wrapper tag around that, define model, ce model for that and then define the interaction for it.
@Pginer-WMF, Either we need to create a new ticket for this and live with what we have now. Or revert the patch and re-address with new scope.

Thanks for the input @santhosh. If there are technical complexities, it is ok to complete a first iteration to show the warning and postpone the highlighting part for later.

Regarding the highlight, would it be possible to find some more basic approximation? For example, reusing the usual sentence highlighting mechanism to highlight these cases as soon as they are added (even if hovering something else removes that highlight, or the highlight fades away). Depending on this info we can plan for a more short term basic solution or a more long term sophisticated one.

I removed the highlight requirement from this ticket, and created a follow-up to support a simpler version of it (exploring what's possible with reasonable effort will be part of such ticket): T210600: CX2: Better direct users to in-line templates that were converted to text

Change 473723 merged by jenkins-bot:
[mediawiki/extensions/ContentTranslation@master] Convert inline templates into text if equivalent template is missing

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

I checked the same paragraph of the article translation en-es (wmf.12)- Curiosity (rover) that was used in the task's description.
The paragraph has four templates that are missing in eswiki :

{{'s}}
{{#time:F j, Y}}
{{Curiosity Mission Timer}}
{{time interval|6 August 2012 05:17:57|show=d|disp=raw}}

In the screenshot they are marked in red rectangles in both - the source article ad the target article. With MT translation, two missing articles were marked as not available in eswiki.

Screen Shot 2019-01-11 at 6.55.56 PM.png (465×1 px, 188 KB)

@Pginer-WMF - please confirm that the following is the expected behavior:
(1) In one paragraph two different templates are marked as not available in the target language, but the issue card will show only one warning.
(2) When 'Publish', the paragraph will be published with missing templates as plain text without any additional indication in the published text that some templates are missing. There will be a general warning before publishing - "Publish anyway".

I compared the above with CX1 translation. In CX1, there is a clearer indication what templates are present in the source article and which template are adopted in the target article (in a very pale highlighting). When a user clicks on a highlighted text (the template that it's not available), the card will show the template name in the source language and states the fact that it's missing in the target language:

Screen Shot 2019-01-11 at 6.42.29 PM.png (316×1 px, 153 KB)

Screen Shot 2019-01-11 at 6.43.02 PM.png (348×1 px, 176 KB)

@Pginer-WMF - please confirm that the following is the expected behavior:

Thanks for reviewing this and providing a detailed example.

(1) In one paragraph two different templates are marked as not available in the target language, but the issue card will show only one warning.

Currently we are not able to point to which specific instance the problem occurred, so having just one issue card is ok (especially given that the message is written in plural form). There is a separate ticket (T210600) to do that. As part of the work on that ticket we need to make sure to have one specific issue card for each instance, and I captured it in a comment (T210600#4876689).

(2) When 'Publish', the paragraph will be published with missing templates as plain text without any additional indication in the published text that some templates are missing. There will be a general warning before publishing - "Publish anyway".

The warning shown is intended to encourage users to review the different page issues before publishing. Once the user published we try to produce the final wikitext code as clean as possible, so no further annotations are added. So this is expected behaviour.

Thanks, @Pginer-WMF! Closing the ticket as Resolved - T210600 will address the usability of handling in-line tempaltes.