(bug 30722) Add an identity collation that sorts things based on what the unicode code point is (aka pre-1.17 behaviour).
I'm tagging this 1.18 because the original bug was for iswiktionary wanting it, so it'd be nice to get it in 1.18.
This commit is contained in:
parent
9de8fa4454
commit
a658eee7fc
4 changed files with 31 additions and 1 deletions
|
|
@ -209,6 +209,7 @@ production.
|
|||
* Introduced $wgVaryOnXFPForAPI which will cause the API to send
|
||||
Vary: X-Forwarded-Proto headers.
|
||||
* New maintenance script to refresh image metadata (maintenance/refreshImageMetadata.php)
|
||||
* (bug 30722) Add a new collation that sorts categories in ascii sort order.
|
||||
|
||||
=== Bug fixes in 1.18 ===
|
||||
* mw.util.getScript has been implemented (like wfScript in GlobalFunctions.php)
|
||||
|
|
|
|||
|
|
@ -118,6 +118,7 @@ $wgAutoloadLocalClasses = array(
|
|||
'HttpRequest' => 'includes/HttpFunctions.old.php',
|
||||
'IContextSource' => 'includes/RequestContext.php',
|
||||
'IcuCollation' => 'includes/Collation.php',
|
||||
'IdentityCollation' => 'includes/Collation.php',
|
||||
'ImageGallery' => 'includes/ImageGallery.php',
|
||||
'ImageHistoryList' => 'includes/ImagePage.php',
|
||||
'ImageHistoryPseudoPager' => 'includes/ImagePage.php',
|
||||
|
|
|
|||
|
|
@ -23,6 +23,8 @@ abstract class Collation {
|
|||
switch( $collationName ) {
|
||||
case 'uppercase':
|
||||
return new UppercaseCollation;
|
||||
case 'identity':
|
||||
return new IdentityCollation;
|
||||
case 'uca-default':
|
||||
return new IcuCollation( 'root' );
|
||||
default:
|
||||
|
|
@ -99,6 +101,30 @@ class UppercaseCollation extends Collation {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Collation class that's essentially a no-op.
|
||||
*
|
||||
* Does sorting based on binary value of the string.
|
||||
* Like how things were pre 1.17.
|
||||
*/
|
||||
class IdentityCollation extends Collation {
|
||||
|
||||
function getSortKey( $string ) {
|
||||
return $string;
|
||||
}
|
||||
|
||||
function getFirstLetter( $string ) {
|
||||
global $wgContLang;
|
||||
// Copied from UppercaseCollation.
|
||||
// I'm kind of unclear on when this could happen...
|
||||
if ( $string[0] == "\0" ) {
|
||||
$string = substr( $string, 1 );
|
||||
}
|
||||
return $wgContLang->firstChar( $string );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class IcuCollation extends Collation {
|
||||
var $primaryCollator, $mainCollator, $locale;
|
||||
var $firstLetterData;
|
||||
|
|
|
|||
|
|
@ -4879,6 +4879,8 @@ $wgCategoryPagingLimit = 200;
|
|||
*
|
||||
* - uppercase: Converts the category name to upper case, and sorts by that.
|
||||
*
|
||||
* - identity: Does no conversion. Sorts by binary value of the string.
|
||||
*
|
||||
* - uca-default: Provides access to the Unicode Collation Algorithm with
|
||||
* the default element table. This is a compromise collation which sorts
|
||||
* all languages in a mediocre way. However, it is better than "uppercase".
|
||||
|
|
@ -4892,7 +4894,7 @@ $wgCategoryPagingLimit = 200;
|
|||
* the sort keys in the database.
|
||||
*
|
||||
* Extensions can define there own collations by subclassing Collation
|
||||
* and using the class name as the value of this variable.
|
||||
* and using the Collation::factory hook.
|
||||
*/
|
||||
$wgCategoryCollation = 'uppercase';
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue