Learning patterns/Developing a fully internationalized and centralized gadget
< Learning patterns(Redirected from Grants:Learning patterns/Developing a fully internationalized and centralized gadget)Jump to navigation Jump to search
A learning pattern forproject management
created on16 October, 2016
What problem does this solve?
Gadgets 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?
- Fully internationalize the gadget (example)
- Put the code on the MediaWiki namespace at Commons (example)
- Load the code from each wiki using the mw.loader.load method (example)
- Put the documentation on Commons and translate it to various languages (example)
- Create a project for the gadget at Phabricator to track bugs and feature requests (example)
- Request a repo at Gerrit to coordinate code review (example)
- Add the gadget to TranslateWiki to quickly localize all interface messages (example)
Things to consider
- To minimize requests to Commons, 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.setmethod, and the gadget can get them using the
- Use the
wgContentLanguageglobal variables to figure out the appropriate interface language
- Get the latest localized messages directly from Gerrit by adding
?format=textto the file at Gitiles. The messages will come out base64-encoded but you can decode them like this.
When to use
- Gadgets 2.0 and its associated task on Phabricator
- Proposal to implement global gadgets (WMF-wide)
- mw:Requests for comment/Shadow namespaces#Code quality