Commit graph

21 commits

Author SHA1 Message Date
Santhosh Thottingal
8dc3631093 Update plural data to CLDR 26
* The updates include incompatible changes for plural forms in Russian,
  Prussian, Tagalog, Manx and several languages that fall back to Russian.
  In addition there are minor changes for other languages.
* Test cases were updated to reflect these changes.

Bug: 62861
Change-Id: I7cce477925330fe5bbf51a8470060dc1223981d0
2014-10-27 08:30:34 +00:00
Reedy
ced8268881 chmod -x languages/data/plurals.xml
Bug: 66182
Change-Id: Ic8e15d94fb54b410d21b969b029fac685b2711d6
2014-06-05 14:18:44 +01:00
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
Santhosh Thottingal
3e6cb8ac1a Correct the plural forms for Manx (Gaelg)
Backported the plural rules from CLDR 24 as an override to CLDR 23 rules
exising in MediaWiki. The syntax for plural rules changed in CLDR 24, so
modified the syntax to fit the CLDR 23 syntax

Once we are ready with the updated parsers for CLDR 24(See bug 56931),
we should remove the override.

Since we remove the custom plural forms in MW in favor of CLDR,
the following changes comes into effect:

1. 'few' form used as 'zero' form in MW. Practially that make 'one' form used
as 'two' form and 'two' used as 'few' form.
This breaks existing gv {{PURAL}} usage as dicussed in the bug report

2. CLDR defines 'few' form as n % 100 = 0,20,40,60 but MW adds 80 also to that
list, ie  n % 100 = 0,20,40,60, 80. So with this patch, 80 is no longer considered
as 'few' plural form.

Bug: 47099
Change-Id: I46ab3dadc7fe08c1e60bbd81a1ee841e166e9608
2013-12-11 12:05:43 +05:30
umherirrender
24bfde2710 Fix spacing and break some lines
Change-Id: Ia57685d8858e02e399ad5c75ce64d12609d340ac
2013-08-24 17:06:25 +02:00
Amir E. Aharoni
40c01f2492 Update plural rules for Hebrew
A recent CLDR update changed the plural rules for Hebrew
and added a "many" form. That rule has a mistake, however -
it is not supposed to include the number 10. This is reported as
http://unicode.org/cldr/trac/ticket/5828

This commit updates the plural overrides for Hebrew and makes
them closer to the latest CLDR, but with a fix for that rule.

It also updates the tests to include support for the new rule
and to make sure that the right fallbacks are used when
less than four rules are supplied, because usually that is
the case. It is thus a partial revert of the changes introduced
in I3d72e4105f6244b0695116940e62a2ddef66eb66 .

Mingle-Task: 2715

Change-Id: I1315e6900ef7a89bf246e748b786f7fc31a629c6
2013-03-22 15:21:50 +02: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
43f5eb600b 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
2013-03-18 13:41:46 +05:30
Santhosh Thottingal
34bbc9abe9 Remove temporary plural overrides for fa, hu, ja, vi
These overrides were done for Bug 40251, but fixed later in
I345c305134a62d43c9dfedc5243981d0e77e326d

Change-Id: I8c1cc0055722ddd31d04fbd9b6cb1215adde23c6
2013-02-26 15:52:46 +00:00
Santhosh Thottingal
d61373ec40 Remove MediaWiki overrides for plural rules for Scots Gaelic (gd)
Also cleanup the tests.

Change-Id: Ic29026a7a8128b890882b8869569309ab05e4226
2013-02-26 16:50:56 +01:00
Santhosh Thottingal
1f650cb9b7 Update plural rules from CLDR, and correct Armenian plural rules
* Upgrade to revision 8007, Contains minor change - Armenian(hy) is added
* Remove MW custom plural logic from LanguageHy.php
* Add qunit test case
* Correct phpunit testcase

Change-Id: If78436fa1597e6f3b7f050c5eede4521018904c0
2013-02-14 11:37:24 +05:30
Niklas Laxström
04bf35d331 Eliminate dummy Language instances from being created
By checking the code against $wgDummyLanguageCodes we can
get rid of checking it on a case-by-case basis.

It's only a suggestion (I don't know if it can break anything),
and Amir Aharoni said that big changes are coming (Bug 41103).

In private case, this change fixes Bug 27571 and maybe some other
language fallback related issues.

Change-Id: I5212beabd5cc212b50ee98b5b53ec01b20ffd0c3
2013-01-02 17:42:22 +00:00
amire80
9305b9321f Copy plural rules from be to be-tarask
CLDR only defines rules for 'be'.
The bug was reported by Wizardist.

Change-Id: I459be3d2f488471eea2acfd3d3c4f79ff3ebc11c
2012-09-27 16:54:10 -07:00
Siebrand
6518ffba8d Merge "Updated plural rules from CLDR 22" 2012-09-19 07:01:52 +00:00
Niklas Laxström
a87bfdd2f1 Updated plural rules from CLDR 22
Change-Id: I0325635a8e0fa3d5defbcbc3a0f4746ed4ab14c1
2012-09-17 16:59:29 +00:00
Siebrand
e13808da00 Merge "(bug 40251) Added more languages to plural override" 2012-09-17 16:48:32 +00:00
Niklas Laxström
5e40d9cecb Migrate hsb plural rules to cldr format
Change-Id: I9d1c34d8e63767a6abc4f98c09caf65d5056433a
2012-09-16 17:53:10 +00:00
Niklas Laxström
a36b46a8e8 (bug 40251) Added more languages to plural override
There might be more which have not been reported yet.
These should be temporary to restore old behavior
while we are working on alternative solution.

Change-Id: I403a29e2996e09e99ac3e7d394e7bc09a9ff8224
2012-09-15 04:56:08 +00:00
Niklas Laxström
1c21fb2aae (bug 40250) Local plural overrides for vi
Change-Id: I83fcc2e45ad35fa103584e41e275dd5cf2f8680e
2012-09-14 16:40:25 +00:00
Niklas Laxström
37a8dd777c Fix the incorrect nesting
Change-Id: I326458f136e9e491f80c1f69a1154f388ed96927
2012-08-29 07:56:14 +00:00
Santhosh Thottingal
bbbcf089db CLDR Plural rules based plural form calculation
* Use the plurals.xml of CLDR for the plural rules of languages
* Use plurals-mediawiki.xml to override or extend the rules inside MW
* Remove the convertPlural method in each LanguageXX.php
* Parse and load the xml files in LocalisationCache
* Use the CLDRPluralRuleEvaluator.php for parsing the cldr plural rules
  (This is taken from Translate extension and might require a replacement
   parser without using eval)
* Add getPluralRules() to make the CLDR plural rules available to JS.

PS3: More method documentation, cleanup

Change-Id: I58a9cdfe60c7b9027bf031c91370472054f04ae2
2012-08-16 11:45:17 +10:00