In docs/settings.md the Advanced-Search documentation says it would be possible to add custom namespace presets, and that the label should be the "id of the translation to use to label the preset checkbox", i.e. a message key. But this can't work because the client-side JavaScript doesn't have access to arbitrary messages – only messages we made available as a ResourceLoader dependency.
Reported here: https://www.mediawiki.org/wiki/Topic:Xtfy4xcqffd529ga
Suggested steps:
- Add a quick fallback that just shows the 'label' => '…' string from the configuration in plain text in case a message with this key doesn't exist. This might already be enough for some 3rd-party wikis.
- Add a ResourceLoader module that makes the messages from the configuration available, instead of having them hard-coded in extension.json.
- While we are doing this we might as well turn the current, somewhat manual way the $wgAdvancedSearchNamespacePresets configuration is made available into a proper ResourceLoader module. https://gerrit.wikimedia.org/r/974117 already contains a draft for this.
- While we are doing this we can as well move the filter that hides disabled presets from the client to the server, potentially saving bandwidth.