wiki.techinc.nl/tests/phpunit/languages/classes/LanguageHyTest.php

36 lines
847 B
PHP
Raw Normal View History

<?php
/**
* @author Santhosh Thottingal
* @copyright Copyright © 2012, Santhosh Thottingal
* @file
*/
Update plural rules to CLDR 24 Updated plurals.xml with new data from CLDR 24. This data is according to UTS #35 Rev 33. Update the CLDRPluralRuleParser.js to version 1.1 from upstream https://github.com/santhoshtr/CLDRPluralRuleParser Changes to the plural rules: * Hebrew override removed since CLDR 24 matches with MW plural rules. * Updated the syntax of overridden rules to TR35 Rev 33 for Lower Sorbian (dsb), Upper Sorbian (hsb), Belarusian in Taraskievica orthography (be_tarask), Old Church Slavonic (cu), Bhojpuri (bho), Samogitian (sgs). * Removed Manx (gv) override. See I46ab3dadc7fe08c1e60bbd81a1ee841e166e9608. * Removed the overriden convertPlural method for Serbian from LanguageSr.php, since CLDR 24 matches with MW rules. Updated and added more tests. Tests updated for Serbocroatian (sh), too. Old CLDR versions had 4 plural rules and MW had only 3. In CLDR 24, the form 'many' was removed and it became identical to the MW. Same for Bosnian (bs) and Croatian (hr). Also for variants sr-ec and sr-el * Macedonian (mk) used to count 11 as 'other' form. CLDR 24 counts it as 'one'. Not overriding, using CLDR 24 here. Updated the tests. MW will not override this. * Armenian (hy) used to count 0 as 'other'. Now it is 'one' form. Updated the tests. MW will not override this. * Latvian (lv) used to count only 0 as 'zero' form, but CLDR 24, any number satisifying the following formula is counted as zero: n % 10 = 0 or n % 100 = 11..19 or v = 2 and f % 100 = 11..19 Examples: 0, 10~20, 30, 40, 50, 60, 100. Updated the tests accordingly. Not overriding it in MW. Users will see different plural form for the above numbers. * Removed Ukranian custom plural rule since it match with MW * Russian (ru) plural rules have a major change. The 'few' form is merged with the 'other' form. The current forms are 'one', 'many', 'other'. In MW ru plural rules were overridden using convertPlural methdod in LanguagesRu.php with 3 forms. Effectively forms[1] and forms[2] are swapped. This will affect the messages, and such messages must be reviewed and updated. This change is not included in this patch and wil be done separately. Russian is the only remaining language class with convertPlural method overridden. Notable impact on the exising messages: * For languages ru, uk, be_tarask, sr, For the special case of two plural forms and first mapped to 1 and rest to the other form, syntax like {{plural:$1|1=one|other}} should be used. For further information regarding each of the above language changes, see 1. http://unicode.org/cldr/trac/ticket/3727 2. http://goo.gl/H2HEz CLDR 24 can handle fractions. Ideally it should start working in MW without any code changes, but MW language test suite does not have enough tests to confirm. Followup: e571717e06667228ec8d689be067e00bdd06d34d Bug: 56931 Change-Id: I9930b290d004667a3bb09e5c1663ec2c9c27d8a6
2014-01-01 09:05:39 +00:00
/** Tests for Armenian (Հայերեն) */
class LanguageHyTest extends LanguageClassesTestCase {
/**
* @dataProvider providePlural
* @covers Language::convertPlural
*/
public function testPlural( $result, $value ) {
$forms = array( 'one', 'other' );
$this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) );
}
/**
* @dataProvider providePlural
* @covers Language::getPluralRuleType
*/
public function testGetPluralRuleType( $result, $value ) {
$this->assertEquals( $result, $this->getLang()->getPluralRuleType( $value ) );
}
public static function providePlural() {
return array(
Update plural rules to CLDR 24 Updated plurals.xml with new data from CLDR 24. This data is according to UTS #35 Rev 33. Update the CLDRPluralRuleParser.js to version 1.1 from upstream https://github.com/santhoshtr/CLDRPluralRuleParser Changes to the plural rules: * Hebrew override removed since CLDR 24 matches with MW plural rules. * Updated the syntax of overridden rules to TR35 Rev 33 for Lower Sorbian (dsb), Upper Sorbian (hsb), Belarusian in Taraskievica orthography (be_tarask), Old Church Slavonic (cu), Bhojpuri (bho), Samogitian (sgs). * Removed Manx (gv) override. See I46ab3dadc7fe08c1e60bbd81a1ee841e166e9608. * Removed the overriden convertPlural method for Serbian from LanguageSr.php, since CLDR 24 matches with MW rules. Updated and added more tests. Tests updated for Serbocroatian (sh), too. Old CLDR versions had 4 plural rules and MW had only 3. In CLDR 24, the form 'many' was removed and it became identical to the MW. Same for Bosnian (bs) and Croatian (hr). Also for variants sr-ec and sr-el * Macedonian (mk) used to count 11 as 'other' form. CLDR 24 counts it as 'one'. Not overriding, using CLDR 24 here. Updated the tests. MW will not override this. * Armenian (hy) used to count 0 as 'other'. Now it is 'one' form. Updated the tests. MW will not override this. * Latvian (lv) used to count only 0 as 'zero' form, but CLDR 24, any number satisifying the following formula is counted as zero: n % 10 = 0 or n % 100 = 11..19 or v = 2 and f % 100 = 11..19 Examples: 0, 10~20, 30, 40, 50, 60, 100. Updated the tests accordingly. Not overriding it in MW. Users will see different plural form for the above numbers. * Removed Ukranian custom plural rule since it match with MW * Russian (ru) plural rules have a major change. The 'few' form is merged with the 'other' form. The current forms are 'one', 'many', 'other'. In MW ru plural rules were overridden using convertPlural methdod in LanguagesRu.php with 3 forms. Effectively forms[1] and forms[2] are swapped. This will affect the messages, and such messages must be reviewed and updated. This change is not included in this patch and wil be done separately. Russian is the only remaining language class with convertPlural method overridden. Notable impact on the exising messages: * For languages ru, uk, be_tarask, sr, For the special case of two plural forms and first mapped to 1 and rest to the other form, syntax like {{plural:$1|1=one|other}} should be used. For further information regarding each of the above language changes, see 1. http://unicode.org/cldr/trac/ticket/3727 2. http://goo.gl/H2HEz CLDR 24 can handle fractions. Ideally it should start working in MW without any code changes, but MW language test suite does not have enough tests to confirm. Followup: e571717e06667228ec8d689be067e00bdd06d34d Bug: 56931 Change-Id: I9930b290d004667a3bb09e5c1663ec2c9c27d8a6
2014-01-01 09:05:39 +00:00
array( 'one', 0 ),
array( 'one', 1 ),
array( 'other', 2 ),
array( 'other', 200 ),
);
}
}