cleanup and fixes for secondary data updates
[lhc/web/wiklou.git] / languages / classes / LanguageBe.php
1 <?php
2 /** Belarusian normative (Беларуская мова)
3 *
4 * This is still the version from Be-x-old, only duplicated for consistency of
5 * plural and grammar functions. If there are errors please send a patch.
6 *
7 * @ingroup Language
8 *
9 * @author Ævar Arnfjörð Bjarmason <avarab@gmail.com>
10 * @see http://be.wikipedia.org/wiki/Talk:LanguageBe.php
11 * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License
12 * @license http://www.gnu.org/copyleft/fdl.html GNU Free Documentation License
13 */
14
15 class LanguageBe extends Language {
16
17 /**
18 * @param $count int
19 * @param $forms array
20 *
21 * @return string
22 */
23 function convertPlural( $count, $forms ) {
24 if ( !count( $forms ) ) { return ''; }
25 // @todo FIXME: CLDR defines 4 plural forms instead of 3
26 // http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html
27 $forms = $this->preConvertPlural( $forms, 3 );
28
29 if ( $count > 10 && floor( ( $count % 100 ) / 10 ) == 1 ) {
30 return $forms[2];
31 } else {
32 switch ( $count % 10 ) {
33 case 1: return $forms[0];
34 case 2:
35 case 3:
36 case 4: return $forms[1];
37 default: return $forms[2];
38 }
39 }
40 }
41 }