Wikimedia Blog/Drafts/Brand new template support in Content Translation

From Meta, a Wikimedia project coordination wiki

Title ideas[edit]

Ideally three to ten words, the headline to your piece will show up in social media shares and on the blog's homepage. Try to capture the most interesting part of your piece.
  • Brand new template support in Content Translation
  • ...

Summary[edit]

Content Translation is getting a major new feature: completely re-written support for templates which makes it easy to translate the templates across languages
  • ...

Body[edit]

What do you want to tell the world? Put it here. The best imagery helps convey your most basic ideas without doing it overtly. Ideas on introductions and writing style can be found in our guidelines.

Content Translation is getting a major new feature: completely re-written support for templates. It was in design, testing and development since June 2016, and the first version of this feature was released on December 1st to Wikipedia in all languages.

The goal of the new feature is to make it easy to translate the templates across languages. We want to give more control to all the people who use the Content Translation feature directly or are affected by it: translators, other editors of articles that were created as translations, and template maintainers.

How did templates work until now[edit]

Screenshot of translating the article Shalom Meir Tower from English Wikipedia to Catalan Wikipedia in the Content Translation extension. Image by Amir Aharoni, Creative Commons CC0 1.0 Universal Public Domain Dedication.

Templates are used heavily in all Wikimedia projects. When Content Translation’s development started in 2014, the developers gave it very basic template support. Templates that used a whole paragraph, such as infoboxes and long quotations, were usually skipped completely. Shorter templates inside paragraphs, such as references, unit conversions, quotes in other languages, “citation needed”, etc., were adapted to a corresponding template in the target language when possible, or substituted with wiki syntax.

While this was useful for the creation of more than 100,000 new articles, this was far from perfect. It could get confusing when infoboxes and whole paragraphs of quotations were not shown during the translation, and they had to be inserted manually after creating the first version of the translated article. References were also adapted incorrectly on some occasions, and inserted a lot of hard-to-maintain wiki syntax.

So in the mid 2016 we started a process to overhaul Content Translation’s template editing functionality.

How was this feature designed[edit]

The design of this feature follows the same principles of Content Translation to provide a fluent experience. Template translation happens in context: an editing mode shows the template information right in the article. Information is provided side-by-side to facilitate transferring information from the source template into the translation. When possible, corresponding parameters are shown next to each other and translation aids are provided in order to save translators time and let them focus on creating quality content. You can check more details about the designs of template translation and related aspects.

We conducted initial research to learn more about the needs of translators regarding template support, and to evaluate the interaction concept proposed. The results of the research showed that the lack of template support was commonly perceived as a missing aspect, and the approach proposed seemed promising. We plan to keep learning from users by observing how the system works in future rounds of research, and the input provided by their use of the vast diversity of templates existing in all supported languages.

How it works now[edit]

Screenshot of translating the article Shalom Meir Tower from English Wikipedia to Catalan Wikipedia in the Content Translation extension. Image by Amir Aharoni, Creative Commons CC0 1.0 Universal Public Domain Dedication.

No templates are silently ignored now, so infoboxes and all other templates are shown in the source article column during the translation. When clicking on a template, a card on the sidebar will let the translator choose what to do with the template. It’s possible to skip it entirely (“Skip template”) or to insert the wiki syntax of the template as it appears in the original language (“Keep original template”). If an equivalent template is available in the target language, it will be possible to insert it, and edit the parameters one by one (“Use equivalent template”).

If the equivalent templates have the same parameter names, their values will be copied automatically. The template editor also uses TemplateData, a MediaWiki extension that provides a convenient way to store and retrieve information about wikitext templates and their parameters for easier editing, which is already used by the Visual editor. If the parameter names are different, but the template in the target language has TemplateData defined with names of parameters and aliases that are the same as the parameter names in the source language, they can also be adapted automatically.

How can you improve templates in your wiki[edit]

Wikis have people who develop and maintain the templates in them. This is also an opportunity for all wikis—large, medium, and small—to take a look at their templates and improve them. Here are several things that can be done:

  • Add TemplateData to templates that don’t have it yet. This will allow Content Translation and Visual Editor to show template insertion and editing forms where all the parameters are displayed conveniently.
  • Consider adding aliases for template parameter names that correspond to parameters in wikis in other languages from which articles are frequently translated into your language. You can see from which languages articles are translated most often into yours by going to the page Special:CXStats in your wiki.
  • Consider making the types of parameter more similar across languages. For example, in some languages images are provided as complete file links (for example, “{{Infobox person|image=[[File:Sophie Kowalevski.jpg|thumb|300px|Sofia Kovalevskaya, 1880]]}}”) and others have separate parameters for file name, size and caption ({{Infobox person|name=Sofia Kovalevskaya|image=Sophie Kowalevski.jpg|image_size=300|caption=Sofia Kovalevskaya, 1880}}). Making the parameter structure similar to the structure in the language from which articles are often translated will make the work considerably more efficient for translators and article maintainers.

Your feedback and future development[edit]

A screencast showing the template editor in action. Video by Santhosh Thottingal, CC-BY-SA 4.0

As noted earlier, this is only the first release of this feature. Templates on Wikimedia projects are very diverse, and while the developers tested the new template editor with many templates in many languages, it is impossible for us to test it with all the different templates—there are just too many of them. Because of this, it may be impossible to adapt some templates at first. As always, we’d love to hear from you about templates that can’t be adapted, and about other bugs. We nevertheless believe that this feature is already an improvement over the way that templates were handled till today, and we are continuing the development to make template translation easier and more efficient based on your input.

You can read more about the design and the development of this feature, as well as details for its future improvements in Phabricator: https://phabricator.wikimedia.org/T139332 . You can also let us know your feedback on the project talk page and also join us during our upcoming office hour next week on 7th December 2016, at 1300 UTC on #wikimedia-office (IRC Channel on Freenode) or participate in the online broadcast.

Amir Aharoni, Language team (Editing), Wikimedia Foundation