96ad9467c3dc07f1d4e5a8c99c4cb23f13b189f0
[lhc/web/wiklou.git] / languages / classes / LanguageBe_tarask.php
1 <?php
2 /** Belarusian in Taraškievica orthography (Беларуская тарашкевіца)
3 *
4 * @ingroup Language
5 *
6 * @author Ævar Arnfjörð Bjarmason <avarab@gmail.com>
7 * @link http://be.wikipedia.org/wiki/Talk:LanguageBe.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
10 */
11
12 class LanguageBe_tarask extends Language {
13 /**
14 * Plural form transformations
15 *
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...)
19 */
20
21 function convertPlural( $count, $forms ) {
22 if ( !count($forms) ) { return ''; }
23
24 //if no number with word, then use $form[0] for singular and $form[1] for plural or zero
25 if( count($forms) === 2 ) return $count == 1 ? $forms[0] : $forms[1];
26
27 // FIXME: CLDR defines 4 plural forms instead of 3
28 // http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html
29 $forms = $this->preConvertPlural( $forms, 3 );
30
31 if ($count > 10 && floor(($count % 100) / 10) == 1) {
32 return $forms[2];
33 } else {
34 switch ($count % 10) {
35 case 1: return $forms[0];
36 case 2:
37 case 3:
38 case 4: return $forms[1];
39 default: return $forms[2];
40 }
41 }
42 }
43 }