9acc4435f201c9ba063b013a3026d10cc71ed651
2 /** Belarusian in Taraškievica orthography (Беларуская тарашкевіца)
6 * @author Ævar Arnfjörð Bjarmason <avarab@gmail.com>
7 * @link http://be-x-old.wikipedia.org/wiki/Project_talk:LanguageBe_tarask.php
8 * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License
9 * @license http://www.gnu.org/copyleft/fdl.html GNU Free Documentation License
12 class LanguageBe_tarask
extends Language
{
14 * Plural form transformations
16 * $wordform1 - singular form (for 1, 21, 31, 41...)
17 * $wordform2 - plural form (for 2, 3, 4, 22, 23, 24, 32, 33, 34...)
18 * $wordform3 - plural form (for 0, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 25, 26...)
27 function convertPlural( $count, $forms ) {
28 if ( !count( $forms ) ) { return ''; }
30 // If the actual number is not mentioned in the expression, then just two forms are enough:
31 // singular for $count == 1
32 // plural for $count != 1
33 // For example, "This user belongs to {{PLURAL:$1|one group|several groups}}."
34 if ( count( $forms ) === 2 ) return $count == 1 ?
$forms[0] : $forms[1];
36 // @todo FIXME: CLDR defines 4 plural forms instead of 3
37 // http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html
38 $forms = $this->preConvertPlural( $forms, 3 );
40 if ( $count > 10 && floor( ( $count %
100 ) / 10 ) == 1 ) {
43 switch ( $count %
10 ) {
44 case 1: return $forms[0];
47 case 4: return $forms[1];
48 default: return $forms[2];
54 * The Belarusian language uses apostrophe sign,
55 * but the characters used for this could be both U+0027 and U+2019.
56 * This function unifies apostrophe sign in search index values
57 * to enable seach using both apostrophe signs.
59 * @param $string string
63 function normalizeForSearch( $string ) {
64 wfProfileIn( __METHOD__
);
66 # MySQL fulltext index doesn't grok utf-8, so we
67 # need to fold cases and convert to hex
69 # Replacing apostrophe sign U+2019 with U+0027
70 $s = preg_replace( '/\xe2\x80\x99/', '\'', $string );
72 $s = parent
::normalizeForSearch( $s );
74 wfProfileOut( __METHOD__
);
79 * Four-digit number should be without group commas (spaces)
80 * So "1 234 567", "12 345" but "1234"
86 function commafy( $_ ) {
87 if ( preg_match( '/^-?\d{1,4}(\.\d*)?$/', $_ ) ) {
90 return strrev( (string)preg_replace( '/(\d{3})(?=\d)(?!\d*\.)/', '$1,', strrev( $_ ) ) );