Commit graph

10 commits

Author SHA1 Message Date
Santhosh Thottingal
1441f511a2 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: e571717e06

Bug: 56931
Change-Id: I9930b290d004667a3bb09e5c1663ec2c9c27d8a6
2014-01-03 11:53:10 +05:30
addshore
46a17d0fc3 Cleanup /languages/* tests
This change:
 - Adds method scope
 - adds @covers tags
 - adds various @todos
 - fixes some comments

Before the changes tests ran with:
   1383 tests, 1412 assertions 10 skips
After changes the results remain the same

Change-Id: Iee57447bdb47026952ef5dcce6fed5dad0f80e52
2013-10-22 12:32:29 +02:00
Siebrand Mazeland
6da93fc6f6 Update code formatting
Also update some previous inconsistencies pointed out by Krinkle in change IDs:
* Ide20743a2e84ff68549286120e6cff9d9f396f54
* I811ca957b6588085d67606ebc0cd4033a1e53839

Change-Id: Ife33b931870d0d7e04fcb40974997436d27f528f
2013-03-27 14:15:11 +01:00
Timo Tijhof
b36d883017 Tests: Make phpunit providers "public static".
Follows-up I9d2b148e57 (including phpunit/languages this time).

Bug: 46434
Change-Id: I30e5efcd88c516121c454676bd7a18f9b7c8fca6
2013-03-22 03:12:37 +01:00
Kaldari
06b0967caa Allow the retrieval of the plural rule type for a given number
For example, find out which rule type should be applied for 5 items
in Arabic. The result would be 'few'.

This implementation should be non-disruptive and completely backwards
compatible (which is the main reason it isn't a lot simpler).

Change-Id: I3d72e4105f6244b0695116940e62a2ddef66eb66
2013-03-20 14:34:12 +05:30
Santhosh Thottingal
406d958795 Remove custom Latvian(lv) language plural rules
CLDR is now in sync with MW plural rules. So no need of custom plural logic

Change-Id: I399f99ddd40eea67e981d5710658ba635f115a31
2013-03-04 16:49:02 +05:30
Siebrand Mazeland
feb9419a51 Update formatting
7 of n.

Change-Id: I07687a4381f29fd9fc73666e460f25769ed54092
2013-02-15 12:53:41 +00:00
Antoine Musso
a03bf9e27f tests: rm duplicate code in language classes
The language classes have been using the same setUp() tearDown() to
craft a new language object. I have abstracted that code in
LanguageClassesTestCase and made all the language test classes to extend
it. The language is interpolated directly from the class name and an
object for it can be retrieved with the getLang() method.

Change-Id: Ib931336ce219edabe2c72b7e9f04c976a500723e
2012-10-29 09:40:30 +01:00
Timo Tijhof
181c7cdc8e Clean and repair many phpunit tests (+ fix implied configuration)
This commit depends on the introduction of
MediaWikiTestCase::setMwGlobals in change Iccf6ea81f4.

Various tests already set their globals, but forgot to restore
them afterwards, or forgot to call the parent setUp, tearDown...

Either way they won't have to anymore with setMwGlobals.

Consistent use of function characteristics:
* protected function setUp
* protected function tearDown
* public static function (provide..)

(Matching the function signature with PHPUnit/Framework/TestCase.php)

Replaces:
 * public function (setUp|tearDown)\(
 * protected function $1(

 * \tfunction (setUp|tearDown)\(
 * \tprotected function $1(

 * \tfunction (data|provide)\(
 * \tpublic static function $1\(

Also renamed a few "data#", "provider#" and "provides#" functions
to "provide#" for consistency. This also removes confusion where
the /media tests had a few private methods called dataFile(),
which were sometimes expected to be data providers.

Fixes:

TimestampTest often failed due to a previous test setting a
different language (it tests "1 hour ago" so need to make sure
it is set to English).

MWNamespaceTest became a lot cleaner now that it executes with
a known context. Though the now-redundant code that was removed
didn't work anyway because wgContentNamespaces isn't keyed by
namespace id, it had them was values...

FileBackendTest:
* Fixed: "PHP Fatal: Using $this when not in object context"

HttpTest
* Added comment about:
  "PHP Fatal: Call to protected MWHttpRequest::__construct()"
  (too much unrelated code to fix in this commit)

ExternalStoreTest
* Add an assertTrue as well, without it the test is useless
  because regardless of whether wgExternalStores is true or false
  it only uses it if it is an array.

Change-Id: I9d2b148e57bada64afeb7d5a99bec0e58f8e1561
2012-10-09 03:01:51 +02:00
Santhosh Thottingal
6fd023b9c5 phpunit testcases for lv, mg,and ml languages to test Plural 2012-01-30 11:40:28 +00:00