Localizable cross-wiki templates

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Localizable cross-wiki templates

Yuri Astrakhan-2
TLDR: Templates can now use datasets on Commons for all their localizable
messages, making it possible to copy/paste templates between wiki without
any changes.

If you look at the Graph:Lines template [1], there is a small link under
each graph that points to the data source. That link is automatically
localized on enwiki and ruwiki because the actual messages are stored in a
Commons' Dataset, while the template itself is identical on both wikis.

The magic happens in the Module:TNT (hoping it won't blow up):

*{{#invoke:TNT | msg | DatasetDict.tab | message-key | param1 | param2 |
... }}*

I would love to support template doc pages too, but I'm not sure how well
VE and other tools will work with the <templatedata>

This is an experimental thing, just hacking on it in my free time, and
would love to get your feedback on the viability of this approach. Thanks!

enwiki: https://en.wikipedia.org/wiki/Template:Graph:Lines
ruwiki: https://ru.wikipedia.org/wiki/Template:Graph:Lines
TNT: https://commons.wikimedia.org/wiki/Module:TNT
Wikitech-l mailing list
[hidden email]