"Santhosh.thottingal" changed the status of MediaWiki.r112991 to "ok" URL: http://www.mediawiki.org/wiki/Special:Code/MediaWiki/112991
Old status: new New status: ok Commit summary for MediaWiki.r112991: [JSGrammar] Various minor tips, tricks and clean up. * mediawiki.language.js: -- Implement mw.language.getData and setData. This avoids having to repeat the "if data[langCode] === undefined" code pattern all over the place (which in practice often results in the check not being programmed or forgotten (such as in mw.lang.convertGrammar)). setData will initialize the object on-demand when needed. getData will return 'undefined' if the object doesn't exist (whereas mw.langauge.data[someCode].get would throw an exception if the object doesn't exist) -- Checking for $.isArray instead of thruthy-ness in convertPlural() and gender(). When isolated a truth check could be sufficient (it would fail when given a non-array thruthy value, but people simply shouldn't do that). However since the second check compares.length === 0 it makes sense to be sure it's an array first. -- Create 'var language' as local object (for shortcut and slight performance benefit), later exposing into mw.language -- Remove redundant truthy check for 'mw.language.convertPlural', this is defined the block below -- Few comment fixes (var types, integer vs. Number in javascript) -- Applying JS conventions * ResourceLoaderLanguageModule -- Rename module from 'language' to 'mediawiki.language.data' -- Simplify ResourceLoaderLanguageModule::getScript -- Add more elaborate FIXME note in ResourceLoaderLanguageModule::getModifiedTime. I haven't figured out how to properly cache and (more importantly) detect a change and purge the cache automatically for a PHP global in a ResourceLoader JS module _______________________________________________ MediaWiki-CodeReview mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-codereview
