Page MenuHomePhabricator

Make an integrated automated tool that facilitates transitioning of templates and modules from one wiki to another
Open, Needs TriagePublic


At the moment, when a user wants to copy a template from one wiki site to another, the steps are:

  1. Export a template from a local wiki and import it into the global wiki.
  2. Export all the templates that are used by this template (cascading).
  3. Edit the page in the new wiki, identify the human-readable strings in the wikitext, and translate them to the content language of the target wiki.
  4. Optional, but frequently done: Translate parameter names.
  5. Import the related CSS pages (TemplateStyles and pages in the MediaWiki space).
  6. Import and translate the template’s documentation page and TemplateData.

This has to be done step by step, manually. A similar process is also needed for Scribunto modules.

The thorough solution to this difficulty is global templates (T121470: Central Global Repository for Templates, Lua modules, and Gadgets). However, that is a big project that will take a while to complete, and copying templates is needed already now.

A tool should be developed that will make the transitioning of a template or a module from one wiki to another more automatic. It can do the following steps:

  1. Get these parameters:
    1. Source wiki.
    2. Template name
    3. Target wiki
  2. Export the source template (with cascading) and import it into the target wiki.
  3. Export necessary TemplateStyles, CSS pages, documentation, and TemplateData.
  4. Find the strings that need translation and help the human importer to translate them (not sure how, perhaps by showing a simple two-column translation interface, or by emphasizing them in the wikitext).

All these steps would be done in one click. Obviously, after this process, the human importer will have to write the translations, test that the template actually works, and make the necessary fixes. In most cases, this automatic process probably cannot create a fully usable and robust template or module, but it can help begin the transitioning process with fewer steps.

In the longer term, when global templates are available, this tool can be enhanced and help people import templates that should become global from local wikis to the global repository. In this scenario, the tool will identify the human-readable strings, convert them to a list with keys, and replace them with keys in the template’s source code.

Event Timeline

Amire80 renamed this task from Make an integrated automated tool that facilitates the transitioning templates and modules from one wiki to another to Make an integrated automated tool that facilitates transitioning of templates and modules from one wiki to another.May 19 2020, 6:36 PM
  1. Export necessary […] CSS pages

This is very tricky and I don’t think it can be done reliably (CSS can be on MediaWiki:Common.css, skin-specific CSS pages, group-specific CSS pages, default and hidden (i.e. forced) gadgets, opt-out gadgets, opt-in gadgets, conditionally loaded gadgets, conditionally loaded other MediaWiki- or even user-namespace pages, pages loaded with the withCSS query parameter, which is processed by Common.js on many—but not all—wikis, and so on). In the long run, templates should rely only on TemplateStyles for styling, so I certainly don’t want to see non-TemplateStyles CSS in the global templates system. In the short run, before global templates are implemented, it may be needed, but given the complexity of the task and given the fact that editing site-wide CSS pages on the target wiki requires interface administrator access (the target audience—non-techy users of small wikis—most likely won’t have it), I don’t think it’s worth implemented. There could be a warning in the tool like

If the template’s appearance is not the same as on the source wiki, ask for help at m:Tech.

and then techy folks can identify the needed CSS rules and help migrating it to TemplateStyles on the source wiki (or if that’s impossible for some reason, help migrating the site-wide CSS).