r64981 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r64980‎ | r64981 | r64982 >
Date:21:12, 12 April 2010
Author:siebrand
Status:ok (Comments)
Tags:
Comment:
(bug 23156) Commafy and search normalization update for Belarusian (Taraškievica). Contributed by Jaska Zedlik.
Modified paths:
  • /trunk/phase3/CREDITS (modified) (history)
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/languages/classes/LanguageBe_tarask.php (modified) (history)
  • /trunk/phase3/languages/messages/MessagesBe_tarask.php (modified) (history)

Diff [purge]

Index: trunk/phase3/CREDITS
@@ -81,6 +81,7 @@
8282 * Derk-Jan Hartman
8383 * FunPika
8484 * Ireas
 85+* Jaska Zedlik
8586 * Jeremy Baron
8687 * Jidanni
8788 * Jimmy Xu
Index: trunk/phase3/languages/messages/MessagesBe_tarask.php
@@ -235,7 +235,10 @@
236236 'DeletedContributions' => array( 'Выдалены_ўнёсак' ),
237237 );
238238
239 -$separatorTransformTable = array(',' => '.', '.' => ',' );
 239+$separatorTransformTable = array(
 240+ ',' => "\xc2\xa0", # nbsp
 241+ '.' => ','
 242+);
240243
241244 $linkTrail = '/^([абвгґджзеёжзійклмнопрстуўфхцчшыьэюяćčłńśšŭźža-z]+)(.*)$/sDu';
242245
Index: trunk/phase3/languages/classes/LanguageBe_tarask.php
@@ -4,7 +4,7 @@
55 * @ingroup Language
66 *
77 * @author Ævar Arnfjörð Bjarmason <avarab@gmail.com>
8 - * @link http://be.wikipedia.org/wiki/Talk:LanguageBe.php
 8+ * @link http://be-x-old.wikipedia.org/wiki/Project_talk:LanguageBe_tarask.php
99 * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License
1010 * @license http://www.gnu.org/copyleft/fdl.html GNU Free Documentation License
1111 */
@@ -40,4 +40,37 @@
4141 }
4242 }
4343 }
 44+
 45+ /*
 46+ * The Belarusian language uses apostrophe sign,
 47+ * but the characters used for this could be both U+0027 and U+2019.
 48+ * This function unifies apostrophe sign in search index values
 49+ * to enable seach using both apostrophe signs.
 50+ */
 51+ function normalizeForSearch( $string ) {
 52+ wfProfileIn( __METHOD__ );
 53+
 54+ # MySQL fulltext index doesn't grok utf-8, so we
 55+ # need to fold cases and convert to hex
 56+
 57+ # Replacing apostrophe sign U+2019 with U+0027
 58+ $s = preg_replace( '/\xe2\x80\x99/', '\'', $string );
 59+
 60+ $s = parent::normalizeForSearch( $s );
 61+
 62+ wfProfileOut( __METHOD__ );
 63+ return $s;
 64+ }
 65+
 66+ /*
 67+ * Four-digit number should be without group commas (spaces)
 68+ * So "1 234 567", "12 345" but "1234"
 69+ */
 70+ function commafy($_) {
 71+ if (preg_match('/^-?\d{1,4}(\.\d*)?$/',$_)) {
 72+ return $_;
 73+ } else {
 74+ return strrev((string)preg_replace('/(\d{3})(?=\d)(?!\d*\.)/','$1,',strrev($_)));
 75+ }
 76+ }
4477 }
Index: trunk/phase3/RELEASE-NOTES
@@ -101,7 +101,8 @@
102102 * (bug 16817) Group names in user rights log are now singular and in lowercase
103103 * Special:Preferences no longer crashes if the wiki default date formatting
104104 style is not valid for the user's interface language
105 -* (bug 23167) Check the watch checkbox by default if the watchcreations preference is set
 105+* (bug 23167) Check the watch checkbox by default if the watchcreations
 106+ preference is set
106107 * Maintenance script cleanupTitles is now able to fix titles stored
107108 in a negative namespace (which is invalid).
108109
@@ -123,6 +124,9 @@
124125 * Latgalian (ltg) (new)
125126 * Rusyn (rue) (new)
126127
 128+* (bug 23156) Commafy and search normalization updated for Belarusian
 129+ (Tara�kievica)
 130+
127131 == Compatibility ==
128132
129133 MediaWiki 1.17 requires PHP 5.1 (5.2 recommended). PHP 4 is no longer

Follow-up revisions

RevisionCommit summaryAuthorDate
r77348Test normalizeForSearch and commafy...hashar11:29, 27 November 2010

Comments

#Comment by Hashar (talk | contribs)   11:29, 27 November 2010

Tests added with r77348. Marking ok.

Status & tagging log