Steps to replicate the issue (include links if applicable):
- Have mw.jqueryMsg available in the console (it usually is available)
- In the browser console, input: mw.messages.set( 'mytest', '{{#FORMAL:{{GENDER:|Informal}} hello|{{GENDER:|Formal}} hello}}' );
- Input: mw.msg( 'mytest' );
What happens?:
- The message is not parsed as expected: {{#FORMAL:{{GENDER:|Informal}} hello|{{GENDER:|Formal}} hello}}
What should have happened instead?:
- The message should have been parsed to Informal hello (or Formal hello if you use a language code like de-formal)
I discovered this not long after my patch adding FORMAL support to jqueryMsg was merged, after adding {{#FORMAL:}} to some JavaScript-only messages in Translatewiki.
In order to make myself clear, here's the terminology I'll use:
{{#FORMAL:firstparam|secondparam}}
In my testing, I've found that firstparam can not contain complex syntax. Other (jqueryMsg-supported) parser functions are fine in isolation, but not when combined with other text. So if firstparam is {{GENDER:|He|She|They}}, it works, but if it is {{GENDER:|He|She}} is, it doesn't work. secondparam can be whatever thing is supported, the problem is only when the complex text is in the first parameter (following the colon).
The code that chooses how to parse stuff in jqueryMsg is unfortunately quite complex (at least to me), with functions like nOrMore(), sequence() and choice() used to pick which function it should try to parse with. I've tried a lot of different things locally, but haven't been able to make heads or tails of it, so I'm hoping someone else has a clue.