Current status
Related patches have been merged. Need to test after deployment.
Implemented the following alternatives to avoid breaking pages by not tagging things which appear in so called plain text context:
- S-CONTROL: T256625: Extend page translation syntax by adding instruction to disable wrapping
- M-VERSIONING: T256868: Versioning and migration for translatable page syntax
Alternatives exploration
GIVEUP: Do not introduce this feature
- Needed for the parent
- Nothing would break
- No additional work needed
Possible solutions to avoid breakage while supporting tagging
S-MAGIC: (Try to) handle the edge cases
- Likely to be brittle, needing to be updated as new cases are discovered
- 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
- Easy to implement
- 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
- Easy to implement
- Pages would still break at some point in absence of an alternative solution
- Closed wikis could not be fixed, so either they break or the variable is kept forever
M-VERSIONING: Syntax version dependent rendering
- Quite a bit of work to implement
- 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
- Allows moving pages gradually
- 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
- also test T259267: Translation page in source language use tvar name instead of tvar content
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.