jenkins-bot has submitted this change and it was merged.

Change subject: Update jquery.i18n from upstream
......................................................................


Update jquery.i18n from upstream

Upstream: https://github.com/wikimedia/jquery.i18n
Upstream changes:
* Fixed a potential js error because of wrong logic
* Fixed some JShint errors
* Added license and credits files
* Updated gitignore file
* Fixed uk and ru grammar rules and updating tests
* Source code formatting updates

Change-Id: I43433cc3d9993045160dc85ed9e73370d22794cf
---
M lib/jquery.i18n/jquery.i18n.emitter.js
M lib/jquery.i18n/jquery.i18n.fallbacks.js
M lib/jquery.i18n/jquery.i18n.js
M lib/jquery.i18n/jquery.i18n.language.js
M lib/jquery.i18n/jquery.i18n.messages.js
M lib/jquery.i18n/languages/ml.js
M lib/jquery.i18n/languages/os.js
M lib/jquery.i18n/languages/ru.js
M lib/jquery.i18n/languages/uk.js
9 files changed, 97 insertions(+), 81 deletions(-)

Approvals:
  KartikMistry: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/lib/jquery.i18n/jquery.i18n.emitter.js 
b/lib/jquery.i18n/jquery.i18n.emitter.js
index 590ef38..b26f147 100644
--- a/lib/jquery.i18n/jquery.i18n.emitter.js
+++ b/lib/jquery.i18n/jquery.i18n.emitter.js
@@ -165,5 +165,4 @@
        };
 
        $.extend( $.i18n.parser.emitter, new MessageParserEmitter() );
-
 }( jQuery ) );
diff --git a/lib/jquery.i18n/jquery.i18n.fallbacks.js 
b/lib/jquery.i18n/jquery.i18n.fallbacks.js
index db4018b..0b2eafb 100644
--- a/lib/jquery.i18n/jquery.i18n.fallbacks.js
+++ b/lib/jquery.i18n/jquery.i18n.fallbacks.js
@@ -15,7 +15,7 @@
        'use strict';
 
        $.i18n = $.i18n || {};
-       $.i18n.fallbacks = {
+       $.extend( $.i18n.fallbacks, {
                'ab': ['ru'],
                'ace': ['id'],
                'aln': ['sq'],
@@ -182,5 +182,5 @@
                'zh-sg': ['zh-hans'],
                'zh-tw': ['zh-hant', 'zh-hans'],
                'zh-yue': ['yue']
-       };
+       } );
 }( jQuery ) );
diff --git a/lib/jquery.i18n/jquery.i18n.js b/lib/jquery.i18n/jquery.i18n.js
index 34ed7d4..fe8d7ed 100644
--- a/lib/jquery.i18n/jquery.i18n.js
+++ b/lib/jquery.i18n/jquery.i18n.js
@@ -40,16 +40,15 @@
                 * String.prototype.toLocaleString and String.locale.
                 */
                init: function () {
-                       var i18n;
+                       var i18n = this;
 
-                       i18n = this;
                        // Set locale of String environment
                        String.locale = i18n.locale;
 
                        // Override String.localeString method
                        String.prototype.toLocaleString = function () {
                                var localeParts, localePartIndex, value, 
locale, fallbackIndex,
-                                       _locale, message;
+                                       tryingLocale, message;
 
                                value = this.valueOf();
                                locale = i18n.locale;
@@ -62,11 +61,13 @@
                                        localePartIndex = localeParts.length;
 
                                        do {
-                                               _locale = localeParts.slice( 0, 
localePartIndex ).join( '-' );
-                                               message = 
i18n.messageStore.get( _locale, value );
+                                               tryingLocale = 
localeParts.slice( 0, localePartIndex ).join( '-' );
+                                               message = 
i18n.messageStore.get( tryingLocale, value );
+
                                                if ( message ) {
                                                        return message;
                                                }
+
                                                localePartIndex--;
                                        } while ( localePartIndex );
 
@@ -118,12 +119,12 @@
                },
 
                /**
-               * Does parameter and magic word substitution.
-               *
-               * @param {string} key Message key
-               * @param {Array} parameters Message parameters
-               * @return {string}
-               */
+                * Does parameter and magic word substitution.
+                *
+                * @param {string} key Message key
+                * @param {Array} parameters Message parameters
+                * @return {string}
+                */
                parse: function ( key, parameters ) {
                        var message = key.toLocaleString();
                        // FIXME: This changes the state of the I18N object,
@@ -137,16 +138,15 @@
                }
        };
 
-
        /**
-       * Process a message from the $.I18N instance
-       * for the current document, stored in jQuery.data(document).
-       *
-       * @param {string} key Key of the message.
-       * @param {string} param1 [param...] Variadic list of parameters for 
{key}.
-       * @return {string|$.I18N} Parsed message, or if no key was given
-       * the instance of $.I18N is returned.
-       */
+        * Process a message from the $.I18N instance
+        * for the current document, stored in jQuery.data(document).
+        *
+        * @param {string} key Key of the message.
+        * @param {string} param1 [param...] Variadic list of parameters for 
{key}.
+        * @return {string|$.I18N} Parsed message, or if no key was given
+        * the instance of $.I18N is returned.
+        */
        $.i18n = function ( key, param1 ) {
                var parameters,
                        i18n = $.data( document, 'i18n' ),
@@ -184,12 +184,12 @@
 
        $.fn.i18n = function () {
                var i18n = $.data( document, 'i18n' );
-               String.locale = i18n.locale;
+
                if ( !i18n ) {
                        i18n = new I18N();
                        $.data( document, 'i18n', i18n );
                }
-
+               String.locale = i18n.locale;
                return this.each( function () {
                        var $this = $( this ),
                                messageKey = $this.data( 'i18n' );
@@ -225,7 +225,7 @@
                },
                emitter: {}
        };
-
+       $.i18n.fallbacks = {};
        $.i18n.debug = false;
        $.i18n.log = function ( /* arguments */ ) {
                if ( window.console && $.i18n.debug ) {
diff --git a/lib/jquery.i18n/jquery.i18n.language.js 
b/lib/jquery.i18n/jquery.i18n.language.js
index ae25286..291885f 100644
--- a/lib/jquery.i18n/jquery.i18n.language.js
+++ b/lib/jquery.i18n/jquery.i18n.language.js
@@ -3,7 +3,6 @@
        'use strict';
 
        var language = {
-
                // CLDR plural rules generated using
                // 
http://i18ndata.appspot.com/cldr/tags/unconfirmed/supplemental/plurals?action=browse&depth=-1
                // and compressed
@@ -522,11 +521,34 @@
                 * @return string Correct form for quantifier in this language
                 */
                convertPlural: function ( count, forms ) {
-                       var pluralRules, pluralFormIndex;
+                       var pluralRules,
+                               pluralFormIndex,
+                               index,
+                               explicitPluralPattern = new RegExp('\\d+=', 
'i'),
+                               formCount,
+                               form;
 
                        if ( !forms || forms.length === 0 ) {
                                return '';
                        }
+
+                       // Handle for Explicit 0= & 1= values
+                       for ( index = 0; index < forms.length; index++ ) {
+                               form = forms[index];
+                               if ( explicitPluralPattern.test( form ) ) {
+                                       formCount = parseInt( form.substring( 
0, form.indexOf( '=' ) ), 10 );
+                                       if ( formCount === count ) {
+                                               return ( form.substr( 
form.indexOf( '=' ) + 1 ) );
+                                       }
+                                       forms[index] = undefined;
+                               }
+                       }
+
+                       forms = $.map( forms, function ( form ) {
+                               if ( form !== undefined ) {
+                                       return form;
+                               }
+                       } );
 
                        pluralRules = this.pluralRules[$.i18n().locale];
 
@@ -621,7 +643,7 @@
                 * @param form {String}
                 * @return {String}
                 */
-               convertGrammar: function ( word, form ) {
+               convertGrammar: function ( word, form ) { /*jshint unused: 
false */
                        return word;
                },
 
diff --git a/lib/jquery.i18n/jquery.i18n.messages.js 
b/lib/jquery.i18n/jquery.i18n.messages.js
index 80b3c52..5df24ab 100644
--- a/lib/jquery.i18n/jquery.i18n.messages.js
+++ b/lib/jquery.i18n/jquery.i18n.messages.js
@@ -109,5 +109,4 @@
        }
 
        $.extend( $.i18n.messageStore, new MessageStore() );
-
 }( jQuery, window ) );
diff --git a/lib/jquery.i18n/languages/ml.js b/lib/jquery.i18n/languages/ml.js
index 02a5159..f724b7b 100644
--- a/lib/jquery.i18n/languages/ml.js
+++ b/lib/jquery.i18n/languages/ml.js
@@ -13,28 +13,29 @@
                        switch ( form ) {
                                case 'ഉദ്ദേശിക':
                                case 'dative':
-                                       if ( word.substr( -1 ) === 'ു'
-                                               || word.substr( -1 ) === 'ൂ'
-                                               || word.substr( -1 ) === 'ൗ'
-                                               || word.substr( -1 ) === 'ൌ' ) {
+                                       if ( word.substr( -1 ) === 'ു' ||
+                                               word.substr( -1 ) === 'ൂ' ||
+                                               word.substr( -1 ) === 'ൗ' ||
+                                               word.substr( -1 ) === 'ൌ'
+                                       ) {
                                                word += 'വിന്';
                                        } else if ( word.substr( -1 ) === 'ം' ) 
{
                                                word = word.substr( 0, 
word.length - 1 ) + 'ത്തിന്';
                                        } else if ( word.substr( -1 ) === 'ൻ' ) 
{
                                                // Atomic chillu n. അവൻ -> അവന്
                                                word = word.substr( 0, 
word.length - 1 ) + 'ന്';
-                                       } else if ( word.substr( -3 ) === 'ന്‍' 
) {
+                                       } else if ( word.substr( -3 ) === 
'ന്\u200d' ) {
                                                // chillu n. അവൻ -> അവന്
                                                word = word.substr( 0, 
word.length - 1 );
-                                       } else if ( word.substr( -1 ) === 'ൾ' 
|| word.substr( -3 ) === 'ള്‍' ) {
+                                       } else if ( word.substr( -1 ) === 'ൾ' 
|| word.substr( -3 ) === 'ള്\u200d' ) {
                                                word += 'ക്ക്';
-                                       } else if ( word.substr( -1 ) === 'ർ' 
|| word.substr( -3 ) === 'ര്‍' ) {
+                                       } else if ( word.substr( -1 ) === 'ർ' 
|| word.substr( -3 ) === 'ര്\u200d' ) {
                                                word += 'ക്ക്';
                                        } else if ( word.substr( -1 ) === 'ൽ' ) 
{
                                                // Atomic chillu ൽ , ഫയൽ -> 
ഫയലിന്
                                                word = word.substr( 0, 
word.length - 1 ) + 'ലിന്';
-                                       } else if ( word.substr( -3 ) === 'ല്‍' 
) {
-                                               // chillu ല്‍ , ഫയല്‍ -> ഫയലിന്
+                                       } else if ( word.substr( -3 ) === 
'ല്\u200d' ) {
+                                               // chillu ല്\u200d , ഫയല്\u200d 
-> ഫയലിന്
                                                word = word.substr( 0, 
word.length - 2 ) + 'ിന്';
                                        } else if ( word.substr( -2 ) === 'ു്' 
) {
                                                word = word.substr( 0, 
word.length - 2 ) + 'ിന്';
@@ -44,6 +45,7 @@
                                                // കാവ്യ -> കാവ്യയ്ക്ക്, ഹരി -> 
ഹരിയ്ക്ക്, മല -> മലയ്ക്ക്
                                                word += 'യ്ക്ക്';
                                        }
+
                                        break;
                                case 'സംബന്ധിക':
                                case 'genitive':
@@ -53,31 +55,32 @@
                                                word = word.substr( 0, 
word.length - 2 ) + 'ിന്റെ';
                                        } else if ( word.substr( -1 ) === '്' ) 
{
                                                word = word.substr( 0, 
word.length - 1 ) + 'ിന്റെ';
-                                       } else if (  word.substr( -1 ) === 'ു'
-                                               || word.substr( -1 ) === 'ൂ'
-                                               || word.substr( -1 ) === 'ൗ'
-                                               || word.substr( -1 ) === 'ൌ'  ) 
{
+                                       } else if (  word.substr( -1 ) === 'ു' 
||
+                                               word.substr( -1 ) === 'ൂ' ||
+                                               word.substr( -1 ) === 'ൗ' ||
+                                               word.substr( -1 ) === 'ൌ'
+                                       ) {
                                                word += 'വിന്റെ';
                                        } else if ( word.substr( -1 ) === 'ൻ' ) 
{
                                                // Atomic chillu n. അവൻ -> 
അവന്റെ
                                                word = word.substr( 0, 
word.length - 1 ) + 'ന്റെ';
-                                       } else if ( word.substr( -3 ) === 'ന്‍' 
) {
+                                       } else if ( word.substr( -3 ) === 
'ന്\u200d' ) {
                                                // chillu n. അവൻ -> അവന്റെ
-                                               word = word.substr( 0, 
word.length -1 ) + 'റെ';
-                                       } else if ( word.substr( -3 ) === 'ള്‍' 
) {
+                                               word = word.substr( 0, 
word.length - 1 ) + 'റെ';
+                                       } else if ( word.substr( -3 ) === 
'ള്\u200d' ) {
                                                // chillu n. അവൾ -> അവളുടെ
                                                word = word.substr( 0, 
word.length - 2 ) + 'ുടെ';
                                        } else if ( word.substr( -1 ) === 'ൾ' ) 
{
-                                               // Atomic chillu n. അവള്‍ -> 
അവളുടെ
+                                               // Atomic chillu n. അവള്\u200d 
-> അവളുടെ
                                                word = word.substr( 0, 
word.length - 1 ) + 'ളുടെ';
                                        } else if ( word.substr( -1 ) === 'ൽ' ) 
{
-                                               // Atomic l. മുയല്‍ -> മുയലിന്റെ
+                                               // Atomic l. മുയല്\u200d -> 
മുയലിന്റെ
                                                word = word.substr( 0, 
word.length - 1 ) + 'ലിന്റെ';
-                                       } else if ( word.substr( -3 ) === 'ല്‍' 
) {
-                                               // chillu l. മുയല്‍ -> അവളുടെ
+                                       } else if ( word.substr( -3 ) === 
'ല്\u200d' ) {
+                                               // chillu l. മുയല്\u200d -> 
അവളുടെ
                                                word = word.substr( 0, 
word.length - 2 ) + 'ിന്റെ';
-                                       } else if ( word.substr( -3 ) === 'ര്‍' 
) {
-                                               // chillu r. അവര്‍ -> അവരുടെ
+                                       } else if ( word.substr( -3 ) === 
'ര്\u200d' ) {
+                                               // chillu r. അവര്\u200d -> 
അവരുടെ
                                                word = word.substr( 0, 
word.length - 2 ) + 'ുടെ';
                                        } else if ( word.substr( -1 ) === 'ർ' ) 
{
                                                // Atomic chillu r. അവർ -> 
അവരുടെ
@@ -85,8 +88,10 @@
                                        } else {
                                                word += 'യുടെ';
                                        }
+
                                        break;
                        }
+
                        return word;
                }
        } );
diff --git a/lib/jquery.i18n/languages/os.js b/lib/jquery.i18n/languages/os.js
index 7b14d6e..67dccfb 100644
--- a/lib/jquery.i18n/languages/os.js
+++ b/lib/jquery.i18n/languages/os.js
@@ -9,14 +9,17 @@
 
        $.i18n.languages.os = $.extend( {}, $.i18n.languages['default'], {
                convertGrammar: function ( word, form ) {
+                       var endAllative, jot, hyphen, ending;
+
                        // Ending for allative case
-                       var endAllative = 'мæ';
+                       endAllative = 'мæ';
                        // Variable for 'j' beetwen vowels
-                       var jot = '';
+                       jot = '';
                        // Variable for "-" for not Ossetic words
-                       var hyphen = '';
+                       hyphen = '';
                        // Variable for ending
-                       var ending = '';
+                       ending = '';
+
                        // Checking if the $word is in plural form
                        if ( word.match( /тæ$/i ) ) {
                                word = word.substring( 0, word.length - 1 );
diff --git a/lib/jquery.i18n/languages/ru.js b/lib/jquery.i18n/languages/ru.js
index 9452036..893b238 100644
--- a/lib/jquery.i18n/languages/ru.js
+++ b/lib/jquery.i18n/languages/ru.js
@@ -8,21 +8,17 @@
        $.i18n.languages.ru = $.extend( {}, $.i18n.languages['default'], {
                convertGrammar: function ( word, form ) {
                        if ( form === 'genitive' ) { // родительный падеж
-                               if ( ( word.substr( word.length - 4 ) === 
'вики' ) ||
-                                       ( word.substr( word.length - 4 ) === 
'Вики' )
-                               ) {
-                                       // ...
-                               } else if ( word.substr( word.length - 1 ) === 
'ь' ) {
+                               if ( word.substr( -1 ) === 'ь' ) {
                                        word = word.substr( 0, word.length - 1 
) + 'я';
-                               } else if ( word.substr( word.length - 2 ) === 
'ия' ) {
+                               } else if ( word.substr( -2 ) === 'ия' ) {
                                        word = word.substr( 0, word.length - 2 
) + 'ии';
-                               } else if ( word.substr( word.length - 2 ) === 
'ка' ) {
+                               } else if ( word.substr( -2 ) === 'ка' ) {
                                        word = word.substr( 0, word.length - 2 
) + 'ки';
-                               } else if ( word.substr( word.length - 2 ) === 
'ти' ) {
+                               } else if ( word.substr( -2 ) === 'ти' ) {
                                        word = word.substr( 0, word.length - 2 
) + 'тей';
-                               } else if ( word.substr( word.length - 2 ) === 
'ды' ) {
+                               } else if ( word.substr( -2 ) === 'ды' ) {
                                        word = word.substr( 0, word.length - 2 
) + 'дов';
-                               } else if ( word.substr( word.length - 3 ) === 
'ник' ) {
+                               } else if ( word.substr( -3 ) === 'ник' ) {
                                        word = word.substr( 0, word.length - 3 
) + 'ника';
                                }
                        }
diff --git a/lib/jquery.i18n/languages/uk.js b/lib/jquery.i18n/languages/uk.js
index bd92bc0..8e69efc 100644
--- a/lib/jquery.i18n/languages/uk.js
+++ b/lib/jquery.i18n/languages/uk.js
@@ -9,31 +9,23 @@
                convertGrammar: function ( word, form ) {
                        switch ( form ) {
                        case 'genitive': // родовий відмінок
-                               if ( ( word.substr( word.length - 4 ) === 
'вікі' ) ||
-                                       ( word.substr( word.length - 4 ) === 
'Вікі' )
-                               ) {
-                                       // ...
-                               } else if ( word.substr( word.length - 1 ) === 
'ь' ) {
+                               if ( word.substr( -1 ) === 'ь' ) {
                                        word = word.substr( 0, word.length - 1 
) + 'я';
-                               } else if ( word.substr( word.length - 2 ) === 
'ія' ) {
+                               } else if ( word.substr( -2 ) === 'ія' ) {
                                        word = word.substr( 0, word.length - 2 
) + 'ії';
-                               } else if ( word.substr( word.length - 2 ) === 
'ка' ) {
+                               } else if ( word.substr( -2 ) === 'ка' ) {
                                        word = word.substr( 0, word.length - 2 
) + 'ки';
-                               } else if ( word.substr( word.length - 2 ) === 
'ти' ) {
+                               } else if ( word.substr( -2 ) === 'ти' ) {
                                        word = word.substr( 0, word.length - 2 
) + 'тей';
-                               } else if ( word.substr( word.length - 2 ) === 
'ды' ) {
+                               } else if ( word.substr( -2 ) === 'ды' ) {
                                        word = word.substr( 0, word.length - 2 
) + 'дов';
-                               } else if ( word.substr( word.length - 3 ) === 
'ник' ) {
+                               } else if ( word.substr( -3 ) === 'ник' ) {
                                        word = word.substr( 0, word.length - 3 
) + 'ника';
                                }
 
                                break;
                        case 'accusative': // знахідний відмінок
-                               if ( ( word.substr( word.length - 4 ) === 
'вікі' ) ||
-                                       ( word.substr( word.length - 4 ) === 
'Вікі' )
-                               ) {
-                                       //      ...
-                               } else if ( word.substr( word.length - 2 ) === 
'ія' ) {
+                               if ( word.substr( -2 ) === 'ія' ) {
                                        word = word.substr( 0, word.length - 2 
) + 'ію';
                                }
 

-- 
To view, visit https://gerrit.wikimedia.org/r/94334
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I43433cc3d9993045160dc85ed9e73370d22794cf
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/UniversalLanguageSelector
Gerrit-Branch: master
Gerrit-Owner: Santhosh <[email protected]>
Gerrit-Reviewer: KartikMistry <[email protected]>
Gerrit-Reviewer: Nikerabbit <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to