Many templates have similar functionality in different wikis. There are several tasks and proposals to make the storage of such templates fully global: T52329, T66474, T6547, T121470, [[ https://www.mediawiki.org/wiki/Global_templates | Global templates ]], etc.
Another thing could be done, whether the templates are fully global or not: A generic stand-alone service that adapts templates across wikis.
If templates are truly global, it will be easier to build such a thing. Indeed, such a service will be //necessary// for global templates to be effective. However, it's possible to make such a thing already now, while templates are not yet global. The Content Translation extension is currently able to adapt templates between languages, mostly by using Wikidata sitelinks, parameter names, and TemplateData aliases. This logic from Content Translation could be made autonomous and stand-alone, as a step to a full independent service of this kind.
Here's a simplistic example of how it will work. To adapt a transclusion of the [[ https://en.wikipedia.org/wiki/Template:Verse_translation | Verse translation ]] template with some content from English to Turkish, it will post the following structure:
```lang=json
{
sourcewiki: "enwiki",
targetwiki: "trwiki",
template: "{{Verse translation|ਸਹੀ ਰਸਤਾ ਵਖਰੇ ਲੋਕਾਂ ਲਈ ਵਖਰਾ ਹੈ। ਆਪਾਂ ਏਕਤਾ ਵਿਚ ਰਹਿਏ, ਜੈ ਜੈ।|The right way is different for different people. Let us live in union, then we all win, win.|lang=pa|attr1=Tjinder Singh}}"
}
```
And it will get the following output:
```lang=json
{
template: "Şiir çevirisi|ਸਹੀ ਰਸਤਾ ਵਖਰੇ ਲੋਕਾਂ ਲਈ ਵਖਰਾ ਹੈ। ਆਪਾਂ ਏਕਤਾ ਵਿਚ ਰਹਿਏ, ਜੈ ਜੈ।|The right way is different for different people. Let us live in union, then we all win, win.|dil=pa|atıf1=Tjinder Singh}}"
}
```
So:
- The template name `Verse translation` is translated to `Şiir çevirisi`. This can be done now using sitelinks.
- The first two unnamed parameters are the same.
- The `lang` parameter is translated to `dil`.
- The `attr1` parameter is translated to `atıf1`.
The parameter names can currently be mapped using TemplateData aliases. It's not perfect, but it works for Content Translation. It should become more structured in the Global templates age.
The parameter //values// are not translated in this example, and this shouldn't be a requirement for the first version of this service. Perhaps this can be added as a feature further down the road. The initial scope for this feature is just about translating the template title and parameter names as quickly and reliably as possible, without having to look them up manually in documentation.
If there is a nested template in the parameter value, the service should probably attempt to adapt it recursively, at least by default.
Having such a service independently of Content Translation will allow easier template handling this in more contexts where it is useful. For example:
- It will be possible to copy a template (Ctrl-C) in one wiki and paste it (Ctrl-V) in another wiki in Visual Editor. If the templates are properly mapped to each other, it will just work. Of course, the editor will probably have to change the parameter values, but the step of looking up the parameter names will disappear, which will be a significant improvement. This will probably also work in the 2017 wiki text editor.
- It will be possible to copy a template (Ctrl-C) in one wiki and paste it in another wiki in Visual Editor. If the templates are properly mapped to each other, it will just work. Of course, the editor will probably have to change the parameter valueshave a stand-alone tool or a dialog box in the wiki text editor where the user will post the source template, but the step of looking upindicate the source and the parameter names will disappeartarget languages, which will be a significant improvement.push a button, This will probably also work in the 2017 wiki text editorand get wiki text that can be pasted.
- It will be possible to have a stand-along tool or a dialog box in the wiki text editor where the user will post the source template, indicate the source and the target languages, push a button, and get wiki text that can be pastedContent Translation should start using this service instead of its own built-in template adaptation logic.