Page MenuHomePhabricator

[Proposed]Localising template parameter gadget
Open, Needs TriagePublic


I have an rough idea to develop a gadget to localise template parameters easily.

Proposed gadget opens a dialogue box with all existing parameters (which are usually in english) and input boxes like gadget-templateParamWizard on hewiki (linked below). And we input localised name of every parameter in front of each parameter. Then upon hitting "OK", gadget add these names in this form: {{{defaultName|{{{localisedName}}}}}}, i.e just replace default parameter "{{{default}}}" with "{{{default|{{{localisedOne}}}}}". Is it possible?

Thanks :)

HeWiki gadget:מדיה_ויקי:Gadget-TemplateParamWizard.js

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptDec 12 2018, 6:43 AM
MuhammadShuaib added a subscriber: eranroz.

This is interesting idea and I think this may be very useful for adopting templates between wikis.

As far as I know, for translating template there are different approachs:

  1. English code + local labels - Keep it as the original, but in the TemplateData editor provide localized label (so the template wizard in VE and the new template window in wikitext shows the localized label). Pros: code is same as origin and easy to update. Cons: wikitext is in English (and this is more problematic in RTL languages due to bidirectional issues)
  2. Local code +local labels - Also translate the parameters ( {{{en}}} => {{{local}}}) so template invocation/wikitext will be local. Pros: Wikitext is local and similar to labels. Cons: Harder to update, and impossible to copy&paste templates from different wikis.
  3. English + local fallback - {{{defaultValue|{{{localisedValue}}}}}} - Pros: same as above + ability to copy from other wikis. Cons: harder to update.

(In hewiki the 2nd is the most common, but sometimes there are also 1 and 3)
For Lua modules there are no conventions.

Questions (maybe @Amire80 or @santhosh will know?): Is there any convention / common practice between the above options (or a different option?) how templates should be translated? (or how can we check it? I think that as part of the work on content translation you have some mapping between template parameters between wikis so maybe you have this data?)

Huji added a subscriber: Huji.Dec 12 2018, 11:31 PM

In fawiki, 2 and 3 are most common (and we are gradually moving away from 2 and towards 3). As more templates become Lua-based, we are also moving away from all of the above, towards having a wrapper template (like 2) which calls an all-English template which then calls the Lua code, thereby not having to localize the Lua code at all.

What I wished was the case, was for a few kind high-influence folks in enwiki to promote abstracting out all localizable content (param names, param values that may be localized, etc.) in all newly developed templates and modules. The world would be a better place if things made for enwiki where already designed with i18n and l10n in mind. (I have the same criticism about Gadgets too, Twinkle being the one I have been most vocal about).

I wrote a somewhat similar idea at . This is a part of a much bigger proposal, and it requires a lot of infrastructure to fully work, but the general idea is closely related.

Restricted Application added a subscriber: Liuxinyu970226. · View Herald TranscriptNov 14 2019, 11:02 PM