Hi All,
Is there any documentation or Gadget I can have a quick look at yo be able to learn how to enable translation in gadgets?
Thanks in advance. — Eugene233
ke 27. marrask. 2019 klo 0.38 Egbe Eugene (agboreugene@gmail.com) kirjoitti:
Hi All,
Is there any documentation or Gadget I can have a quick look at yo be able to learn how to enable translation in gadgets?
The only example I know is https://commons.wikimedia.org/wiki/Help:Gadget-ProveIt and it is using Gerrit and translatewiki.net. -Niklas
Thanks very much Niklas. I also found https://en.wikipedia.org/wiki/User:%D7%A2%D7%A8%D7%9F/veReplace.js
On Wed, 27 Nov 2019 at 14:44 Niklas Laxström niklas.laxstrom@gmail.com wrote:
ke 27. marrask. 2019 klo 0.38 Egbe Eugene (agboreugene@gmail.com) kirjoitti:
Hi All,
Is there any documentation or Gadget I can have a quick look at yo be
able
to learn how to enable translation in gadgets?
The only example I know is https://commons.wikimedia.org/wiki/Help:Gadget-ProveIt and it is using Gerrit and translatewiki.net. -Niklas
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
On Tue, Nov 26, 2019 at 2:39 PM Egbe Eugene agboreugene@gmail.com wrote:
Is there any documentation or Gadget I can have a quick look at yo be able to learn how to enable translation in gadgets?
The common but not too great approach is to have separate per-language JS or JSON pages which put the messages into some object, create and maintain the pages manually, and load the right one via AJAX (and reimplement what's needed from mw.messages functionality - typically that's just parameter substitution).
The richer gadget definition syntax enabled by the Gadget definition: namespace [1] is a more performance and more translator-friendly but heavier to set up solution: you can define the used messages there, translate them via translatewiki and access them via mw.messages (without any manual hacking of that object needed). Not sure how the setup would look on the translatewiki side though; presumably there would have to be some faux extension where the messages are defined.
IMO a nice lightweight setup would be via JSON message collections; that's blocked on T156210 and (to a lesser extent) T198758 currently.
[1] https://www.mediawiki.org/wiki/Extension:Gadgets#Using_Gadget_Definition_Nam... [2] https://phabricator.wikimedia.org/T156210 - Support translation of JSON blobs in Translate [3] https://phabricator.wikimedia.org/T198758 - Load .json configuration files via ResourceLoaderWikiModule
wikitech-l@lists.wikimedia.org