Hi,
The current mw.msg javascript api of mediawiki is not capable or
handling messages with PLURAL, and GENDER syntax. This is a
limitation for the extensions/core to show localized messages
according to gender, plural context. To make sure that the javascript
based message parsing system function same as the php message handing,
Neil had written mediawiki.jqueryMsg.js and he had added it to the
core recently. It is a wikitext parser written in javascript. If we
integrate mw.jqueryMsg with ms.msg, we can make sure that messages
with PLURAL, GENDER, GRAMMAR etc can be handled very well at client
side too.
This change was done in r107556[1], but there was a discussion about
whether mw.jqueryMsg should be added as an optional dependency or not.
r107556 make it load in all pages. But Krinkle commented(see the CR
comments) that it can be added as a dependency to extensions which
require PLURAL/GENDER and he don't see a reason to make mw.jqueryMsg
load everywhere.
1. It is true that currently no messages use PLURAL/GENDER for
messages to be processed at javascript. But when we support this
feature, there will be many valid use cases. Whenever we show
numbers,(eg: "there are 6 items") in any language, plural support is
must. Similarly language like Arabic, Russian etc require Gender,
Grammar too.
2. If we can provide a single abstraction mw.msg around all kind of
l10n messages, that would be a good idea. If a message contains
{{PLURAL}}, doing the message handling in a different way is a bit
odd.
3. If we dynamically load mw.jqueryMsg using mw.loader, it is going to
be asynchronous, and I think that will demand a change in the way
mw.msg is called now.
The concerns are increased page size and may be performance. Niklas
observed that the impact is about 2 KiB in normal mode and 7 KiB in
debug mode. The benefit is better localization of mediawiki.
So what could be the best way to use capabilities of mw.jqueryMsg for
mw.msg by keeping the abstraction that mw.Message and mw.msg provide
now.
[1]
https://www.mediawiki.org/wiki/Special:Code/MediaWiki/107556
Thanks
Santhosh