Wikimedia Developer Summit/2017/Cross-wiki templates, translatable, reusable, manageable

Session recording
  • Root problem: Templates are just wiki pages on one wiki. There's no real way to develop and maintain a template that is useful is several projects in one place.
    • Some templates use Lua modules, which have the same issues I think. 
  • Similar templates on many languages (English, French, Arabic, etc.).
  • Similar templates on many projects (Wikipedia, Wikibooks, Wikisource).
  • Some templates are typical only to some namespaces (articles, talk pages, other templates, etc.).
  • Templates may have equivalent purpose and similar data, but different design on different wikis. (For a cute simple example, look at the design on the location infoboxes in French: ; notice the background image at the top of the box.)
  • Many languages have many templates for what in other languages is done with one template. Example: English has {{IPA-fr}}, {{IPA-ar}}, etc., and most other languages just have {{IPA}}.
  • The templates can be functionally similar, but the implementation may be significantly different.fastcci
  • Parameters are sometimes equivalent, but have different names in different languages.
  • Parameters are sometimes kind-of equivalent, but the actual data may have to be entered differently (e.g., English wants just a file name of an image, and Hebrew wants a whole file link [[File:Image.jpg|250px|Caption]]).
  • There is little communication between template maintainers in different languages and projects.
  • Some projects implemented tool for template linting. E.g., citation templates in English display red errors in the template itself; Hebrew has something similar, but implemented completely differently: It shows a box with a list of errors to people who enabled a certain gadget. Other languages may have other things.
  • TemplateData (at least not in its current form) is not really a solution to the problem at hand: It must be replicated across languages and it doesn't provide actual internationalization.
  • Currently, there are some solutions for making templates translatable, but they are super-hacky and hard to use and maintain:
    • TNT ( )  I object!
    • Reusing Data pages used for the Graph extension for translating strings ( )
  • Some templates are by definition useful only in some languages, because they are specific to that language's features. Surprisingly, this is a problem, too, because it may get in the way when an article is being translated. It would be nice to have a uniform way for templates to tell Content Translation and other tools that this template can be just skipped, or substituted, etc.
  • Wikidata helps with autofilling the data (parameter values), but actual adoption across projects is slow-ish, and ironically—it is implemented quite different in every language.
  • "Shadow namespaces" is a technology that is supposed to make the basic sharing of templates cross-wiki possible, although it doesn't include technology for message translation.
  • If a template is available for use in many wikis, its name and parameter names must be localized, too.

Things that are (arguably) good features of the current per-wiki templates, and which can be lost if they become cross-wiki:

  • No need to coordinate with template developers in other wikis.
  • It's easy to change a template and (more or less) immediately see the result on the same wiki. No review, no waiting for caches to update (at least not for very long), no breaking other wikis.
  • Having to edit it in another wiki may make template maintainers feel unwelcome and alienated, and they may feel that their independence is taken from them.
  • Permissions—who has the permission to edit templates? Some templates are very sensitive because they can break a lot of pages, the usage frequency is different in different projects, the permission policies are different in different wiki communites, etc.
  • Special:MostTranscludedPages is useful. It must not be broken and it may have to be rewritten to support it.
  • Special:WhatLinksHere may also be affected.

(Amir presents the points above)
(Stas presents the data pages)
Yuri: The data pages have data types: strings, integers, and localized strings: Each key is a language code.
Yuri: Works with the TNT module, already available in some wikis. Shadow namespaces would be a mistake.
Tim: Shadow namespaces started as a way to share certain things between wikis, including Commons description and "scary transclusion". Tim suggest remote transclusion to be explicit. Shadow namespaces doesn't necessarily solve these problems. Kunal's work makes remote transclusion possible. Two types of remote transclusion: Pull HTML or pull wiki syntax and parse locally.
Stas: Isn't sharing templates and Lua scripts similar?
Tim: Lua scripts and Gadgets would be easier to share between wikis than templates.
Amir: Lua can already process MediaWiki messages., and MediaWiki messages are easy to localize with the Translate extension. The only question is where to store messages for templates in the first place.
Yuri: Data sets are perfect for such messages...
Tim: ... but it doesn't have a translator-friendly UI.
Trizek: I'd be happy for a template repository as a user, but some people might be unhappy, like they are unhappy about Wikidata. We may also lose the people who can create templates and know the current way of doing it with the wiki syntax.
Yuri: How about this: The Template namespace becomes global, and there will be a different prefix that forces a local template.
Stas: Context problem: Templates refer to other templates.
Subbu and Yuri: Shadowing is not necessarily the solution.
Yuri: To make this succeed we really need to bring Lua and Tempalte develoepers together.
Yuri: I make my templates on, test them there, and then I copy them to wikis.
Stas: I do it, too, for SPARQL templates, although that's pretty awful.
Yuri: Doing it with bots would work. A certain wiki can mark a template as "don't overwrite this". It would work, although it would be a hack, but in MediaWiki everything is a hack.
Jaime: Is Infoboxes the main motivation for this?
Amir and Yuri: No, it's needed for many templates. {{Unreferenced}} tags, etc., are for this, too. And {{{1}}}, and many other templates.
Yuri: A personal feature request from Tim: Globally resolvable title, not just a string that is based on the page's title.
Andy: It's a good idea to have a global repository, but for the long term we need to be careful not to introduce too much homogeneity. For example, different wikis may have different policies for tagging articles as "self-promotion", etc., and this may give people too much temptation to use ready-made solution.
Yuri: The barrier to creating a new template is tiny, so it's not much of a problem.
Amir: A lot of the time, small wikis while starting up tend to spend a lot of time adapting template (months at a time) instead of actually writing content. In contrast, translating labels is on the order of hours.
Yuri: Not enough human editors around to do this template adaptation regularly everywhere.
Yuri: We can create a repository and create NEW templates there. If you want, use that. If not, continue with your own templates. We just shouldn't mix global and local templates—it will introduce even more new problems.
Tim: Scary transclution lets you write {{en:Infobox person}}, and it will work (it's disabled on Wikimedia wikis). We can enable it, make a new wiki for it.
Yuri: Templates should be message-based and not content-based. Translate extension can do it, but more like translatewiki and not like Page Translation.
Amir: Generally, Translate can probably handle it (Niklas, correct me if I'm wrong). But can the transclusion be made possible?
Tim: Yes, and we kinda do it already. Possibly there will be some problems with caching, but it can be fixed. Once product management work for this is done, the implementation is not hard.
Yuri: So, are we doing it? A repository that will global-only?
Tim: Just create a wiki, and give it to the community. And some day—let's make it globally-transcludable.
Subbu: RFC for template styles will have to be completed.

  • Action items:
    • Create a cross-wiki discussion group of template maintainers.
    • Document current bots that copy useful templates (TNT, SPARQL).
    • Create a global repo wiki :)
    • Figure out how global templates are localized (messages, common data, TNT, something else?)