Page MenuHomePhabricator

Implement TranslateMagicWords / PreferEnglishMagicWords config option
Open, Needs TriagePublic

Description

Implement TranslateMagicWords / PreferEnglishMagicWords configuration option.

To prevent duplicating en magic word aliases in non-en files, we would like to introduce the TranslateMagicWords / PreferEnglishMagicWords configuration option.

Event Timeline

Change 863085 had a related patch set uploaded (by Winston Sung; author: Winston Sung):

[mediawiki/core@master] Implement TranslateMagicWords config option

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

Change 863084 had a related patch set uploaded (by Winston Sung; author: Func):

[mediawiki/core@master] [WIP] Implement PreferEnglishMagicWords config

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

Reedy renamed this task from Implement TranslateMagicWords / PreferEnglishMagicWords config option to Implement TranslateMagicWords / PreferEnglishMagicWords config option.Jan 7 2023, 1:19 PM
Reedy updated the task description. (Show Details)

Change 863084 had a related patch set uploaded (by Func; author: Func):

[mediawiki/core@master] Implement PreferEnglishMagicWords config

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

I'm not sure why this is needed/wanted? The guidance in MessagesEn.php states:

* Note to localisers:
*   - Include the English magic words as synonyms. This allows people from
*     other wikis that do not speak the language to contribute more easily.
*   - The first alias listed MUST be the preferred alias in that language.
*     Tools (like Visual Editor) are expected to use the first listed alias
*     when editing or creating new content.
*   - Order the other aliases so that common aliases occur before more rarely
*     used aliases. The aliases SHOULD be sorted by the following convention:
*     1. Local first, English last, then
*     2. Most common first, least common last.
* @phpcs-require-sorted-array

That seems pretty clear.

If you don't want to use local aliases then you can leave them out; similarly if folks don't want to include the English aliases they can leave them out. All the necessary functionality is here already, so I don't understand why a new configuration option is needed.

I suppose we could have a new $wgMagicWordsEnglishFallback option which automatically adds the $magicWords from MessagesEn to the end automatically, if the only desire is to avoid repeating the same bytes, but this is a fairly short table as these things go.

The point is to have the ability to switch to en-first / en-preferred magic words (as described, Tools (like Visual Editor) are expected to use the first listed alias).

But the way to do that is just to reorder the aliases. The whole point of the message in MessagesEn.php is to give the wiki community control over which of the alternatives is used by Visual Editor by ordering the alises in their localization. If you want VE to use english rather than localized messages, just list the english ones first. The third bullet is a SHOULD (based on general WMF community preferences) not a MUST. The MUST in the second bullet point is that the first option MUST be the preferred one for VE to use. If that's English on that wiki, then put the English one first.

If you want VE to use english rather than localized messages, just list the english ones first.

But the task is mean to make it configurable, e.g., use en-first on some sites but have zh-first (in this case, zh-hans-first) on other sites.