Page MenuHomePhabricator

Support {{#FORMAL:}} in JavaScript
Closed, ResolvedPublic2 Estimated Story Points

Description

Functionality for new {{#FORMAL:}} syntax was added in T238433: Inline syntax for language politeness variants (informal/formal), to enable translation into both formal and informal variants in one language code for languages that make that distinction. However, the implementation doesn't support JavaScript yet, while it should.

To reproduce the problem in production:

  • Open the browser console
  • Type or paste: mw.messages.set( 'mytest', '{{#FORMAL:informal|formal}}' );
  • Type or paste: mw.msg( 'mytest' ); and see the result.
    • Actual result: {{#FORMAL:informal|formal}}
    • Expected result: informal (unless your user interface language is set to de-formal, es-formal or hu-formal, in which case the expected result would be formal).

Event Timeline

Change #1038812 had a related patch set uploaded (by Jon Harald Søby; author: Jon Harald Søby):

[mediawiki/core@master] Support {{#FORMAL:}} syntax in jqueryMsg

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

Nikerabbit triaged this task as Medium priority.Jun 6 2024, 7:03 AM
Nikerabbit set the point value for this task to 2.

I just learned that this is potentially much more user-facing than expected. The moment someone not aware of this limitation adds a single {{#FORMAL:…}} to an existing message (just anywhere, it doesn't even need to be nested with the existing {{GENDER:…}} syntax) the jqueryMsg code starts to fail hard with "Parse errors", stops doing anything and leaves the message completely unparsed. I believe this is a problem, because:

  • GENDER and FORMAL obviously belong together. As a translator I would expect the two to behave the same – either both work or both do not work.
  • How can translators on translatewiki even tell if they are allowed to use certain features or not? They would need to be able to identify messages that are parsed via jqueryMsg, and then known that these (and only these) can use GENDER but not FORMAL. I don't think there is a way to tell.

Can you prioritize this accordingly?

Latest update: There is a patch from Jon that needs to be reviewed: https://gerrit.wikimedia.org/r/c/1038812

Change #1038812 merged by jenkins-bot:

[mediawiki/core@master] Support {{#FORMAL:}} syntax in jqueryMsg

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

Change #1082817 had a related patch set uploaded (by Bartosz Dziewoński; author: Jon Harald Søby):

[mediawiki/core@REL1_43] Support {{#FORMAL:}} syntax in jqueryMsg

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

Change #1082817 merged by jenkins-bot:

[mediawiki/core@REL1_43] Support {{#FORMAL:}} syntax in jqueryMsg

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