Last modified: 2012-07-28 19:56:29 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T22962, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 20962 - Add support for PLURAL, GENDER and GRAMMAR in a javascript message parser
Add support for PLURAL, GENDER and GRAMMAR in a javascript message parser
Product: MediaWiki
Classification: Unclassified
JavaScript (Other open bugs)
All All
: Normal normal (vote)
: 1.20.0 release
Assigned To: Nobody - You can work on this!
: i18n, patch, patch-reviewed
: 30731 (view as bug list)
Depends on:
Blocks: javascript 25442 29582 gender 20964 30071 31443
  Show dependency treegraph
Reported: 2009-10-02 16:42 UTC by Siebrand Mazeland
Modified: 2012-07-28 19:56 UTC (History)
12 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---

mediawiki trunk parser patch (577.28 KB, patch)
2010-11-13 15:53 UTC, Michael Dale
updated patch adds ie6-7 compatibility (44.07 KB, patch)
2011-01-11 19:46 UTC, Michael Dale

Description Siebrand Mazeland 2009-10-02 16:42:54 UTC
mwEmbed should support PLURAL just as MediaWiki core does. There are currently several messages that cannot be properly localised, because the verbs that come with the counters cannot have different plural forms.
Comment 1 Michael Dale 2009-10-02 16:51:48 UTC
Oky I will try and add in PLURAL support. Could you give me two or three of edge case languages that have complex usage of the {{PLURAL}} call? 
Comment 3 Michael Dale 2009-10-12 17:46:35 UTC
PLURAL support is coming along ... here is a demo page

Will try and update the demo to work with multiple languages simultaneously and with one or two more PLURAL usages and shot out an update once ready.
Comment 4 Michael Dale 2010-07-05 22:14:45 UTC
Updated PLURAL test page.

Has pretty close very close to full coverage for all languages. I will mark this fixed. If we find an error with any particular language I can address that directly.
Comment 5 Siebrand Mazeland 2010-07-05 22:19:13 UTC
Very nice, Michael. Great work.
Comment 6 Michael Dale 2010-11-13 15:53:23 UTC
Created attachment 7815 [details]
mediawiki trunk parser patch

the mediawiki message parser patch ( see /Special:BlankPage?action=mw.language.parserTest&debug=true# to run tests )
Comment 7 Michael Dale 2010-11-13 16:04:48 UTC
I have attached a patch it has a few 'fixme's in terms of the core framework. It includes a test page that can be accessed at: 

The resource loader needs to support passing off fallback transformations to the language transform javascript resource requests. ie language 'mwl' falls back to 'pt' transform class. ( Presently its hard coded to pass more tests, in the mediawiki.language.parserTest.js file defined as: mw.language.fallbackTransformMap ) 

The resource loader should let resources depended on a dynamic module for listing all the language name keys pairs ( otherwise you have to do a api call for any component that needs to have a list of supported languages )  

The resource loader / mediawiki should have a better system for testing / debug files. Right now all the tests are included whenever your in debug mode. ( pretty strait forward, add a special page that can request predefined test cases and or all the resources that were defined as test files via special resource loader resource module definition. 

We should probably separate out jQuery based message key request / response functionality from the core message support into a separate jQuery message entry point.
Comment 8 Niklas Laxström 2010-11-13 16:06:31 UTC
The attached patch seems to have a lots of unrelated whitespace changes. Can you take those out of the patch?
Comment 9 Michael Dale 2010-11-16 19:25:40 UTC
Opps the patch does have a lot of unrelated stuff ... Would it be relatively strait forward to exclude those files? Otherwise I will try and create a clean version shortly.
Comment 10 Michael Dale 2011-01-11 19:46:08 UTC
Created attachment 7973 [details]
updated patch adds ie6-7 compatibility
Comment 11 Neil Kandalgaonkar 2011-01-11 21:50:41 UTC
@Michael Dale: attachment 7972 [details] is significantly smaller than 7815, so I assume you also removed the 'unrelated' stuff that you mentioned?
Comment 12 Neil Kandalgaonkar 2011-01-11 21:51:24 UTC
(In reply to comment #11)
> @Michael Dale: attachment 7972 [details] is significantly smaller than 7815, so I assume
> you also removed the 'unrelated' stuff that you mentioned?

I meant 7973.
Comment 13 Michael Dale 2011-01-11 21:57:43 UTC
yea... "just what you need"
Comment 14 Neil Kandalgaonkar 2011-01-26 19:22:37 UTC
Notes on the patch: need to move fallback-transform functionality to Resource Loader itself in PHP (where it already exists) -- in other words if you ask for grammars for zh-han, load grammar for zh.

See other FIXME marks within patch.
Comment 15 Niklas Laxström 2011-07-11 12:33:34 UTC
Neil, can you update us with the current status of this bug?
Comment 16 Neil Kandalgaonkar 2011-07-11 22:09:05 UTC
I'm queueing up a number of fixes that need to happen in this part of UW. I might address them this week (although they probably won't make it into deploy this week).
Comment 17 Neil Kandalgaonkar 2011-07-11 22:10:23 UTC
To clarify -- I need to fix a few more bugs with the pluralization in UW, and then it can be moved into general usage
Comment 18 Krinkle 2011-09-12 22:13:34 UTC
*** Bug 30731 has been marked as a duplicate of this bug. ***
Comment 19 Niklas Laxström 2011-09-20 09:22:19 UTC
Turning into a bug from enhancement. Motivation: JS should support i18n as well as core does.
Comment 20 Sumana Harihareswara 2011-11-08 13:26:08 UTC
Marking with the "reviewed" keyword since Neil gave a review in comment 14.
Comment 21 Santhosh Thottingal 2011-12-29 09:36:23 UTC
Using mw.jqueryMsg parser, support for PLURAL added in r107556
Comment 22 Krinkle 2012-06-19 22:16:39 UTC
Moving to JavaScript component. This is not related to the ResourceLoader framework (which loads the javascript files with mw.loader and registers the messages in mw.message)
Comment 23 Krinkle 2012-07-28 19:56:29 UTC
This should've been a tracking bug since these are three different features all implemented at different times.

But afaik the mediawiki.jqueryMsg module as of now supports all these three:
* {{PLURAL:}}
* {{GENDER:}}
* {{GRAMMAR:}}

Note You need to log in before you can comment on or make changes to this bug.