At the moment, when a user wants to copy a template from one wiki site to another, the steps are:
- Export a template from a local wiki and import it into the global wiki.
- Export all the templates that are used by this template (cascading).
- 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.
- Optional, but frequently done: Translate parameter names.
- Import the related CSS pages (TemplateStyles and pages in the MediaWiki space).
- 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:
- Get these parameters:
- Source wiki.
- Template name
- Target wiki
- Export the source template (with cascading) and import it into the target wiki.
- Export necessary TemplateStyles, CSS pages, documentation, and TemplateData.
- 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.