Bug 1428366 - Add new plural rule (6 forms) for Welsh to PluralForm.jsm r=Pike
authorFrancesco Lodolo (:flod) <flod@lodolo.net>
Mon, 08 Jan 2018 08:50:38 +0100
changeset 452686 395fc0edae580ac7f72a8b9fe53414454360509b
parent 452685 3f34a1fbfe020bfaf1df0784835de60103d3996c
child 452687 9ff344df5f646380d30ea5b41e8bcfd5d2c7a27c
push id1648
push usermtabara@mozilla.com
push dateThu, 01 Mar 2018 12:45:47 +0000
treeherdermozilla-release@cbb9688c2eeb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersPike
bugs1428366
milestone59.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1428366 - Add new plural rule (6 forms) for Welsh to PluralForm.jsm r=Pike MozReview-Commit-ID: GJ87J9gtqQt
intl/locale/PluralForm.jsm
intl/locale/tests/unit/test_pluralForm.js
--- a/intl/locale/PluralForm.jsm
+++ b/intl/locale/PluralForm.jsm
@@ -71,16 +71,18 @@ var gFunctions = [
   // 14: Unused
   [3, (n) => n%10==1?0:n%10==2?1:2],
   // 15: Icelandic, Macedonian
   [2, (n) => n%10==1&&n%100!=11?0:1],
   // 16: Breton
   [5, (n) => n%10==1&&n%100!=11&&n%100!=71&&n%100!=91?0:n%10==2&&n%100!=12&&n%100!=72&&n%100!=92?1:(n%10==3||n%10==4||n%10==9)&&n%100!=13&&n%100!=14&&n%100!=19&&n%100!=73&&n%100!=74&&n%100!=79&&n%100!=93&&n%100!=94&&n%100!=99?2:n%1000000==0&&n!=0?3:4],
   // 17: Shuar
   [2, (n) => n!=0?1:0],
+  // 18: Welsh
+  [6, (n) => n==0?0:n==1?1:n==2?2:n==3?3:n==6?4:5],
 ];
 
 this.PluralForm = {
   /**
    * Get the correct plural form of a word based on the number
    *
    * @param aNum
    *        The number to decide which plural form to use
--- a/intl/locale/tests/unit/test_pluralForm.js
+++ b/intl/locale/tests/unit/test_pluralForm.js
@@ -618,16 +618,50 @@ function run_test()
     2,2,2,2,2,2,2,2,2,2,
     2,2,2,2,2,2,2,2,2,2,
     2,2,2,2,2,2,2,2,2,2,
     2,2,2,2,2,2,2,2,2,2,
     2,2,2,2,2,2,2,2,2,2,
     2,2,2,2,2,2,2,2,2,2,
     2,2,2,2,2,2,2,2,2,2,
     2,2,2,2,2,2,2,2,2,2,
+  ], [
+    // 18: Welsh 0-9, 10-19, ..., 90-99
+    1,2,3,4,6,6,5,6,6,6,
+    6,6,6,6,6,6,6,6,6,6,
+    6,6,6,6,6,6,6,6,6,6,
+    6,6,6,6,6,6,6,6,6,6,
+    6,6,6,6,6,6,6,6,6,6,
+    6,6,6,6,6,6,6,6,6,6,
+    6,6,6,6,6,6,6,6,6,6,
+    6,6,6,6,6,6,6,6,6,6,
+    6,6,6,6,6,6,6,6,6,6,
+    6,6,6,6,6,6,6,6,6,6,
+    // 100-109, 110-119, ..., 190-199
+    6,6,6,6,6,6,6,6,6,6,
+    6,6,6,6,6,6,6,6,6,6,
+    6,6,6,6,6,6,6,6,6,6,
+    6,6,6,6,6,6,6,6,6,6,
+    6,6,6,6,6,6,6,6,6,6,
+    6,6,6,6,6,6,6,6,6,6,
+    6,6,6,6,6,6,6,6,6,6,
+    6,6,6,6,6,6,6,6,6,6,
+    6,6,6,6,6,6,6,6,6,6,
+    6,6,6,6,6,6,6,6,6,6,
+    // 200-209, 210-219, ..., 290-299
+    6,6,6,6,6,6,6,6,6,6,
+    6,6,6,6,6,6,6,6,6,6,
+    6,6,6,6,6,6,6,6,6,6,
+    6,6,6,6,6,6,6,6,6,6,
+    6,6,6,6,6,6,6,6,6,6,
+    6,6,6,6,6,6,6,6,6,6,
+    6,6,6,6,6,6,6,6,6,6,
+    6,6,6,6,6,6,6,6,6,6,
+    6,6,6,6,6,6,6,6,6,6,
+    6,6,6,6,6,6,6,6,6,6,
   ]];
 
   for (let [rule, expect] of allExpect.entries()) {
     print("\nTesting rule #" + rule);
 
     let [get, numForms] = PluralForm.makeGetter(rule);
 
     // Make sure the largest value expected matches the number of plural forms