From: Santhosh Thottingal Date: Mon, 18 Mar 2013 08:11:46 +0000 (+0530) Subject: Move plural rules of Samogitian(sgs) to plurals-mediawiki.xml X-Git-Tag: 1.31.0-rc.0~20302^2 X-Git-Url: https://git.heureux-cyclage.org/?a=commitdiff_plain;ds=sidebyside;h=43f5eb600b96bd9eabfc4ca10c75f93bbbf2b269;p=lhc%2Fweb%2Fwiklou.git Move plural rules of Samogitian(sgs) to plurals-mediawiki.xml * CLDR does not define plural rules for sgs. * Port the plural rules present in LanguageSgs.php to CLDR plural definition syntax * Remove LanguageSgs.php * Update the tests, reorder/rename the plural form names Change-Id: I44658402d69a6805cdfd189fe780eadee94056c7 --- diff --git a/languages/classes/LanguageSgs.php b/languages/classes/LanguageSgs.php deleted file mode 100644 index 0c74e45037..0000000000 --- a/languages/classes/LanguageSgs.php +++ /dev/null @@ -1,52 +0,0 @@ -preConvertPlural( $forms, 4 ); - - $count = abs( $count ); - if ( $count == 0 || ( $count % 100 === 0 || ( $count % 100 >= 10 && $count % 100 < 20 ) ) ) { - return $forms[2]; - } elseif ( $count % 10 === 1 ) { - return $forms[0]; - } elseif ( $count % 10 === 2 ) { - return $forms[1]; - } else { - return $forms[3]; - } - } -} diff --git a/languages/data/plurals-mediawiki.xml b/languages/data/plurals-mediawiki.xml index 5c4f193c71..07e157a367 100644 --- a/languages/data/plurals-mediawiki.xml +++ b/languages/data/plurals-mediawiki.xml @@ -27,5 +27,10 @@ n in 0..1 + + n mod 10 is 1 and n mod 100 is not 11 + n mod 10 is 2 and n mod 100 is not 12 + n is 0 or n mod 100 is 0 or n mod 100 in 10..19 + diff --git a/tests/phpunit/languages/LanguageSgsTest.php b/tests/phpunit/languages/LanguageSgsTest.php index 8a6e979f14..95e6346266 100644 --- a/tests/phpunit/languages/LanguageSgsTest.php +++ b/tests/phpunit/languages/LanguageSgsTest.php @@ -10,25 +10,25 @@ class LanguageSgsTest extends LanguageClassesTestCase { /** @dataProvider providePluralAllForms */ function testPluralAllForms( $result, $value ) { - $forms = array( 'one', 'few', 'many', 'other' ); + $forms = array( 'one', 'two', 'few', 'other' ); $this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) ); } function providePluralAllForms() { return array( - array( 'many', 0 ), + array( 'few', 0 ), array( 'one', 1 ), - array( 'few', 2 ), + array( 'two', 2 ), array( 'other', 3 ), - array( 'many', 10 ), - array( 'many', 11 ), - array( 'many', 12 ), - array( 'many', 19 ), + array( 'few', 10 ), + array( 'few', 11 ), + array( 'few', 12 ), + array( 'few', 19 ), array( 'other', 20 ), - array( 'many', 100 ), + array( 'few', 100 ), array( 'one', 101 ), - array( 'many', 111 ), - array( 'many', 112 ), + array( 'few', 111 ), + array( 'few', 112 ), ); }