Migrated from: https://wikimedia.mingle.thoughtworks.com/projects/language_engineering/cards/4490
Context
Currently both ULS and CX are doing some less than ideal DOM manipulation to modify the interlanguage list. We should create a JS module for MediaWiki core which abstracts this handling to avoid too much pain in the future when new skins come and go. Also other extensions not maintained by us can use this JS module.
Benefits:
- More stable API (not relying on DOM)
- Easier code with high level functions
- Shared maintenance cost between multiple extensions and developers
Some things to consider about Interlanguage links: https://www.mediawiki.org/wiki/Interlanguage_links/September_2014
Narrative
As a developer, I can use JS module to modify interlanguage links, so my code keeps working even if the DOM changes and my code can be simpler.
Acceptance Criteria
- Compatibility with all current extensions that do anything with the interlanguage area:
- ULS (including compact links, if relevant by that time + see below about Winter)
- Wikibase (including featured article badges)
- ContentTranslation
- MobileFrontend (it doesn't use them directly as frontend elements, but must not be broken in any way)
- anything else?
- Compatibility with the MediaWiki:Sidebar message (if relevant).
- Compatibility with Vector and Monobook.
- Compatibility with Winter, as much as possible.
- Compatibility with Main pages of Wikimedia projects that limit their number (e.g. English Wikipedia).
- Must be usable by gadgets ( this part needs elaboration )
- Must not break existing tooltips.
- needs refinement / possibly out of scope : Must be able to use core CSS classes in a flexible and robust way - currently CX applies the red color to the red interlanguage link by simply copying the color, and with an ugly selector. It would be much better to apply the same class as the one that is applied to the red links in articles. This may also require changing the handling of red links in articles in core.