== Current status
Implementing alternatives how to avoid breaking pages by not tagging things which appear in so called plain text context. Chosen alternatives are
* S-CONTROL: {T256625}
* M-VERSIONING: {T256868}
=== Alternatives exploration
**GIVEUP: Do not introduce this feature**
* {icon minus-circle} Needed for the parent
* {icon plus-circle} Nothing would break
* {icon plus-circle} No additional work needed
==== Possible solutions to avoid breakage while supporting tagging
**S-MAGIC: (Try to) handle the edge cases**
* {icon minus-circle} Likely to be brittle, needing to be updated as new cases are discovered
* {icon plus-circle} No additional markup, just "Do what I mean"
For example, we could try to detect such translation units using a regular expression like this: `<[^<>]+ (title|alt)=['"]?XXX['"]?` where XXX matches translation unit placeholder(s) in the template.
**S-CONTROL: Add way to control wrapping per-unit basis**
* {icon plus-circle} Easy to implement
* {icon minus-circle} More markup that translation admins need to understand
For example, we could have the following kind of markup: `<abbr title="<translate plain>text</translate>">...</abbr>`. Using a //boolean// attribute the additional markup is rather minimal. Possible names for this attribute are
* (1) plain
* (2) nowrap
==== Possible solutions for making migration easier
**M-VARIABLE: Introduce a configuration variable**
* {icon plus-circle} Easy to implement
* {icon minus-circle} Pages would still break at some point in absence of an alternative solution
* {icon minus-circle} Closed wikis could not be fixed, so either they break or the variable is kept forever
**M-VERSIONING: Syntax version dependent rendering**
* {icon minus-circle} Quite a bit of work to implement
* {icon circle} Would need to keep support for both versions basically forever, but because it is in the code, this is nicer than having to keep an obscure configuration variable around forever
* {icon plus-circle} Allows moving pages gradually
* {icon plus-circle} This solution also works for closed wikis
Implicitly, all currently marked pages would be using version 1. Next time a new page or an existing translatable page is marked for translation, it would be forcefully switched to using version 2. When migrating an existing page, translation admins would see a notice on Special:PageTranslation that would point to a documentation and ask to check if the page has such issues.
== Original report
The idea is if you have a partially translated page:
```
Translated text.
Untranslated text in source language.
```
This should be altered to:
```
Translated text.
<div lang=en dir=ltr>
Untranslated text in source language.
</div>
```
Inline units would use `<span lang=en dir=ltr>Untranslated snippet</span>`.
This has various benefits especially for accessibility.
== QA plan
Affected projects: translatewiki.net, multilingual Wikimedia projects using Translate
Pre deployment: test on MLEB test instance:
* mark a page for translation, make translations, make changes to the page so that the translations become outdated. Inspect the translatable page source to confirm lang and dir attributes are present for untranslated sections. Test with LTR and RTL languages.
* docs: https://www.mediawiki.org/wiki/Help:Extension:Translate/Page_translation_example
Post deployment: monitor for user reports for one week
Potential breakage: tag-wrapping may break rendering of some pages with unexpected markup. Should keep close eye on reports.
== Outcome
Translation page output is tagged correctly with regards to language and writing direction.