Message customization in content language is ignored when requested in course of language fallback
- Customize a message, e.g. Sidebar, by editing Mediawiki:Sidebar
- Switch user language to a different one (Using Universal Language Switcher extension, part of Translate extension package)
- Most of the user interface switches to the user language
- Sidebar reverts to default English content
Expected behavior: Sidebar falls back to English, finds a customized version and displays it.
Major impact of this is broken Mediawiki:Common.css when user switched their UI language.
I traced the code to MessageCache::getMessageForLang()
There, a Language CDB cache is looked up before hitting database, and, if a message is found, returns it without checking DB contents, ignoring $useDB parameter.
Simple solution would be to move CDB cache check after if( $useDB ) clause. More complex solution would be to load Language CDB cache for requested language only, excluding messages in the fallback language.