ApiSandbox: Visual separation of fields
[mediawiki.git] / resources / src / mediawiki.language / mediawiki.cldr.js
blobca4b6fbe49587dc7825586a9323afbc8b1d043cd
1 ( function ( mw ) {
2 'use strict';
4 /**
5 * Namespace for CLDR-related utility methods.
7 * @class
8 * @singleton
9 */
10 mw.cldr = {
11 /**
12 * Get the plural form index for the number.
14 * In case none of the rules passed, we return `pluralRules.length` -
15 * that means it is the "other" form.
17 * @param {number} number
18 * @param {Array} pluralRules
19 * @return {number} plural form index
21 getPluralForm: function ( number, pluralRules ) {
22 var i;
23 for ( i = 0; i < pluralRules.length; i++ ) {
24 if ( mw.libs.pluralRuleParser( pluralRules[ i ], number ) ) {
25 break;
28 return i;
32 }( mediaWiki ) );