Change the default collation from strtoupper to Language::uc, so that non-ascii chara...
authorBrian Wolff <bawolff@users.mediawiki.org>
Mon, 17 Jan 2011 06:27:49 +0000 (06:27 +0000)
committerBrian Wolff <bawolff@users.mediawiki.org>
Mon, 17 Jan 2011 06:27:49 +0000 (06:27 +0000)
I know the uppercase thing is just a standby until a real collation function is written. However in the
mean time, i think it'd be really weird for a wiki with $wgCapitalLinks = false to suddenly have
[[a]] and [[A]] sort under the same letter in a category page, but [[Ä]] and [[ä]] sort no where
near each other, even though on a capitalized wiki they would be the same page.

See discussion on r69816.

Also fix an issue with maintenance/updateCollation.php, where php thinks
that 'uppercase' == 0 (?!). I don't really know what the deal with that
is, but using a ! instead of == 0 seems to fix it. (Follow-up r69961)

includes/DefaultSettings.php
languages/Language.php
maintenance/updateCollation.php

index 43d5150..18044e9 100644 (file)
@@ -4616,10 +4616,10 @@ $wgCategoryPagingLimit = 200;
  * for all rows where cl_collation != $wgCategoryCollation and regenerates
  * cl_sortkey based on the page name and cl_sortkey_prefix.
  *
- * Currently only supports 'uppercase', which just uppercases the string.  This
+ * Currently only supports 'uppercase2', which just uppercases the string.  This
  * is a dummy collation, to be replaced later by real ones.
  */
-$wgCategoryCollation = 'uppercase';
+$wgCategoryCollation = 'uppercase2';
 
 /** @} */ # End categories }
 
index 62a2b11..1d3528f 100644 (file)
@@ -3010,7 +3010,7 @@ class Language {
         */
        public function convertToSortkey( $string ) {
                # Fake function for now
-               return strtoupper( $string );
+               return $this->uc( $string );
        }
 
        /**
@@ -3040,6 +3040,6 @@ class Language {
                if ( $string[0] == "\0" ) {
                        $string = substr( $string, 1 );
                }
-               return strtoupper( $this->firstChar( $string ) );
+               return $this->uc( $this->firstChar( $string ) );
        }
 }
index 67b6b10..9e8dd33 100644 (file)
@@ -80,7 +80,7 @@ TEXT;
                        $dbw->begin();
                        foreach ( $res as $row ) {
                                $title = Title::newFromRow( $row );
-                               if ( $row->cl_collation == 0 ) {
+                               if ( !$row->cl_collation ) {
                                        # This is an old-style row, so the sortkey needs to be
                                        # converted.
                                        if ( $row->cl_sortkey == $title->getText()