Page MenuHomePhabricator

Generate the list of right-to-left languages automatically in MobileFrontend
Open, LowPublic

Description

To avoid issues like T342447, the list of right-to-left languages should be automatically generated in MobileFrontend. Preferably, it should happen automatically on-the-fly (but with sufficient caching to avoid performance regression); if it’s impossible, a bot (like Translation updater bot or or libraryupgrader) could be used.

Why isn’t rtLanguages.js a generated package file? That’s exactly what generated files are for. The PHP code generating the file could go over the list of supported MediaWiki languages and generate the list on-the-fly, without the need for extra commits to the MF repo whenever a new language is added to core.

This is a workaround for a performance issue in core. Ideally RTL information should be on the language links themselves but we had to revert https://gerrit.wikimedia.org/r/c/mediawiki/core/+/911367 due to a performance regression.

Package files are parts of ResourceLoader modules, and as such, cached more aggressively. Even if including the directionality directly in the links causes an unacceptable performance regression, including the list of RTL languages in a ResourceLoader module may have acceptable performance.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

I agree this would be better than the status quo but this really needs to be done in core.

This code only exists as a workaround for the lack of dir attributes on language links in the page. This is also a problem for language links in the desktop site with JS disabled that always show them in the site language direction.