http://www.mediawiki.org/wiki/Special:Code/MediaWiki/96809
Revision: 96809
Author: bawolff
Date: 2011-09-11 20:32:58 +0000 (Sun, 11 Sep 2011)
Log Message:
-----------
(follow-up r96767) Make {{DEFAULTSORT:..|noerror}} and noreplace i18n-izable.
Hopefully i did this right. I've never added a magic word before...
Modified Paths:
--------------
trunk/phase3/includes/parser/CoreParserFunctions.php
trunk/phase3/languages/messages/MessagesEn.php
Modified: trunk/phase3/includes/parser/CoreParserFunctions.php
===================================================================
--- trunk/phase3/includes/parser/CoreParserFunctions.php 2011-09-11
20:18:19 UTC (rev 96808)
+++ trunk/phase3/includes/parser/CoreParserFunctions.php 2011-09-11
20:32:58 UTC (rev 96809)
@@ -678,24 +678,27 @@
/**
* @param $parser Parser
* @param $text String The sortkey to use
- * @param $arg String Either "noreplace" or "noerror"
+ * @param $uarg String Either "noreplace" or "noerror" (in en)
* both suppress errors, and noreplace does nothing if
* a default sortkey already exists.
* @return string
*/
- public static function defaultsort( $parser, $text, $arg = '' ) {
+ public static function defaultsort( $parser, $text, $uarg = '' ) {
+ static $magicWords = null;
+ if ( is_null( $magicWords ) ) {
+ $magicWords = new MagicWordArray( array(
'defaultsort_noerror', 'defaultsort_noreplace' ) );
+ }
+ $arg = $magicWords->matchStartToEnd( $uarg );
+
$text = trim( $text );
- $arg = trim( strtolower( $arg ) );
if( strlen( $text ) == 0 )
return '';
$old = $parser->getCustomDefaultSort();
- if ( $old === false || $arg !== 'noreplace' ) {
+ if ( $old === false || $arg !== 'defaultsort_noreplace' ) {
$parser->setDefaultSort( $text );
}
- if( $old === false || $old == $text || $arg === 'noreplace'
- || $arg === 'noerror' )
- {
+ if( $old === false || $old == $text || $arg ) {
return '';
} else {
return( '<span class="error">' .
Modified: trunk/phase3/languages/messages/MessagesEn.php
===================================================================
--- trunk/phase3/languages/messages/MessagesEn.php 2011-09-11 20:18:19 UTC
(rev 96808)
+++ trunk/phase3/languages/messages/MessagesEn.php 2011-09-11 20:32:58 UTC
(rev 96809)
@@ -350,6 +350,8 @@
'url_path' => array( 0, 'PATH' ),
'url_wiki' => array( 0, 'WIKI' ),
'url_query' => array( 0, 'QUERY' ),
+ 'defaultsort_noerror' => array( 0, 'noerror' ),
+ 'defaultsort_noreplace' => array( 0, 'noreplace' ),
);
/**
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs