http://www.mediawiki.org/wiki/Special:Code/MediaWiki/64981

Revision: 64981
Author:   siebrand
Date:     2010-04-12 21:12:34 +0000 (Mon, 12 Apr 2010)

Log Message:
-----------
(bug 23156) Commafy and search normalization update for Belarusian 
(Tara?\197?\161kievica). Contributed by Jaska Zedlik.

Modified Paths:
--------------
    trunk/phase3/CREDITS
    trunk/phase3/RELEASE-NOTES
    trunk/phase3/languages/classes/LanguageBe_tarask.php
    trunk/phase3/languages/messages/MessagesBe_tarask.php

Modified: trunk/phase3/CREDITS
===================================================================
--- trunk/phase3/CREDITS        2010-04-12 20:56:37 UTC (rev 64980)
+++ trunk/phase3/CREDITS        2010-04-12 21:12:34 UTC (rev 64981)
@@ -81,6 +81,7 @@
 * Derk-Jan Hartman
 * FunPika
 * Ireas
+* Jaska Zedlik
 * Jeremy Baron
 * Jidanni
 * Jimmy Xu

Modified: trunk/phase3/RELEASE-NOTES
===================================================================
--- trunk/phase3/RELEASE-NOTES  2010-04-12 20:56:37 UTC (rev 64980)
+++ trunk/phase3/RELEASE-NOTES  2010-04-12 21:12:34 UTC (rev 64981)
@@ -101,7 +101,8 @@
 * (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 @@
 * Latgalian (ltg) (new)
 * Rusyn (rue) (new)
 
+* (bug 23156) Commafy and search normalization updated for Belarusian
+  (Tara\x9Akievica)
+
 == Compatibility ==
 
 MediaWiki 1.17 requires PHP 5.1 (5.2 recommended). PHP 4 is no longer

Modified: trunk/phase3/languages/classes/LanguageBe_tarask.php
===================================================================
--- trunk/phase3/languages/classes/LanguageBe_tarask.php        2010-04-12 
20:56:37 UTC (rev 64980)
+++ trunk/phase3/languages/classes/LanguageBe_tarask.php        2010-04-12 
21:12:34 UTC (rev 64981)
@@ -4,7 +4,7 @@
   * @ingroup Language
   *
   * @author Ævar Arnfjörð Bjarmason <ava...@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 @@
                        }
                }
        }
+       
+       /*
+        * 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($_)));
+               }
+       }
 }

Modified: trunk/phase3/languages/messages/MessagesBe_tarask.php
===================================================================
--- trunk/phase3/languages/messages/MessagesBe_tarask.php       2010-04-12 
20:56:37 UTC (rev 64980)
+++ trunk/phase3/languages/messages/MessagesBe_tarask.php       2010-04-12 
21:12:34 UTC (rev 64981)
@@ -235,7 +235,10 @@
        'DeletedContributions'      => array( 'Выдалены_ўнёсак' ),
 );
 
-$separatorTransformTable = array(',' => '.', '.' => ',' );
+$separatorTransformTable = array(
+       ',' => "\xc2\xa0", # nbsp
+       '.' => ','
+);
 
 $linkTrail = '/^([абвгґджзеёжзійклмнопрстуўфхцчшыьэюяćčłńśšŭźža-z]+)(.*)$/sDu';
 



_______________________________________________
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to