Implement extension registration from an extension.json file
[mediawiki.git] / resources / src / mediawiki.language / mediawiki.cldr.js
blobf6fb8f1079b958570df027fdcd6fefa6d7997f00
1 ( function ( mw ) {
2         'use strict';
4         /**
5          * Namespace for CLDR-related utility methods.
6          *
7          * @class
8          * @singleton
9          */
10         mw.cldr = {
11                 /**
12                  * Get the plural form index for the number.
13                  *
14                  * In case none of the rules passed, we return `pluralRules.length` -
15                  * that means it is the "other" form.
16                  *
17                  * @param {number} number
18                  * @param {Array} pluralRules
19                  * @return {number} plural form index
20                  */
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;
26                                 }
27                         }
28                         return i;
29                 }
30         };
32 }( mediaWiki ) );