1// Copyright 2012 The Closure Library Authors. All Rights Reserved. 2// 3// Licensed under the Apache License, Version 2.0 (the "License"); 4// you may not use this file except in compliance with the License. 5// You may obtain a copy of the License at 6// 7// http://www.apache.org/licenses/LICENSE-2.0 8// 9// Unless required by applicable law or agreed to in writing, software 10// distributed under the License is distributed on an "AS-IS" BASIS, 11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12// See the License for the specific language governing permissions and 13// limitations under the License. 14 15/** 16 * @fileoverview Plural rules. 17 * 18 * This file is autogenerated by script: 19 * http://go/generate_pluralrules.py 20 * File generated from CLDR ver. 25 21 * 22 * Before check in, this file could have been manually edited. This is to 23 * incorporate changes before we could fix CLDR. All manual modification must be 24 * documented in this section, and should be removed after those changes land to 25 * CLDR. 26 */ 27 28goog.provide('goog.i18n.pluralRules'); 29/** 30 * Plural pattern keyword 31 * @enum {string} 32 */ 33goog.i18n.pluralRules.Keyword = { 34 ZERO: 'zero', 35 ONE: 'one', 36 TWO: 'two', 37 FEW: 'few', 38 MANY: 'many', 39 OTHER: 'other' 40}; 41 42 43/** 44 * Default Plural select rule. 45 * @param {number} n The count of items. 46 * @param {number=} opt_precision optional, precision. 47 * @return {goog.i18n.pluralRules.Keyword} Default value. 48 * @private 49 */ 50goog.i18n.pluralRules.defaultSelect_ = function(n, opt_precision) { 51 return goog.i18n.pluralRules.Keyword.OTHER; 52}; 53 54/** 55 * Returns the fractional part of a number (3.1416 => 1416) 56 * @param {number} n The count of items. 57 * @return {number} The fractional part. 58 * @private 59 */ 60goog.i18n.pluralRules.decimals_ = function(n) { 61 var str = n + ''; 62 var result = str.indexOf('.'); 63 return (result == -1) ? 0 : str.length - result - 1; 64}; 65 66/** 67 * Calculates v and f as per CLDR plural rules. 68 * The short names for parameters / return match the CLDR syntax and UTS #35 69 * (http://unicode.org/reports/tr35/tr35-numbers.html#Plural_rules_syntax) 70 * @param {number} n The count of items. 71 * @param {number=} opt_precision optional, precision. 72 * @return {!Object} The v and f. 73 * @private 74 */ 75goog.i18n.pluralRules.get_vf_ = function(n, opt_precision) { 76 var DEFAULT_DIGITS = 3; 77 78 if (undefined === opt_precision) { 79 var v = Math.min(goog.i18n.pluralRules.decimals_(n), DEFAULT_DIGITS); 80 } else { 81 var v = opt_precision; 82 } 83 84 var base = Math.pow(10, v); 85 var f = ((n * base) | 0) % base; 86 87 return {v: v, f: f}; 88}; 89 90/** 91 * Calculates w and t as per CLDR plural rules. 92 * The short names for parameters / return match the CLDR syntax and UTS #35 93 * (http://unicode.org/reports/tr35/tr35-numbers.html#Plural_rules_syntax) 94 * @param {number} v Calculated previously. 95 * @param {number} f Calculated previously. 96 * @return {!Object} The w and t. 97 * @private 98 */ 99goog.i18n.pluralRules.get_wt_ = function(v, f) { 100 if (f === 0) { 101 return {w: 0, t: 0}; 102 } 103 104 while ((f % 10) === 0) { 105 f /= 10; 106 v--; 107 } 108 109 return {w: v, t: f}; 110}; 111 112/** 113 * Plural select rules for ga locale 114 * 115 * @param {number} n The count of items. 116 * @param {number=} opt_precision Precision for number formatting, if not default. 117 * @return {goog.i18n.pluralRules.Keyword} Locale-specific plural value. 118 * @private 119 */ 120goog.i18n.pluralRules.gaSelect_ = function(n, opt_precision) { 121 if (n == 1) { 122 return goog.i18n.pluralRules.Keyword.ONE; 123 } 124 if (n == 2) { 125 return goog.i18n.pluralRules.Keyword.TWO; 126 } 127 if (n >= 3 && n <= 6) { 128 return goog.i18n.pluralRules.Keyword.FEW; 129 } 130 if (n >= 7 && n <= 10) { 131 return goog.i18n.pluralRules.Keyword.MANY; 132 } 133 return goog.i18n.pluralRules.Keyword.OTHER; 134}; 135 136/** 137 * Plural select rules for ro locale 138 * 139 * @param {number} n The count of items. 140 * @param {number=} opt_precision Precision for number formatting, if not default. 141 * @return {goog.i18n.pluralRules.Keyword} Locale-specific plural value. 142 * @private 143 */ 144goog.i18n.pluralRules.roSelect_ = function(n, opt_precision) { 145 var i = n | 0; 146 var vf = goog.i18n.pluralRules.get_vf_(n, opt_precision); 147 if (i == 1 && vf.v == 0) { 148 return goog.i18n.pluralRules.Keyword.ONE; 149 } 150 if (vf.v != 0 || n == 0 || n != 1 && n % 100 >= 1 && n % 100 <= 19) { 151 return goog.i18n.pluralRules.Keyword.FEW; 152 } 153 return goog.i18n.pluralRules.Keyword.OTHER; 154}; 155 156/** 157 * Plural select rules for fil locale 158 * 159 * @param {number} n The count of items. 160 * @param {number=} opt_precision Precision for number formatting, if not default. 161 * @return {goog.i18n.pluralRules.Keyword} Locale-specific plural value. 162 * @private 163 */ 164goog.i18n.pluralRules.filSelect_ = function(n, opt_precision) { 165 var i = n | 0; 166 var vf = goog.i18n.pluralRules.get_vf_(n, opt_precision); 167 if (vf.v == 0 && (i == 1 || i == 2 || i == 3) || vf.v == 0 && i % 10 != 4 && i % 10 != 6 && i % 10 != 9 || vf.v != 0 && vf.f % 10 != 4 && vf.f % 10 != 6 && vf.f % 10 != 9) { 168 return goog.i18n.pluralRules.Keyword.ONE; 169 } 170 return goog.i18n.pluralRules.Keyword.OTHER; 171}; 172 173/** 174 * Plural select rules for fr locale 175 * 176 * @param {number} n The count of items. 177 * @param {number=} opt_precision Precision for number formatting, if not default. 178 * @return {goog.i18n.pluralRules.Keyword} Locale-specific plural value. 179 * @private 180 */ 181goog.i18n.pluralRules.frSelect_ = function(n, opt_precision) { 182 var i = n | 0; 183 if (i == 0 || i == 1) { 184 return goog.i18n.pluralRules.Keyword.ONE; 185 } 186 return goog.i18n.pluralRules.Keyword.OTHER; 187}; 188 189/** 190 * Plural select rules for en locale 191 * 192 * @param {number} n The count of items. 193 * @param {number=} opt_precision Precision for number formatting, if not default. 194 * @return {goog.i18n.pluralRules.Keyword} Locale-specific plural value. 195 * @private 196 */ 197goog.i18n.pluralRules.enSelect_ = function(n, opt_precision) { 198 var i = n | 0; 199 var vf = goog.i18n.pluralRules.get_vf_(n, opt_precision); 200 if (i == 1 && vf.v == 0) { 201 return goog.i18n.pluralRules.Keyword.ONE; 202 } 203 return goog.i18n.pluralRules.Keyword.OTHER; 204}; 205 206/** 207 * Plural select rules for mt locale 208 * 209 * @param {number} n The count of items. 210 * @param {number=} opt_precision Precision for number formatting, if not default. 211 * @return {goog.i18n.pluralRules.Keyword} Locale-specific plural value. 212 * @private 213 */ 214goog.i18n.pluralRules.mtSelect_ = function(n, opt_precision) { 215 if (n == 1) { 216 return goog.i18n.pluralRules.Keyword.ONE; 217 } 218 if (n == 0 || n % 100 >= 2 && n % 100 <= 10) { 219 return goog.i18n.pluralRules.Keyword.FEW; 220 } 221 if (n % 100 >= 11 && n % 100 <= 19) { 222 return goog.i18n.pluralRules.Keyword.MANY; 223 } 224 return goog.i18n.pluralRules.Keyword.OTHER; 225}; 226 227/** 228 * Plural select rules for da locale 229 * 230 * @param {number} n The count of items. 231 * @param {number=} opt_precision Precision for number formatting, if not default. 232 * @return {goog.i18n.pluralRules.Keyword} Locale-specific plural value. 233 * @private 234 */ 235goog.i18n.pluralRules.daSelect_ = function(n, opt_precision) { 236 var i = n | 0; 237 var vf = goog.i18n.pluralRules.get_vf_(n, opt_precision); 238 var wt = goog.i18n.pluralRules.get_wt_(vf.v, vf.f); 239 if (n == 1 || wt.t != 0 && (i == 0 || i == 1)) { 240 return goog.i18n.pluralRules.Keyword.ONE; 241 } 242 return goog.i18n.pluralRules.Keyword.OTHER; 243}; 244 245/** 246 * Plural select rules for gv locale 247 * 248 * @param {number} n The count of items. 249 * @param {number=} opt_precision Precision for number formatting, if not default. 250 * @return {goog.i18n.pluralRules.Keyword} Locale-specific plural value. 251 * @private 252 */ 253goog.i18n.pluralRules.gvSelect_ = function(n, opt_precision) { 254 var i = n | 0; 255 var vf = goog.i18n.pluralRules.get_vf_(n, opt_precision); 256 if (vf.v == 0 && i % 10 == 1) { 257 return goog.i18n.pluralRules.Keyword.ONE; 258 } 259 if (vf.v == 0 && i % 10 == 2) { 260 return goog.i18n.pluralRules.Keyword.TWO; 261 } 262 if (vf.v == 0 && (i % 100 == 0 || i % 100 == 20 || i % 100 == 40 || i % 100 == 60 || i % 100 == 80)) { 263 return goog.i18n.pluralRules.Keyword.FEW; 264 } 265 if (vf.v != 0) { 266 return goog.i18n.pluralRules.Keyword.MANY; 267 } 268 return goog.i18n.pluralRules.Keyword.OTHER; 269}; 270 271/** 272 * Plural select rules for cy locale 273 * 274 * @param {number} n The count of items. 275 * @param {number=} opt_precision Precision for number formatting, if not default. 276 * @return {goog.i18n.pluralRules.Keyword} Locale-specific plural value. 277 * @private 278 */ 279goog.i18n.pluralRules.cySelect_ = function(n, opt_precision) { 280 if (n == 0) { 281 return goog.i18n.pluralRules.Keyword.ZERO; 282 } 283 if (n == 1) { 284 return goog.i18n.pluralRules.Keyword.ONE; 285 } 286 if (n == 2) { 287 return goog.i18n.pluralRules.Keyword.TWO; 288 } 289 if (n == 3) { 290 return goog.i18n.pluralRules.Keyword.FEW; 291 } 292 if (n == 6) { 293 return goog.i18n.pluralRules.Keyword.MANY; 294 } 295 return goog.i18n.pluralRules.Keyword.OTHER; 296}; 297 298/** 299 * Plural select rules for br locale 300 * 301 * @param {number} n The count of items. 302 * @param {number=} opt_precision Precision for number formatting, if not default. 303 * @return {goog.i18n.pluralRules.Keyword} Locale-specific plural value. 304 * @private 305 */ 306goog.i18n.pluralRules.brSelect_ = function(n, opt_precision) { 307 if (n % 10 == 1 && n % 100 != 11 && n % 100 != 71 && n % 100 != 91) { 308 return goog.i18n.pluralRules.Keyword.ONE; 309 } 310 if (n % 10 == 2 && n % 100 != 12 && n % 100 != 72 && n % 100 != 92) { 311 return goog.i18n.pluralRules.Keyword.TWO; 312 } 313 if ((n % 10 >= 3 && n % 10 <= 4 || n % 10 == 9) && (n % 100 < 10 || n % 100 > 19) && (n % 100 < 70 || n % 100 > 79) && (n % 100 < 90 || n % 100 > 99)) { 314 return goog.i18n.pluralRules.Keyword.FEW; 315 } 316 if (n != 0 && n % 1000000 == 0) { 317 return goog.i18n.pluralRules.Keyword.MANY; 318 } 319 return goog.i18n.pluralRules.Keyword.OTHER; 320}; 321 322/** 323 * Plural select rules for es locale 324 * 325 * @param {number} n The count of items. 326 * @param {number=} opt_precision Precision for number formatting, if not default. 327 * @return {goog.i18n.pluralRules.Keyword} Locale-specific plural value. 328 * @private 329 */ 330goog.i18n.pluralRules.esSelect_ = function(n, opt_precision) { 331 if (n == 1) { 332 return goog.i18n.pluralRules.Keyword.ONE; 333 } 334 return goog.i18n.pluralRules.Keyword.OTHER; 335}; 336 337/** 338 * Plural select rules for si locale 339 * 340 * @param {number} n The count of items. 341 * @param {number=} opt_precision Precision for number formatting, if not default. 342 * @return {goog.i18n.pluralRules.Keyword} Locale-specific plural value. 343 * @private 344 */ 345goog.i18n.pluralRules.siSelect_ = function(n, opt_precision) { 346 var i = n | 0; 347 var vf = goog.i18n.pluralRules.get_vf_(n, opt_precision); 348 if ((n == 0 || n == 1) || i == 0 && vf.f == 1) { 349 return goog.i18n.pluralRules.Keyword.ONE; 350 } 351 return goog.i18n.pluralRules.Keyword.OTHER; 352}; 353 354/** 355 * Plural select rules for sl locale 356 * 357 * @param {number} n The count of items. 358 * @param {number=} opt_precision Precision for number formatting, if not default. 359 * @return {goog.i18n.pluralRules.Keyword} Locale-specific plural value. 360 * @private 361 */ 362goog.i18n.pluralRules.slSelect_ = function(n, opt_precision) { 363 var i = n | 0; 364 var vf = goog.i18n.pluralRules.get_vf_(n, opt_precision); 365 if (vf.v == 0 && i % 100 == 1) { 366 return goog.i18n.pluralRules.Keyword.ONE; 367 } 368 if (vf.v == 0 && i % 100 == 2) { 369 return goog.i18n.pluralRules.Keyword.TWO; 370 } 371 if (vf.v == 0 && i % 100 >= 3 && i % 100 <= 4 || vf.v != 0) { 372 return goog.i18n.pluralRules.Keyword.FEW; 373 } 374 return goog.i18n.pluralRules.Keyword.OTHER; 375}; 376 377/** 378 * Plural select rules for tzm locale 379 * 380 * @param {number} n The count of items. 381 * @param {number=} opt_precision Precision for number formatting, if not default. 382 * @return {goog.i18n.pluralRules.Keyword} Locale-specific plural value. 383 * @private 384 */ 385goog.i18n.pluralRules.tzmSelect_ = function(n, opt_precision) { 386 if (n >= 0 && n <= 1 || n >= 11 && n <= 99) { 387 return goog.i18n.pluralRules.Keyword.ONE; 388 } 389 return goog.i18n.pluralRules.Keyword.OTHER; 390}; 391 392/** 393 * Plural select rules for sr locale 394 * 395 * @param {number} n The count of items. 396 * @param {number=} opt_precision Precision for number formatting, if not default. 397 * @return {goog.i18n.pluralRules.Keyword} Locale-specific plural value. 398 * @private 399 */ 400goog.i18n.pluralRules.srSelect_ = function(n, opt_precision) { 401 var i = n | 0; 402 var vf = goog.i18n.pluralRules.get_vf_(n, opt_precision); 403 if (vf.v == 0 && i % 10 == 1 && i % 100 != 11 || vf.f % 10 == 1 && vf.f % 100 != 11) { 404 return goog.i18n.pluralRules.Keyword.ONE; 405 } 406 if (vf.v == 0 && i % 10 >= 2 && i % 10 <= 4 && (i % 100 < 12 || i % 100 > 14) || vf.f % 10 >= 2 && vf.f % 10 <= 4 && (vf.f % 100 < 12 || vf.f % 100 > 14)) { 407 return goog.i18n.pluralRules.Keyword.FEW; 408 } 409 return goog.i18n.pluralRules.Keyword.OTHER; 410}; 411 412/** 413 * Plural select rules for hi locale 414 * 415 * @param {number} n The count of items. 416 * @param {number=} opt_precision Precision for number formatting, if not default. 417 * @return {goog.i18n.pluralRules.Keyword} Locale-specific plural value. 418 * @private 419 */ 420goog.i18n.pluralRules.hiSelect_ = function(n, opt_precision) { 421 var i = n | 0; 422 if (i == 0 || n == 1) { 423 return goog.i18n.pluralRules.Keyword.ONE; 424 } 425 return goog.i18n.pluralRules.Keyword.OTHER; 426}; 427 428/** 429 * Plural select rules for mk locale 430 * 431 * @param {number} n The count of items. 432 * @param {number=} opt_precision Precision for number formatting, if not default. 433 * @return {goog.i18n.pluralRules.Keyword} Locale-specific plural value. 434 * @private 435 */ 436goog.i18n.pluralRules.mkSelect_ = function(n, opt_precision) { 437 var i = n | 0; 438 var vf = goog.i18n.pluralRules.get_vf_(n, opt_precision); 439 if (vf.v == 0 && i % 10 == 1 || vf.f % 10 == 1) { 440 return goog.i18n.pluralRules.Keyword.ONE; 441 } 442 return goog.i18n.pluralRules.Keyword.OTHER; 443}; 444 445/** 446 * Plural select rules for ar locale 447 * 448 * @param {number} n The count of items. 449 * @param {number=} opt_precision Precision for number formatting, if not default. 450 * @return {goog.i18n.pluralRules.Keyword} Locale-specific plural value. 451 * @private 452 */ 453goog.i18n.pluralRules.arSelect_ = function(n, opt_precision) { 454 if (n == 0) { 455 return goog.i18n.pluralRules.Keyword.ZERO; 456 } 457 if (n == 1) { 458 return goog.i18n.pluralRules.Keyword.ONE; 459 } 460 if (n == 2) { 461 return goog.i18n.pluralRules.Keyword.TWO; 462 } 463 if (n % 100 >= 3 && n % 100 <= 10) { 464 return goog.i18n.pluralRules.Keyword.FEW; 465 } 466 if (n % 100 >= 11 && n % 100 <= 99) { 467 return goog.i18n.pluralRules.Keyword.MANY; 468 } 469 return goog.i18n.pluralRules.Keyword.OTHER; 470}; 471 472/** 473 * Plural select rules for iu locale 474 * 475 * @param {number} n The count of items. 476 * @param {number=} opt_precision Precision for number formatting, if not default. 477 * @return {goog.i18n.pluralRules.Keyword} Locale-specific plural value. 478 * @private 479 */ 480goog.i18n.pluralRules.iuSelect_ = function(n, opt_precision) { 481 if (n == 1) { 482 return goog.i18n.pluralRules.Keyword.ONE; 483 } 484 if (n == 2) { 485 return goog.i18n.pluralRules.Keyword.TWO; 486 } 487 return goog.i18n.pluralRules.Keyword.OTHER; 488}; 489 490/** 491 * Plural select rules for cs locale 492 * 493 * @param {number} n The count of items. 494 * @param {number=} opt_precision Precision for number formatting, if not default. 495 * @return {goog.i18n.pluralRules.Keyword} Locale-specific plural value. 496 * @private 497 */ 498goog.i18n.pluralRules.csSelect_ = function(n, opt_precision) { 499 var i = n | 0; 500 var vf = goog.i18n.pluralRules.get_vf_(n, opt_precision); 501 if (i == 1 && vf.v == 0) { 502 return goog.i18n.pluralRules.Keyword.ONE; 503 } 504 if (i >= 2 && i <= 4 && vf.v == 0) { 505 return goog.i18n.pluralRules.Keyword.FEW; 506 } 507 if (vf.v != 0) { 508 return goog.i18n.pluralRules.Keyword.MANY; 509 } 510 return goog.i18n.pluralRules.Keyword.OTHER; 511}; 512 513/** 514 * Plural select rules for pt_PT locale 515 * 516 * @param {number} n The count of items. 517 * @param {number=} opt_precision Precision for number formatting, if not default. 518 * @return {goog.i18n.pluralRules.Keyword} Locale-specific plural value. 519 * @private 520 */ 521goog.i18n.pluralRules.pt_PTSelect_ = function(n, opt_precision) { 522 var vf = goog.i18n.pluralRules.get_vf_(n, opt_precision); 523 if (n == 1 && vf.v == 0) { 524 return goog.i18n.pluralRules.Keyword.ONE; 525 } 526 return goog.i18n.pluralRules.Keyword.OTHER; 527}; 528 529/** 530 * Plural select rules for be locale 531 * 532 * @param {number} n The count of items. 533 * @param {number=} opt_precision Precision for number formatting, if not default. 534 * @return {goog.i18n.pluralRules.Keyword} Locale-specific plural value. 535 * @private 536 */ 537goog.i18n.pluralRules.beSelect_ = function(n, opt_precision) { 538 if (n % 10 == 1 && n % 100 != 11) { 539 return goog.i18n.pluralRules.Keyword.ONE; 540 } 541 if (n % 10 >= 2 && n % 10 <= 4 && (n % 100 < 12 || n % 100 > 14)) { 542 return goog.i18n.pluralRules.Keyword.FEW; 543 } 544 if (n % 10 == 0 || n % 10 >= 5 && n % 10 <= 9 || n % 100 >= 11 && n % 100 <= 14) { 545 return goog.i18n.pluralRules.Keyword.MANY; 546 } 547 return goog.i18n.pluralRules.Keyword.OTHER; 548}; 549 550/** 551 * Plural select rules for ak locale 552 * 553 * @param {number} n The count of items. 554 * @param {number=} opt_precision Precision for number formatting, if not default. 555 * @return {goog.i18n.pluralRules.Keyword} Locale-specific plural value. 556 * @private 557 */ 558goog.i18n.pluralRules.akSelect_ = function(n, opt_precision) { 559 if (n >= 0 && n <= 1) { 560 return goog.i18n.pluralRules.Keyword.ONE; 561 } 562 return goog.i18n.pluralRules.Keyword.OTHER; 563}; 564 565/** 566 * Plural select rules for pt locale 567 * 568 * @param {number} n The count of items. 569 * @param {number=} opt_precision Precision for number formatting, if not default. 570 * @return {goog.i18n.pluralRules.Keyword} Locale-specific plural value. 571 * @private 572 */ 573goog.i18n.pluralRules.ptSelect_ = function(n, opt_precision) { 574 var i = n | 0; 575 var vf = goog.i18n.pluralRules.get_vf_(n, opt_precision); 576 var wt = goog.i18n.pluralRules.get_wt_(vf.v, vf.f); 577 if (i == 1 && vf.v == 0 || i == 0 && wt.t == 1) { 578 return goog.i18n.pluralRules.Keyword.ONE; 579 } 580 return goog.i18n.pluralRules.Keyword.OTHER; 581}; 582 583/** 584 * Plural select rules for pl locale 585 * 586 * @param {number} n The count of items. 587 * @param {number=} opt_precision Precision for number formatting, if not default. 588 * @return {goog.i18n.pluralRules.Keyword} Locale-specific plural value. 589 * @private 590 */ 591goog.i18n.pluralRules.plSelect_ = function(n, opt_precision) { 592 var i = n | 0; 593 var vf = goog.i18n.pluralRules.get_vf_(n, opt_precision); 594 if (i == 1 && vf.v == 0) { 595 return goog.i18n.pluralRules.Keyword.ONE; 596 } 597 if (vf.v == 0 && i % 10 >= 2 && i % 10 <= 4 && (i % 100 < 12 || i % 100 > 14)) { 598 return goog.i18n.pluralRules.Keyword.FEW; 599 } 600 if (vf.v == 0 && i != 1 && i % 10 >= 0 && i % 10 <= 1 || vf.v == 0 && i % 10 >= 5 && i % 10 <= 9 || vf.v == 0 && i % 100 >= 12 && i % 100 <= 14) { 601 return goog.i18n.pluralRules.Keyword.MANY; 602 } 603 return goog.i18n.pluralRules.Keyword.OTHER; 604}; 605 606/** 607 * Plural select rules for ru locale 608 * 609 * @param {number} n The count of items. 610 * @param {number=} opt_precision Precision for number formatting, if not default. 611 * @return {goog.i18n.pluralRules.Keyword} Locale-specific plural value. 612 * @private 613 */ 614goog.i18n.pluralRules.ruSelect_ = function(n, opt_precision) { 615 var i = n | 0; 616 var vf = goog.i18n.pluralRules.get_vf_(n, opt_precision); 617 if (vf.v == 0 && i % 10 == 1 && i % 100 != 11) { 618 return goog.i18n.pluralRules.Keyword.ONE; 619 } 620 if (vf.v == 0 && i % 10 >= 2 && i % 10 <= 4 && (i % 100 < 12 || i % 100 > 14)) { 621 return goog.i18n.pluralRules.Keyword.FEW; 622 } 623 if (vf.v == 0 && i % 10 == 0 || vf.v == 0 && i % 10 >= 5 && i % 10 <= 9 || vf.v == 0 && i % 100 >= 11 && i % 100 <= 14) { 624 return goog.i18n.pluralRules.Keyword.MANY; 625 } 626 return goog.i18n.pluralRules.Keyword.OTHER; 627}; 628 629/** 630 * Plural select rules for lag locale 631 * 632 * @param {number} n The count of items. 633 * @param {number=} opt_precision Precision for number formatting, if not default. 634 * @return {goog.i18n.pluralRules.Keyword} Locale-specific plural value. 635 * @private 636 */ 637goog.i18n.pluralRules.lagSelect_ = function(n, opt_precision) { 638 var i = n | 0; 639 if (n == 0) { 640 return goog.i18n.pluralRules.Keyword.ZERO; 641 } 642 if ((i == 0 || i == 1) && n != 0) { 643 return goog.i18n.pluralRules.Keyword.ONE; 644 } 645 return goog.i18n.pluralRules.Keyword.OTHER; 646}; 647 648/** 649 * Plural select rules for shi locale 650 * 651 * @param {number} n The count of items. 652 * @param {number=} opt_precision Precision for number formatting, if not default. 653 * @return {goog.i18n.pluralRules.Keyword} Locale-specific plural value. 654 * @private 655 */ 656goog.i18n.pluralRules.shiSelect_ = function(n, opt_precision) { 657 var i = n | 0; 658 if (i == 0 || n == 1) { 659 return goog.i18n.pluralRules.Keyword.ONE; 660 } 661 if (n >= 2 && n <= 10) { 662 return goog.i18n.pluralRules.Keyword.FEW; 663 } 664 return goog.i18n.pluralRules.Keyword.OTHER; 665}; 666 667/** 668 * Plural select rules for he locale 669 * 670 * @param {number} n The count of items. 671 * @param {number=} opt_precision Precision for number formatting, if not default. 672 * @return {goog.i18n.pluralRules.Keyword} Locale-specific plural value. 673 * @private 674 */ 675goog.i18n.pluralRules.heSelect_ = function(n, opt_precision) { 676 var i = n | 0; 677 var vf = goog.i18n.pluralRules.get_vf_(n, opt_precision); 678 if (i == 1 && vf.v == 0) { 679 return goog.i18n.pluralRules.Keyword.ONE; 680 } 681 if (i == 2 && vf.v == 0) { 682 return goog.i18n.pluralRules.Keyword.TWO; 683 } 684 if (vf.v == 0 && (n < 0 || n > 10) && n % 10 == 0) { 685 return goog.i18n.pluralRules.Keyword.MANY; 686 } 687 return goog.i18n.pluralRules.Keyword.OTHER; 688}; 689 690/** 691 * Plural select rules for is locale 692 * 693 * @param {number} n The count of items. 694 * @param {number=} opt_precision Precision for number formatting, if not default. 695 * @return {goog.i18n.pluralRules.Keyword} Locale-specific plural value. 696 * @private 697 */ 698goog.i18n.pluralRules.isSelect_ = function(n, opt_precision) { 699 var i = n | 0; 700 var vf = goog.i18n.pluralRules.get_vf_(n, opt_precision); 701 var wt = goog.i18n.pluralRules.get_wt_(vf.v, vf.f); 702 if (wt.t == 0 && i % 10 == 1 && i % 100 != 11 || wt.t != 0) { 703 return goog.i18n.pluralRules.Keyword.ONE; 704 } 705 return goog.i18n.pluralRules.Keyword.OTHER; 706}; 707 708/** 709 * Plural select rules for lt locale 710 * 711 * @param {number} n The count of items. 712 * @param {number=} opt_precision Precision for number formatting, if not default. 713 * @return {goog.i18n.pluralRules.Keyword} Locale-specific plural value. 714 * @private 715 */ 716goog.i18n.pluralRules.ltSelect_ = function(n, opt_precision) { 717 var vf = goog.i18n.pluralRules.get_vf_(n, opt_precision); 718 if (n % 10 == 1 && (n % 100 < 11 || n % 100 > 19)) { 719 return goog.i18n.pluralRules.Keyword.ONE; 720 } 721 if (n % 10 >= 2 && n % 10 <= 9 && (n % 100 < 11 || n % 100 > 19)) { 722 return goog.i18n.pluralRules.Keyword.FEW; 723 } 724 if (vf.f != 0) { 725 return goog.i18n.pluralRules.Keyword.MANY; 726 } 727 return goog.i18n.pluralRules.Keyword.OTHER; 728}; 729 730/** 731 * Plural select rules for gd locale 732 * 733 * @param {number} n The count of items. 734 * @param {number=} opt_precision Precision for number formatting, if not default. 735 * @return {goog.i18n.pluralRules.Keyword} Locale-specific plural value. 736 * @private 737 */ 738goog.i18n.pluralRules.gdSelect_ = function(n, opt_precision) { 739 if (n == 1 || n == 11) { 740 return goog.i18n.pluralRules.Keyword.ONE; 741 } 742 if (n == 2 || n == 12) { 743 return goog.i18n.pluralRules.Keyword.TWO; 744 } 745 if (n >= 3 && n <= 10 || n >= 13 && n <= 19) { 746 return goog.i18n.pluralRules.Keyword.FEW; 747 } 748 return goog.i18n.pluralRules.Keyword.OTHER; 749}; 750 751/** 752 * Plural select rules for lv locale 753 * 754 * @param {number} n The count of items. 755 * @param {number=} opt_precision Precision for number formatting, if not default. 756 * @return {goog.i18n.pluralRules.Keyword} Locale-specific plural value. 757 * @private 758 */ 759goog.i18n.pluralRules.lvSelect_ = function(n, opt_precision) { 760 var vf = goog.i18n.pluralRules.get_vf_(n, opt_precision); 761 if (n % 10 == 0 || n % 100 >= 11 && n % 100 <= 19 || vf.v == 2 && vf.f % 100 >= 11 && vf.f % 100 <= 19) { 762 return goog.i18n.pluralRules.Keyword.ZERO; 763 } 764 if (n % 10 == 1 && n % 100 != 11 || vf.v == 2 && vf.f % 10 == 1 && vf.f % 100 != 11 || vf.v != 2 && vf.f % 10 == 1) { 765 return goog.i18n.pluralRules.Keyword.ONE; 766 } 767 return goog.i18n.pluralRules.Keyword.OTHER; 768}; 769 770/** 771 * Plural select rules for ksh locale 772 * 773 * @param {number} n The count of items. 774 * @param {number=} opt_precision Precision for number formatting, if not default. 775 * @return {goog.i18n.pluralRules.Keyword} Locale-specific plural value. 776 * @private 777 */ 778goog.i18n.pluralRules.kshSelect_ = function(n, opt_precision) { 779 if (n == 0) { 780 return goog.i18n.pluralRules.Keyword.ZERO; 781 } 782 if (n == 1) { 783 return goog.i18n.pluralRules.Keyword.ONE; 784 } 785 return goog.i18n.pluralRules.Keyword.OTHER; 786}; 787 788/** 789 * Selected Plural rules by locale. 790 */ 791goog.i18n.pluralRules.select = goog.i18n.pluralRules.enSelect_; 792if (goog.LOCALE == 'af') { 793 goog.i18n.pluralRules.select = goog.i18n.pluralRules.esSelect_; 794} 795if (goog.LOCALE == 'am') { 796 goog.i18n.pluralRules.select = goog.i18n.pluralRules.hiSelect_; 797} 798if (goog.LOCALE == 'ar') { 799 goog.i18n.pluralRules.select = goog.i18n.pluralRules.arSelect_; 800} 801if (goog.LOCALE == 'az') { 802 goog.i18n.pluralRules.select = goog.i18n.pluralRules.esSelect_; 803} 804if (goog.LOCALE == 'bg') { 805 goog.i18n.pluralRules.select = goog.i18n.pluralRules.esSelect_; 806} 807if (goog.LOCALE == 'bn') { 808 goog.i18n.pluralRules.select = goog.i18n.pluralRules.hiSelect_; 809} 810if (goog.LOCALE == 'br') { 811 goog.i18n.pluralRules.select = goog.i18n.pluralRules.brSelect_; 812} 813if (goog.LOCALE == 'ca') { 814 goog.i18n.pluralRules.select = goog.i18n.pluralRules.enSelect_; 815} 816if (goog.LOCALE == 'chr') { 817 goog.i18n.pluralRules.select = goog.i18n.pluralRules.esSelect_; 818} 819if (goog.LOCALE == 'cs') { 820 goog.i18n.pluralRules.select = goog.i18n.pluralRules.csSelect_; 821} 822if (goog.LOCALE == 'cy') { 823 goog.i18n.pluralRules.select = goog.i18n.pluralRules.cySelect_; 824} 825if (goog.LOCALE == 'da') { 826 goog.i18n.pluralRules.select = goog.i18n.pluralRules.daSelect_; 827} 828if (goog.LOCALE == 'de') { 829 goog.i18n.pluralRules.select = goog.i18n.pluralRules.enSelect_; 830} 831if (goog.LOCALE == 'de_AT' || goog.LOCALE == 'de-AT') { 832 goog.i18n.pluralRules.select = goog.i18n.pluralRules.enSelect_; 833} 834if (goog.LOCALE == 'de_CH' || goog.LOCALE == 'de-CH') { 835 goog.i18n.pluralRules.select = goog.i18n.pluralRules.enSelect_; 836} 837if (goog.LOCALE == 'el') { 838 goog.i18n.pluralRules.select = goog.i18n.pluralRules.esSelect_; 839} 840if (goog.LOCALE == 'en') { 841 goog.i18n.pluralRules.select = goog.i18n.pluralRules.enSelect_; 842} 843if (goog.LOCALE == 'en_AU' || goog.LOCALE == 'en-AU') { 844 goog.i18n.pluralRules.select = goog.i18n.pluralRules.enSelect_; 845} 846if (goog.LOCALE == 'en_GB' || goog.LOCALE == 'en-GB') { 847 goog.i18n.pluralRules.select = goog.i18n.pluralRules.enSelect_; 848} 849if (goog.LOCALE == 'en_IE' || goog.LOCALE == 'en-IE') { 850 goog.i18n.pluralRules.select = goog.i18n.pluralRules.enSelect_; 851} 852if (goog.LOCALE == 'en_IN' || goog.LOCALE == 'en-IN') { 853 goog.i18n.pluralRules.select = goog.i18n.pluralRules.enSelect_; 854} 855if (goog.LOCALE == 'en_ISO' || goog.LOCALE == 'en-ISO') { 856 goog.i18n.pluralRules.select = goog.i18n.pluralRules.enSelect_; 857} 858if (goog.LOCALE == 'en_SG' || goog.LOCALE == 'en-SG') { 859 goog.i18n.pluralRules.select = goog.i18n.pluralRules.enSelect_; 860} 861if (goog.LOCALE == 'en_US' || goog.LOCALE == 'en-US') { 862 goog.i18n.pluralRules.select = goog.i18n.pluralRules.enSelect_; 863} 864if (goog.LOCALE == 'en_ZA' || goog.LOCALE == 'en-ZA') { 865 goog.i18n.pluralRules.select = goog.i18n.pluralRules.enSelect_; 866} 867if (goog.LOCALE == 'es') { 868 goog.i18n.pluralRules.select = goog.i18n.pluralRules.esSelect_; 869} 870if (goog.LOCALE == 'es_419' || goog.LOCALE == 'es-419') { 871 goog.i18n.pluralRules.select = goog.i18n.pluralRules.esSelect_; 872} 873if (goog.LOCALE == 'es_ES' || goog.LOCALE == 'es-ES') { 874 goog.i18n.pluralRules.select = goog.i18n.pluralRules.esSelect_; 875} 876if (goog.LOCALE == 'et') { 877 goog.i18n.pluralRules.select = goog.i18n.pluralRules.enSelect_; 878} 879if (goog.LOCALE == 'eu') { 880 goog.i18n.pluralRules.select = goog.i18n.pluralRules.esSelect_; 881} 882if (goog.LOCALE == 'fa') { 883 goog.i18n.pluralRules.select = goog.i18n.pluralRules.hiSelect_; 884} 885if (goog.LOCALE == 'fi') { 886 goog.i18n.pluralRules.select = goog.i18n.pluralRules.enSelect_; 887} 888if (goog.LOCALE == 'fil') { 889 goog.i18n.pluralRules.select = goog.i18n.pluralRules.filSelect_; 890} 891if (goog.LOCALE == 'fr') { 892 goog.i18n.pluralRules.select = goog.i18n.pluralRules.frSelect_; 893} 894if (goog.LOCALE == 'fr_CA' || goog.LOCALE == 'fr-CA') { 895 goog.i18n.pluralRules.select = goog.i18n.pluralRules.frSelect_; 896} 897if (goog.LOCALE == 'gl') { 898 goog.i18n.pluralRules.select = goog.i18n.pluralRules.enSelect_; 899} 900if (goog.LOCALE == 'gsw') { 901 goog.i18n.pluralRules.select = goog.i18n.pluralRules.esSelect_; 902} 903if (goog.LOCALE == 'gu') { 904 goog.i18n.pluralRules.select = goog.i18n.pluralRules.hiSelect_; 905} 906if (goog.LOCALE == 'haw') { 907 goog.i18n.pluralRules.select = goog.i18n.pluralRules.esSelect_; 908} 909if (goog.LOCALE == 'he') { 910 goog.i18n.pluralRules.select = goog.i18n.pluralRules.heSelect_; 911} 912if (goog.LOCALE == 'hi') { 913 goog.i18n.pluralRules.select = goog.i18n.pluralRules.hiSelect_; 914} 915if (goog.LOCALE == 'hr') { 916 goog.i18n.pluralRules.select = goog.i18n.pluralRules.srSelect_; 917} 918if (goog.LOCALE == 'hu') { 919 goog.i18n.pluralRules.select = goog.i18n.pluralRules.esSelect_; 920} 921if (goog.LOCALE == 'hy') { 922 goog.i18n.pluralRules.select = goog.i18n.pluralRules.frSelect_; 923} 924if (goog.LOCALE == 'id') { 925 goog.i18n.pluralRules.select = goog.i18n.pluralRules.defaultSelect_; 926} 927if (goog.LOCALE == 'in') { 928 goog.i18n.pluralRules.select = goog.i18n.pluralRules.defaultSelect_; 929} 930if (goog.LOCALE == 'is') { 931 goog.i18n.pluralRules.select = goog.i18n.pluralRules.isSelect_; 932} 933if (goog.LOCALE == 'it') { 934 goog.i18n.pluralRules.select = goog.i18n.pluralRules.enSelect_; 935} 936if (goog.LOCALE == 'iw') { 937 goog.i18n.pluralRules.select = goog.i18n.pluralRules.heSelect_; 938} 939if (goog.LOCALE == 'ja') { 940 goog.i18n.pluralRules.select = goog.i18n.pluralRules.defaultSelect_; 941} 942if (goog.LOCALE == 'ka') { 943 goog.i18n.pluralRules.select = goog.i18n.pluralRules.esSelect_; 944} 945if (goog.LOCALE == 'kk') { 946 goog.i18n.pluralRules.select = goog.i18n.pluralRules.esSelect_; 947} 948if (goog.LOCALE == 'km') { 949 goog.i18n.pluralRules.select = goog.i18n.pluralRules.defaultSelect_; 950} 951if (goog.LOCALE == 'kn') { 952 goog.i18n.pluralRules.select = goog.i18n.pluralRules.hiSelect_; 953} 954if (goog.LOCALE == 'ko') { 955 goog.i18n.pluralRules.select = goog.i18n.pluralRules.defaultSelect_; 956} 957if (goog.LOCALE == 'ky') { 958 goog.i18n.pluralRules.select = goog.i18n.pluralRules.esSelect_; 959} 960if (goog.LOCALE == 'ln') { 961 goog.i18n.pluralRules.select = goog.i18n.pluralRules.akSelect_; 962} 963if (goog.LOCALE == 'lo') { 964 goog.i18n.pluralRules.select = goog.i18n.pluralRules.defaultSelect_; 965} 966if (goog.LOCALE == 'lt') { 967 goog.i18n.pluralRules.select = goog.i18n.pluralRules.ltSelect_; 968} 969if (goog.LOCALE == 'lv') { 970 goog.i18n.pluralRules.select = goog.i18n.pluralRules.lvSelect_; 971} 972if (goog.LOCALE == 'mk') { 973 goog.i18n.pluralRules.select = goog.i18n.pluralRules.mkSelect_; 974} 975if (goog.LOCALE == 'ml') { 976 goog.i18n.pluralRules.select = goog.i18n.pluralRules.esSelect_; 977} 978if (goog.LOCALE == 'mn') { 979 goog.i18n.pluralRules.select = goog.i18n.pluralRules.esSelect_; 980} 981if (goog.LOCALE == 'mo') { 982 goog.i18n.pluralRules.select = goog.i18n.pluralRules.roSelect_; 983} 984if (goog.LOCALE == 'mr') { 985 goog.i18n.pluralRules.select = goog.i18n.pluralRules.hiSelect_; 986} 987if (goog.LOCALE == 'ms') { 988 goog.i18n.pluralRules.select = goog.i18n.pluralRules.defaultSelect_; 989} 990if (goog.LOCALE == 'mt') { 991 goog.i18n.pluralRules.select = goog.i18n.pluralRules.mtSelect_; 992} 993if (goog.LOCALE == 'my') { 994 goog.i18n.pluralRules.select = goog.i18n.pluralRules.defaultSelect_; 995} 996if (goog.LOCALE == 'nb') { 997 goog.i18n.pluralRules.select = goog.i18n.pluralRules.esSelect_; 998} 999if (goog.LOCALE == 'ne') { 1000 goog.i18n.pluralRules.select = goog.i18n.pluralRules.esSelect_; 1001} 1002if (goog.LOCALE == 'nl') { 1003 goog.i18n.pluralRules.select = goog.i18n.pluralRules.enSelect_; 1004} 1005if (goog.LOCALE == 'no') { 1006 goog.i18n.pluralRules.select = goog.i18n.pluralRules.esSelect_; 1007} 1008if (goog.LOCALE == 'no_NO' || goog.LOCALE == 'no-NO') { 1009 goog.i18n.pluralRules.select = goog.i18n.pluralRules.esSelect_; 1010} 1011if (goog.LOCALE == 'or') { 1012 goog.i18n.pluralRules.select = goog.i18n.pluralRules.esSelect_; 1013} 1014if (goog.LOCALE == 'pa') { 1015 goog.i18n.pluralRules.select = goog.i18n.pluralRules.akSelect_; 1016} 1017if (goog.LOCALE == 'pl') { 1018 goog.i18n.pluralRules.select = goog.i18n.pluralRules.plSelect_; 1019} 1020if (goog.LOCALE == 'pt') { 1021 goog.i18n.pluralRules.select = goog.i18n.pluralRules.ptSelect_; 1022} 1023if (goog.LOCALE == 'pt_BR' || goog.LOCALE == 'pt-BR') { 1024 goog.i18n.pluralRules.select = goog.i18n.pluralRules.ptSelect_; 1025} 1026if (goog.LOCALE == 'pt_PT' || goog.LOCALE == 'pt-PT') { 1027 goog.i18n.pluralRules.select = goog.i18n.pluralRules.pt_PTSelect_; 1028} 1029if (goog.LOCALE == 'ro') { 1030 goog.i18n.pluralRules.select = goog.i18n.pluralRules.roSelect_; 1031} 1032if (goog.LOCALE == 'ru') { 1033 goog.i18n.pluralRules.select = goog.i18n.pluralRules.ruSelect_; 1034} 1035if (goog.LOCALE == 'sh') { 1036 goog.i18n.pluralRules.select = goog.i18n.pluralRules.srSelect_; 1037} 1038if (goog.LOCALE == 'si') { 1039 goog.i18n.pluralRules.select = goog.i18n.pluralRules.siSelect_; 1040} 1041if (goog.LOCALE == 'sk') { 1042 goog.i18n.pluralRules.select = goog.i18n.pluralRules.csSelect_; 1043} 1044if (goog.LOCALE == 'sl') { 1045 goog.i18n.pluralRules.select = goog.i18n.pluralRules.slSelect_; 1046} 1047if (goog.LOCALE == 'sq') { 1048 goog.i18n.pluralRules.select = goog.i18n.pluralRules.esSelect_; 1049} 1050if (goog.LOCALE == 'sr') { 1051 goog.i18n.pluralRules.select = goog.i18n.pluralRules.srSelect_; 1052} 1053if (goog.LOCALE == 'sv') { 1054 goog.i18n.pluralRules.select = goog.i18n.pluralRules.enSelect_; 1055} 1056if (goog.LOCALE == 'sw') { 1057 goog.i18n.pluralRules.select = goog.i18n.pluralRules.enSelect_; 1058} 1059if (goog.LOCALE == 'ta') { 1060 goog.i18n.pluralRules.select = goog.i18n.pluralRules.esSelect_; 1061} 1062if (goog.LOCALE == 'te') { 1063 goog.i18n.pluralRules.select = goog.i18n.pluralRules.esSelect_; 1064} 1065if (goog.LOCALE == 'th') { 1066 goog.i18n.pluralRules.select = goog.i18n.pluralRules.defaultSelect_; 1067} 1068if (goog.LOCALE == 'tl') { 1069 goog.i18n.pluralRules.select = goog.i18n.pluralRules.filSelect_; 1070} 1071if (goog.LOCALE == 'tr') { 1072 goog.i18n.pluralRules.select = goog.i18n.pluralRules.esSelect_; 1073} 1074if (goog.LOCALE == 'uk') { 1075 goog.i18n.pluralRules.select = goog.i18n.pluralRules.ruSelect_; 1076} 1077if (goog.LOCALE == 'ur') { 1078 goog.i18n.pluralRules.select = goog.i18n.pluralRules.enSelect_; 1079} 1080if (goog.LOCALE == 'uz') { 1081 goog.i18n.pluralRules.select = goog.i18n.pluralRules.esSelect_; 1082} 1083if (goog.LOCALE == 'vi') { 1084 goog.i18n.pluralRules.select = goog.i18n.pluralRules.defaultSelect_; 1085} 1086if (goog.LOCALE == 'zh') { 1087 goog.i18n.pluralRules.select = goog.i18n.pluralRules.defaultSelect_; 1088} 1089if (goog.LOCALE == 'zh_CN' || goog.LOCALE == 'zh-CN') { 1090 goog.i18n.pluralRules.select = goog.i18n.pluralRules.defaultSelect_; 1091} 1092if (goog.LOCALE == 'zh_HK' || goog.LOCALE == 'zh-HK') { 1093 goog.i18n.pluralRules.select = goog.i18n.pluralRules.defaultSelect_; 1094} 1095if (goog.LOCALE == 'zh_TW' || goog.LOCALE == 'zh-TW') { 1096 goog.i18n.pluralRules.select = goog.i18n.pluralRules.defaultSelect_; 1097} 1098if (goog.LOCALE == 'zu') { 1099 goog.i18n.pluralRules.select = goog.i18n.pluralRules.hiSelect_; 1100} 1101