Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F6633
be-tarask-apostrophe-1.16.patch
Public
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Authored By
•
bzimport
Nov 21 2014, 11:02 PM
2014-11-21 23:02:46 (UTC+0)
Size
2 KB
Referenced Files
None
Subscribers
None
be-tarask-apostrophe-1.16.patch
View Options
Index: languages/classes/LanguageBe_tarask.php
===================================================================
--- languages/classes/LanguageBe_tarask.php (revision 64943)
+++ languages/classes/LanguageBe_tarask.php (working copy)
@@ -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 @@
}
}
}
+
+ /*
+ * 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: languages/messages/MessagesBe_tarask.php
===================================================================
--- languages/messages/MessagesBe_tarask.php (revision 64943)
+++ languages/messages/MessagesBe_tarask.php (working copy)
@@ -234,7 +234,10 @@
'DeletedContributions' => array( 'Выдалены_ўнёсак' ),
);
-$separatorTransformTable = array(',' => '.', '.' => ',' );
+$separatorTransformTable = array(
+ ',' => "\xc2\xa0", # nbsp
+ '.' => ','
+);
$linkTrail = '/^([абвгґджзеёжзійклмнопрстуўфхцчшыьэюяćčłńśšŭźža-z]+)(.*)$/sDu';
File Metadata
Details
Attached
Mime Type
text/x-diff
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
6173
Default Alt Text
be-tarask-apostrophe-1.16.patch (2 KB)
Attached To
Mode
T25156: Commafy and search normalization fixes for Belarusian (Taraškievica)
Attached
Detach File
Event Timeline
Log In to Comment