Page MenuHomePhabricator

The Hebrew dual plural form in mobile-frontend-joined-years is parsed incorrectly on user pages
Open, Needs TriagePublic

Description

I am looking at https://he.m.wikipedia.org/wiki/User:Mikey641 (the mobile user page for User:Mikey641 on the Hebrew Wikipedia).

Under the title it says: "הצטרף לפני 2 שנים" ("joined 2 years ago"). The wrong plural form is shown here. For number 2, the output is supposed to be "הצטרף לפני שנתיים".

The PLURAL clause in the translation is "{{PLURAL:$1|שנה|שנתיים|$2 שנה|$2 שנים}}", and I'm pretty that it's correct. In case it's hard to read it right to left, I'll break it down:
1: שנה
2: שנתיים
3: $2 שנה
4: $2 שנים

The translation that I actually see is 4, which is the "other" generic plural. I expect to see 2, which is the "two" form (dual).

I also tested it at https://he.wikipedia.org/wiki/User:Amire80/2 , and it looks correct, but it's parsed in PHP.

(Sorry about possible over-tagging, I'm not sure where the issue is.)

Event Timeline

This is outside my expertise and I can't really remember the history of this key, but this is a complicated message and this is what's happening under the hood:

"mobile-frontend-last-modified-with-user-years": "[$4 Last {{GENDER:$1|edited}} {{PLURAL:$3|$3 year|$3 years}} ago] by {{PLURAL:$5|[$6 $2]|0=an anonymous user}}",

JS:

html = mw.message.apply( this, [
'mobile-frontend-last-modified-with-user-days',
// my gender
'male', 
// user who last edited
'Username',
// number of years
mw.language.convertNumber( 4 ),
// url to history page
'/wiki/Foo?action=history',
// whether user isAnon (we creatively abuse the PLURAL support .. so maybe this is interfering with the logic?)
mw.language.convertNumber( 1 ), 'username' ] ).parse();,
// URL of user page
'/wiki/User:Username'
);

Let me know if there is a problem with the message itself or how we are rendering it.

Is the jqueryMsg module loaded with this module?

Yes. jqueryMsg is loaded by default on all mobile page views (and an explicit dependency of the module that does the rendering)

Then I don't know what could be wrong. @Nikerabbit, any ideas?

Please link to the message in this kind of bugs. I was investigating with the message that @Jdlrobson posted but that does not match the contents of your message.

mw.messages.set( 'test', '{{PLURAL:$1|שנה|שנתיים|$2 שנה|$2 שנים}}' )
09:09:21.624 true
for (let i = 1; i < 5; i++ ) { console.log( mw.message( 'test', i, 'bunny' ).text() ) }
09:18:46.895 VM631:1 שנה
09:18:46.896 VM631:1 שנתיים
09:18:46.897 VM631:1 bunny שנים
09:18:46.900 VM631:1 bunny שנים
09:18:46.900 undefined
for (let i = 1; i < 5; i++ ) { console.log( mw.message( 'test', mw.language.convertNumber( i ), 'bunny' ).text() ) }
09:19:01.880 VM683:1 שנה
09:19:01.881 VM683:1 שנתיים
09:19:01.884 VM683:1 bunny שנים
09:19:01.887 VM683:1 bunny שנים

In general plural seems to be working fine in JavaScript with uselang=he.

Is this still a problem?

Yes. Try with: https://he.m.wikipedia.org/wiki/User:Jdtst

With ?uselang=qqx, I see (mobile-frontend-joined-years: unknown, 2).

To find usernames who joined two years ago, see https://quarry.wmflabs.org/query/46873 .

Jdlrobson renamed this task from The Hebrew dual plural form in mobile-frontend-joined-years is parsed incorrectly to The Hebrew dual plural form in mobile-frontend-joined-years is parsed incorrectly on user pages.Jul 24 2020, 3:22 PM

The message takes GENDER and for some reason mw.message library does not handle that.

08:20:16.657 mw.message.apply( this, [ 'mobile-frontend-joined-years', 'unknown', mw.language.convertNumber( 2 ) ] ).parse();
08:20:16.688 "הצטרף לפני שנתיים"

27:26.679 mw.message.apply( this, [ 'mobile-frontend-joined-years', 'unknown', mw.language.convertNumber( 2 ) ] ).parse();
08:27:26.711 "הצטרף לפני 2 שנים"

The message is:

`
"mobile-frontend-joined-years": "{{GENDER:$1|הצטרף|הצטרפה}} לפני {{PLURAL:$1|שנה|שנתיים|$2 שנה|$2 שנים}}",

Shouldn't that be (note the PLURAL:$2):

`
"mobile-frontend-joined-years": "{{GENDER:$1|הצטרף|הצטרפה}} לפני {{PLURAL:$2|שנה|שנתיים|$2 שנה|$2 שנים}}",
                                                                                                                                       ^

?
There doesn't seem to be any problem in MobileFrontend as far as I can see.