Page MenuHomePhabricator

Client i18n module generates unnecessary keys
Closed, ResolvedPublicBUG REPORT

Description

For the supporting an in-lined label for the check-boxes (boolean control) we introduced a specific message key: control-label. This label is only useful for checkboxes, however, i18n.getControlsTextKeys() generates one of this keys for every schema property. This is incorrect and results on overhead on the message API requests.

Steps to replicate the issue (include links if applicable):
This happens for any schema but a good example for debugging is the HelpPanel

  • Navigate to Special:CommunityConfiguration/HelpPanel
  • In the network tab, inspect the result of the API request made by new mw.Api().getMessages, eg: /w/api.php?action=query&format=json&meta=allmessages&ammessages=communityconfiguration-helppanel-title%7Ccommunityconfiguration-helppanel-description...

What happens?:
*-control-label is fetched for several properties

What should have happened instead?:
No *-control-label is fetched

Software version (on Special:Version page; skip for WMF-hosted wikis like Wikipedia):

Other information (browser name/version, screenshots, etc.):

This may not only happen for control-labels but for other "non-sense" situations. It would be nice to review or even find a programmatic way to identify which message keys we aren't using, and if it makes sense to keep them for other uses cases or not.

Event Timeline

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

This is necessary to fix so that T363051: Add support for field placeholders can be done in a sensible way. That is, this is blocking T363051.

Change #1030904 had a related patch set uploaded (by Michael Große; author: Michael Große):

[mediawiki/extensions/CommunityConfiguration@master] Refactor i18n.js to handle control types individually

https://gerrit.wikimedia.org/r/1030904

(I consider this effectively a sub-task broken out of T363051, not as a separate story.)

Change #1030904 merged by jenkins-bot:

[mediawiki/extensions/CommunityConfiguration@master] Refactor i18n.js to handle control types individually

https://gerrit.wikimedia.org/r/1030904

@Michael Was this resolved or are you still doing some follow up QA work on it in this sprint?

The changes related to this have been merged and the bug as written is fixed. There is the questions of whether we should rather generate the message-keys server side, but that is outside of the scope of this task.