On Tue, Nov 26, 2019 at 2:39 PM Egbe Eugene <[email protected]> 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_Namespace [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 mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/wikitech-l
