Page MenuHomePhabricator

Add support for PLURAL, GENDER and GRAMMAR in a javascript message parser
Closed, ResolvedPublic

Description

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.


Version: 1.17.x
Severity: normal

Details

Reference
bz20962

Event Timeline

bzimport raised the priority of this task from to Normal.Nov 21 2014, 10:59 PM
bzimport set Reference to bz20962.
bzimport added a subscriber: Unknown Object (MLST).
siebrand created this task.Oct 2 2009, 4:42 PM

mdale wrote:

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?

mdale wrote:

PLURAL support is coming along ... here is a demo page

http://prototype.wikimedia.org/s-2/js2/mwEmbed/tests/testLang.html

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.

mdale wrote:

Updated PLURAL test page. http://prototype.wikimedia.org/s-9/extensions/JS2Support/tests/testLang.html

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.

Very nice, Michael. Great work.

mdale wrote:

mediawiki trunk parser patch

the mediawiki message parser patch ( see /Special:BlankPage?action=mw.language.parserTest&debug=true# to run tests )

attachment mediaWiki_trunk.message.parser.patch ignored as obsolete

mdale wrote:

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:
/Special:BlankPage?action=mw.language.parserTest&debug=true#

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.

The attached patch seems to have a lots of unrelated whitespace changes. Can you take those out of the patch?

mdale wrote:

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.

mdale wrote:

updated patch adds ie6-7 compatibility

Attached:

neilk wrote:

@Michael Dale: attachment 7972 is significantly smaller than 7815, so I assume you also removed the 'unrelated' stuff that you mentioned?

neilk wrote:

(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.

mdale wrote:

yea... "just what you need"

neilk wrote:

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.

Neil, can you update us with the current status of this bug?

neilk wrote:

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).

neilk wrote:

To clarify -- I need to fix a few more bugs with the pluralization in UW, and then it can be moved into general usage

  • Bug 30731 has been marked as a duplicate of this bug. ***

Turning into a bug from enhancement. Motivation: JS should support i18n as well as core does.

sumanah wrote:

Marking with the "reviewed" keyword since Neil gave a review in comment 14.

Using mw.jqueryMsg parser, support for PLURAL added in r107556

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)

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:}}