Learning patterns/Developing a fully internationalized and centralized gadget
A learning pattern forproject management
Developing a fully internationalized and centralized gadget
problemHow to fully centralize and internationalize a gadget
solutionHost the code and documentation at Commons, with local configs on each wiki
creator• Sophivorus
created on16 October, 2016
status:DRAFT
What problem does this solve?
editGadgets are usually a mess. Each wiki that adopts a gadget makes its own copy of the code and documentation, so any enhancements done by one wiki don't spread to others, and developers working on the same gadget can hardly collaborate.
What is the solution?
edit- Fully internationalize the gadget (example)
- Put the code on the MediaWiki namespace at MediaWiki.org (example)
- Load the code from each wiki using the mw.loader.load method (example)
- Put the documentation on MediaWiki.org and translate it to various languages (example)
- Request creation of a project tag for the gadget at Phabricator to track bugs and feature requests (example)
- Request a code repository in Gerrit to coordinate code review (example)
- Add the gadget to TranslateWiki to quickly localize all interface messages (example)
Things to consider
edit- To minimize requests to MediaWiki.org, the loading script on each wiki should have some checks so that it only loads the gadget when it's likely to be used (for example only when editing a page, only on the mainspace, etc).
- Any wiki-specific configuration variables that the gadget may require can be set by the local wiki using the
mw.config.set
method, and the gadget can get them using themw.config.get
method - Use the
wgUserLanguage
andwgContentLanguage
global variables to figure out the appropriate interface language - Get the latest localized messages directly from Gerrit by adding
?format=text
to the file at Gitiles. The messages will come out base64-encoded but you can decode them like this.