Page MenuHomePhabricator

The protection expiry options should be rendered in the user interface language
Closed, DuplicatePublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):
As discussed in zhwiki (link), the dropdown options (message key protect-expiry-options) in action=protect are displayed in zh-hans for sysops using zh-hant variants. This happens when $wgLanguageCode = "zh", which fallbacks to zh-hans.

What happens?:
ProtectionForm.php uses Message::inContentLanguage to access that translation string. It has been accessed this way since it was split from ipboptions in rMW7049385. ipboptions has no longer been exclusively rendered in the content language after rMWad0e525.

What should have happened instead?:
Adding it to $wgForceUIMsgAsContentMsg will cause the dropdown menu to be displayed in zh-hant correctly. I am not sure if just removing ->inContentLanguage() on that line suffice.

Software version: 1.45.0-wmf.12

Event Timeline

It must use the content language as it allows to add own expiry times from the community to the drop down box, that would not work when showing in user language.
Not sure if the message supports language converter syntax in the first part of each entry (before the colon and after comma).

I am not sysop so can't comment on the use cases. However if the customisation has been used somewhere, and the UI of action=protect is kept in its current form, then sysops at zhwiki just have to be less paranoid about the interface or find other workarounds.

An alternative should be using the user-selected variant of the site content language (seems to be obtained through LanguageConverter::getPreferredVariant()) to fetch the message string. If someone bothers to code it.