From: MatmaRex Date: Sat, 23 Mar 2013 22:21:46 +0000 (+0100) Subject: jquery.tablesorter: Support genitive month names X-Git-Tag: 1.31.0-rc.0~18776^2 X-Git-Url: https://git.cyclocoop.org/%27.WWW_URL.%27admin/?a=commitdiff_plain;h=65f11938e8a0555d4a2280b6b26bd585135c2cc9;p=lhc%2Fweb%2Fwiklou.git jquery.tablesorter: Support genitive month names Also use months names from mediawiki.language.months instead of from wgMonthNames and wgMonthNamesShort. Genitive months names are not available in that way. Bug: 46496 Change-Id: If758499fb2d2c2dd02013beaa9cee7b7b8827132 --- diff --git a/resources/Resources.php b/resources/Resources.php index b760b684a0..4c428f33fe 100644 --- a/resources/Resources.php +++ b/resources/Resources.php @@ -261,7 +261,10 @@ return array( 'scripts' => 'resources/jquery/jquery.tablesorter.js', 'styles' => 'resources/jquery/jquery.tablesorter.css', 'messages' => array( 'sort-descending', 'sort-ascending' ), - 'dependencies' => 'jquery.mwExtension', + 'dependencies' => array( + 'jquery.mwExtension', + 'mediawiki.language.months', + ), ), 'jquery.textSelection' => array( 'scripts' => 'resources/jquery/jquery.textSelection.js', diff --git a/resources/jquery/jquery.tablesorter.js b/resources/jquery/jquery.tablesorter.js index b71ef83739..bdc66751be 100644 --- a/resources/jquery/jquery.tablesorter.js +++ b/resources/jquery/jquery.tablesorter.js @@ -8,8 +8,9 @@ * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html * - * Depends on mw.config (wgDigitTransformTable, wgMonthNames, wgMonthNamesShort, - * wgDefaultDateFormat, wgContentLanguage) + * Depends on mw.config (wgDigitTransformTable, wgDefaultDateFormat, wgContentLanguage) + * and mw.language.months. + * * Uses 'tableSorterCollation' in mw.config (if available) */ /** @@ -476,12 +477,15 @@ var regex = []; ts.monthNames = {}; - for ( var i = 1; i < 13; i++ ) { - var name = mw.config.get( 'wgMonthNames' )[i].toLowerCase(); - ts.monthNames[name] = i; + for ( var i = 0; i < 12; i++ ) { + var name = mw.language.months.names[i].toLowerCase(); + ts.monthNames[name] = i + 1; + regex.push( $.escapeRE( name ) ); + name = mw.language.months.genitive[i].toLowerCase().replace( '.', '' ); + ts.monthNames[name] = i + 1; regex.push( $.escapeRE( name ) ); - name = mw.config.get( 'wgMonthNamesShort' )[i].toLowerCase().replace( '.', '' ); - ts.monthNames[name] = i; + name = mw.language.months.abbrev[i].toLowerCase(); + ts.monthNames[name] = i + 1; regex.push( $.escapeRE( name ) ); }