"NeilK" posted a comment on MediaWiki.r107556. URL: http://www.mediawiki.org/wiki/Special:Code/MediaWiki/107556#c28807
Commit summary for MediaWiki.r107556: Use jqueryMsg wikitext parser to parse interface messages at client side. Support for PLURAL in javascript. NeilK's comment: So cryptic! :) Anyway, here's what I had in mind. The parser part of mediawiki.language.parser.js was generated with PEG, so it should be possible to port to PHP. Fortunately, the original JS generated by that PEG library will be easy to port to PHP. Unfortunately, I hand-hacked the generated javascript to be significantly slimmer. And then I added maybe a few trivial features. Suggested procedure: 0) Port the relevant tests in test/jasmine/ to PHP 1) Backport any changes in mw.jqueryMsg.js to mw.jqueryMsg.peg (you might have to look at the earlier incarnation, mediawiki.language.parser.js in UploadWizard/resources. 2) Use http://pegjs.majda.cz/ to generate from that PEG. You will get some very procedural looking JS. 3) Port that to JS, which should be really easy. 4) Check it with the tests 5) Do some magic with resourceloader to allow requesting stuff in a "parsed" format. And that would solve the frontend bloat problem, although this is as far as I can tell at least a week's work to get really right, and really only save like 6K. (You'd still need 1K to use it). But it may be worth it. Also, at the same time, I have been doing some speed tests... even without parsing there is a speed penalty for using jQueryMsg (it's 1/4-1/5 the speed). This may not matter on the average page where you are showing just a few hundred messages max. I have an uncommitted change which will speed things up considerably though, still working on it. _______________________________________________ MediaWiki-CodeReview mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-codereview
