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
This commit is contained in:
Santhosh Thottingal
2013-11-08 16:08:54 +05:30
parent fca6e1b17b
commit 42deb56323
9 changed files with 97 additions and 81 deletions

View File

@@ -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,12 +521,35 @@
* @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];
if ( !pluralRules ) {
@@ -621,7 +643,7 @@
* @param form {String}
* @return {String}
*/
convertGrammar: function ( word, form ) {
convertGrammar: function ( word, form ) { /*jshint unused: false */
return word;
},