(bug 23156) Commafy and search normalization update for Belarusian (Taraškievica...
authorSiebrand Mazeland <siebrand@users.mediawiki.org>
Mon, 12 Apr 2010 21:12:34 +0000 (21:12 +0000)
committerSiebrand Mazeland <siebrand@users.mediawiki.org>
Mon, 12 Apr 2010 21:12:34 +0000 (21:12 +0000)
CREDITS
RELEASE-NOTES
languages/classes/LanguageBe_tarask.php
languages/messages/MessagesBe_tarask.php

diff --git a/CREDITS b/CREDITS
index 31403d6..f256c36 100644 (file)
--- a/CREDITS
+++ b/CREDITS
@@ -81,6 +81,7 @@ following names for their contribution to the product.
 * Derk-Jan Hartman
 * FunPika
 * Ireas
+* Jaska Zedlik
 * Jeremy Baron
 * Jidanni
 * Jimmy Xu
index 313512a..e63f27f 100644 (file)
@@ -101,7 +101,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * (bug 16817) Group names in user rights log are now singular and in lowercase
 * Special:Preferences no longer crashes if the wiki default date formatting
   style is not valid for the user's interface language
-* (bug 23167) Check the watch checkbox by default if the watchcreations preference is set
+* (bug 23167) Check the watch checkbox by default if the watchcreations
+  preference is set
 * Maintenance script cleanupTitles is now able to fix titles stored
 in a negative namespace (which is invalid).
 
@@ -123,6 +124,9 @@ changes to languages because of MediaZilla reports.
 * Latgalian (ltg) (new)
 * Rusyn (rue) (new)
 
+* (bug 23156) Commafy and search normalization updated for Belarusian
+  (Tara\9akievica)
+
 == Compatibility ==
 
 MediaWiki 1.17 requires PHP 5.1 (5.2 recommended). PHP 4 is no longer
index 96ad946..82fc294 100644 (file)
@@ -4,7 +4,7 @@
   * @ingroup Language
   *
   * @author Ævar Arnfjörð Bjarmason <avarab@gmail.com>
-  * @link http://be.wikipedia.org/wiki/Talk:LanguageBe.php
+  * @link http://be-x-old.wikipedia.org/wiki/Project_talk:LanguageBe_tarask.php
   * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License
   * @license http://www.gnu.org/copyleft/fdl.html GNU Free Documentation License
   */
@@ -40,4 +40,37 @@ class LanguageBe_tarask extends Language {
                        }
                }
        }
+       
+       /*
+        * The Belarusian language uses apostrophe sign, 
+        * but the characters used for this could be both U+0027 and U+2019.
+        * This function unifies apostrophe sign in search index values
+        * to enable seach using both apostrophe signs.
+        */
+       function normalizeForSearch( $string ) {
+               wfProfileIn( __METHOD__ );
+
+               # MySQL fulltext index doesn't grok utf-8, so we
+               # need to fold cases and convert to hex
+
+               # Replacing apostrophe sign U+2019 with U+0027
+               $s = preg_replace( '/\xe2\x80\x99/', '\'', $string );
+
+               $s = parent::normalizeForSearch( $s );
+
+               wfProfileOut( __METHOD__ );
+               return $s;
+       }
+       
+       /*
+        * Four-digit number should be without group commas (spaces)
+        * So "1 234 567", "12 345" but "1234"
+        */
+       function commafy($_) {
+               if (preg_match('/^-?\d{1,4}(\.\d*)?$/',$_)) {
+                       return $_;
+               } else {
+                       return strrev((string)preg_replace('/(\d{3})(?=\d)(?!\d*\.)/','$1,',strrev($_)));
+               }
+       }
 }
index 2d5a99e..3eacfde 100644 (file)
@@ -235,7 +235,10 @@ $specialPageAliases = array(
        'DeletedContributions'      => array( 'Выдалены_ўнёсак' ),
 );
 
-$separatorTransformTable = array(',' => '.', '.' => ',' );
+$separatorTransformTable = array(
+       ',' => "\xc2\xa0", # nbsp
+       '.' => ','
+);
 
 $linkTrail = '/^([абвгґджзеёжзійклмнопрстуўфхцчшыьэюяćčłńśšŭźža-z]+)(.*)$/sDu';