Last modified: 2012-07-31 18:09:54 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 T40381, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 38381 - Support "int-hack" in mediawiki javascript parser
Support "int-hack" in mediawiki javascript parser
Status: NEW
Product: MediaWiki
Classification: Unclassified
JavaScript (Other open bugs)
1.20.x
All All
: Low enhancement (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-07-13 19:06 UTC by Mark Holmquist
Modified: 2012-07-31 18:09 UTC (History)
3 users (show)

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


Attachments

Description Mark Holmquist 2012-07-13 19:06:24 UTC
Background: http://www.mediawiki.org/wiki/Localisation#Messages_quoting_each_other

I have the following message in an i18n file:

'ethereditor-warn-others' => 'Warning: Some other users are currently editing this page in a collaborative session using the EtherEditor extension. While you are welcome to keep editing here, their changes may conflict with yours. Please consider clicking the "{{int:ethereditor-collaborate-button}}" button in the top right of the page screen to join them, and avoid merge conflicts.'

This is a great thing and all, since I don't want people to need to update this message if the ethereditor-collaborate-button message gets changed. OK, good stuff.

However, the JavaScript message object has two huge problems with this:

1. The JS message object doesn't even glance at the {{int:....}} part, just leaves it.
2. Even if it did look at it, I never included 'ethereditor-collaborate-button' in the required messages for this module, so there would be exactly no way for the library to sanely handle the int-hack method.

So, possible solutions:

1. Compile the int-hack bits of the message on the server before it gets sent to the client. This isn't ideal, since the client couldn't modify the message if necessary (for example, I use a message in the same extension to generate a regular expression).
2. Auto-include the int-hacked messages (in this case, ethereditor-collaborate-button) in the resource loader's loaded messages, and then consider {{int:}} parts of a message while parsing. This would take some doing, but it's possible. Also, a potential problem (and this is perhaps a consideration for the entire l10n system, not just client-side) is that {{int}} is a valid template on some wikis. I'm not sure if that's important, maybe if the parser looks for {{int:<something>}}, there won't be overlap with {{int|something}}.

Thanks!
Comment 1 Krinkle 2012-07-20 03:46:40 UTC
Interesting, the 2nd solution sounds like the better solution in this case keeping in mind the way messages are loaded and parsed. Also note that the client side parser does support parser functions in general (e.g. it has logic for detecting them, this is used for {{GRAMMAR:}} and {{PLURAL:}}).

Changing to be an 'enhancement' instead of a bug, as the status quo is that that is not supported on the client, so messages intended for client-side use should not contain these in the first case as they were never supported in the past either.

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


Navigation
Links