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:
@@ -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;
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user