The Content Transform team, along with the Editing team and the Language team, is happy to announce that the Translate extension is officially supported in the visual editor, starting with MediaWiki 1.38. This will make it easier for editors and translation administrators to edit translatable pages.
Some context about the Translate extension
Many Wikimedia projects, such as Commons, MediaWiki.org, or WikiSource, as well as some third-party wikis, provide content to their readers in multiple languages. The Translate extension is what makes creating and maintaining multilingual content possible. Editors can mark regions of a wiki page as translatable by delimiting them with <translate>…</translate> tags. The translatable content is then split into smaller chunks by a translation administrator, with the help of automated tools. These smaller chunks are finally translated into other languages, and can be updated when the original text is modified.
Before and After
Up until MediaWiki 1.38, contributors were not able to fully edit pages containing translation markup using the visual editor. The Translate extension was not compatible with Parsoid, and hence could not support editing with the VisualEditor extension—in practice, any content between <translate>…</translate> tags would not be editable directly. Editors on such pages would have no other choice but to edit the page as wikitext.
The version of Parsoid that is enabled in MediaWiki 1.38 supports the Translate extension natively. This enables the editing of content between the <translate> tags using the visual editor. The existing guidelines about editing translatable pages remain, but translatable pages should now be mostly editable directly in the visual editor.
… “Mostly” editable, you say?
There’s a caveat. If the content between two <translate> tags is not well-nested, the <translate> range gets expanded in the visual editor to enclose a well-nested range of content.
To give a couple of examples,
* first <translate>list item
* second</translate> list item
would be expanded to
<translate> * first list item * second list item </translate>
because the Translate range encompasses parts of two different list items, and
some '''bold <translate>text'''</translate>
would be transformed to
some <translate>'''bold text'''</translate>
to enclose all the bold text.
These examples are purposefully exaggerated, and the misnestings will typically be more subtle than that. These expanded regions are protected from editing using the visual editor to avoid dirty diffs (unrelated changes to portions of the wikitext which the editor didn’t “touch”) and page corruptions (including in some cases potentially breaking the translation markup) when the edited page is saved and converted back to wikitext. Updates to the linter are planned in the near future to automatically detect and gather those areas that are not editable in the visual editor.
To be able to edit the full page in the visual editor, it is advised to follow the guidelines provided by the Markup examples section of the Page translation administration wiki page, and to split the translation ranges into smaller, well-nested sections if a region is flagged as uneditable.
Feedback, suggestions and bug reports
We have tested the feature and fixed numerous bugs already, but editing translatable pages in the visual editor hasn’t passed the test of real-life content yet: there may still be rough edges. If you encounter an issue, please revert the edit if necessary and fall back to the Wikitext editor. You can file the issue on Phabricator on the Parsoid project, or contact the Content Transform team for feedback or information. Further improvements and bug fixing for this feature are to be expected with MediaWiki 1.39. We are excited to continue to fully support translation and multilingual content on our platform.