From 923329f60fea0641c3324a6a1a7f9fbeb653f91e Mon Sep 17 00:00:00 2001 From: Siebrand Mazeland Date: Mon, 12 Apr 2010 21:12:34 +0000 Subject: [PATCH] =?utf8?q?(bug=2023156)=20Commafy=20and=20search=20normali?= =?utf8?q?zation=20update=20for=20Belarusian=20(Tara=C5=A1kievica).=20Cont?= =?utf8?q?ributed=20by=20Jaska=20Zedlik.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- CREDITS | 1 + RELEASE-NOTES | 6 +++- languages/classes/LanguageBe_tarask.php | 35 +++++++++++++++++++++++- languages/messages/MessagesBe_tarask.php | 5 +++- 4 files changed, 44 insertions(+), 3 deletions(-) diff --git a/CREDITS b/CREDITS index 31403d6042..f256c369db 100644 --- 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 diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 313512aa39..e63f27f7cd 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -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škievica) + == Compatibility == MediaWiki 1.17 requires PHP 5.1 (5.2 recommended). PHP 4 is no longer diff --git a/languages/classes/LanguageBe_tarask.php b/languages/classes/LanguageBe_tarask.php index 96ad9467c3..82fc294330 100644 --- a/languages/classes/LanguageBe_tarask.php +++ b/languages/classes/LanguageBe_tarask.php @@ -4,7 +4,7 @@ * @ingroup Language * * @author Ævar Arnfjörð Bjarmason - * @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($_))); + } + } } diff --git a/languages/messages/MessagesBe_tarask.php b/languages/messages/MessagesBe_tarask.php index 2d5a99ee24..3eacfde121 100644 --- a/languages/messages/MessagesBe_tarask.php +++ b/languages/messages/MessagesBe_tarask.php @@ -235,7 +235,10 @@ $specialPageAliases = array( 'DeletedContributions' => array( 'Выдалены_ўнёсак' ), ); -$separatorTransformTable = array(',' => '.', '.' => ',' ); +$separatorTransformTable = array( + ',' => "\xc2\xa0", # nbsp + '.' => ',' +); $linkTrail = '/^([абвгґджзеёжзійклмнопрстуўфхцчшыьэюяćčłńśšŭźža-z]+)(.*)$/sDu'; -- 2.20.1