Update jquery.i18n to 8267e1dbef

Whitespace changes only

Change-Id: I150b69b5015440215573f2f40e7ac56bacea6c90
This commit is contained in:
Niklas Laxström
2016-04-15 07:48:28 +02:00
committed by Nikerabbit
parent aba4540cef
commit 07b764a11f
20 changed files with 75 additions and 75 deletions

View File

@@ -51,7 +51,7 @@
if ( !m ) {
return null;
}
if ( m[2] === undefined ) {
if ( m[ 2 ] === undefined ) {
return 'ltr';
}
return 'rtl';
@@ -72,17 +72,17 @@
* direction inference). The latter is cleaner but still not widely supported.
*/
bidi: function ( nodes ) {
var dir = strongDirFromContent( nodes[0] );
var dir = strongDirFromContent( nodes[ 0 ] );
if ( dir === 'ltr' ) {
// Wrap in LEFT-TO-RIGHT EMBEDDING ... POP DIRECTIONAL FORMATTING
return '\u202A' + nodes[0] + '\u202C';
return '\u202A' + nodes[ 0 ] + '\u202C';
}
if ( dir === 'rtl' ) {
// Wrap in RIGHT-TO-LEFT EMBEDDING ... POP DIRECTIONAL FORMATTING
return '\u202B' + nodes[0] + '\u202C';
return '\u202B' + nodes[ 0 ] + '\u202C';
}
// No strong directionality: do not wrap
return nodes[0];
return nodes[ 0 ];
}
} );
}( jQuery ) );

View File

@@ -17,7 +17,7 @@
'use strict';
var MessageParserEmitter = function () {
this.language = $.i18n.languages[String.locale] || $.i18n.languages['default'];
this.language = $.i18n.languages[ String.locale ] || $.i18n.languages[ 'default' ];
};
MessageParserEmitter.prototype = {
@@ -48,10 +48,10 @@
return messageParserEmitter.emit( n, replacements );
} );
operation = node[0].toLowerCase();
operation = node[ 0 ].toLowerCase();
if ( typeof messageParserEmitter[operation] === 'function' ) {
ret = messageParserEmitter[operation]( subnodes, replacements );
if ( typeof messageParserEmitter[ operation ] === 'function' ) {
ret = messageParserEmitter[ operation ]( subnodes, replacements );
} else {
throw new Error( 'unknown operation "' + operation + '"' );
}
@@ -106,11 +106,11 @@
* @return {string} replacement
*/
replace: function ( nodes, replacements ) {
var index = parseInt( nodes[0], 10 );
var index = parseInt( nodes[ 0 ], 10 );
if ( index < replacements.length ) {
// replacement is not a string, don't touch!
return replacements[index];
return replacements[ index ];
} else {
// index not found, fallback to displaying variable
return '$' + ( index + 1 );
@@ -128,7 +128,7 @@
* language.
*/
plural: function ( nodes ) {
var count = parseFloat( this.language.convertNumber( nodes[0], 10 ) ),
var count = parseFloat( this.language.convertNumber( nodes[ 0 ], 10 ) ),
forms = nodes.slice( 1 );
return forms.length ? this.language.convertPlural( count, forms ) : '';
@@ -142,7 +142,7 @@
* @return {String} selected gender form according to current language
*/
gender: function ( nodes ) {
var gender = nodes[0],
var gender = nodes[ 0 ],
forms = nodes.slice( 1 );
return this.language.gender( gender, forms );
@@ -157,8 +157,8 @@
* language.
*/
grammar: function ( nodes ) {
var form = nodes[0],
word = nodes[1];
var form = nodes[ 0 ],
word = nodes[ 1 ];
return word && form && this.language.convertGrammar( word, form );
}

View File

@@ -75,7 +75,7 @@
break;
}
locale = ( $.i18n.fallbacks[i18n.locale] && $.i18n.fallbacks[i18n.locale][fallbackIndex] ) ||
locale = ( $.i18n.fallbacks[ i18n.locale ] && $.i18n.fallbacks[ i18n.locale ][ fallbackIndex ] ) ||
i18n.options.fallbackLocale;
$.i18n.log( 'Trying fallback locale for ' + i18n.locale + ': ' + locale );
@@ -146,12 +146,12 @@
source.split( '.' ).pop() !== 'json'
) {
// Load specified locale then check for fallbacks when directory is specified in load()
sourceMap[locale] = source + '/' + locale + '.json';
fallbackLocales = ( $.i18n.fallbacks[locale] || [] )
sourceMap[ locale ] = source + '/' + locale + '.json';
fallbackLocales = ( $.i18n.fallbacks[ locale ] || [] )
.concat( this.options.fallbackLocale );
for ( locIndex in fallbackLocales ) {
fallbackLocale = fallbackLocales[locIndex];
sourceMap[fallbackLocale] = source + '/' + fallbackLocale + '.json';
fallbackLocale = fallbackLocales[ locIndex ];
sourceMap[ fallbackLocale ] = source + '/' + fallbackLocale + '.json';
}
return this.load( sourceMap );
} else {
@@ -172,7 +172,7 @@
// FIXME: This changes the state of the I18N object,
// should probably not change the 'this.parser' but just
// pass it to the parser.
this.parser.language = $.i18n.languages[$.i18n().locale] || $.i18n.languages['default'];
this.parser.language = $.i18n.languages[ $.i18n().locale ] || $.i18n.languages[ 'default' ];
if ( message === '' ) {
message = key;
}
@@ -262,7 +262,7 @@
parse: function ( message, parameters ) {
return message.replace( /\$(\d+)/g, function ( str, match ) {
var index = parseInt( match, 10 ) - 1;
return parameters[index] !== undefined ? parameters[index] : '$' + match;
return parameters[ index ] !== undefined ? parameters[ index ] : '$' + match;
} );
},
emitter: {}

View File

@@ -285,13 +285,13 @@
// Handle for Explicit 0= & 1= values
for ( index = 0; index < forms.length; index++ ) {
form = forms[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[ index ] = undefined;
}
}
@@ -301,17 +301,17 @@
}
} );
pluralRules = this.pluralRules[$.i18n().locale];
pluralRules = this.pluralRules[ $.i18n().locale ];
if ( !pluralRules ) {
// default fallback.
return ( count === 1 ) ? forms[0] : forms[1];
return ( count === 1 ) ? forms[ 0 ] : forms[ 1 ];
}
pluralFormIndex = this.getPluralForm( count, pluralRules );
pluralFormIndex = Math.min( pluralFormIndex, forms.length - 1 );
return forms[pluralFormIndex];
return forms[ pluralFormIndex ];
},
/**
@@ -327,8 +327,8 @@
pluralFormIndex = 0;
for ( i = 0; i < pluralForms.length; i++ ) {
if ( pluralRules[pluralForms[i]] ) {
if ( pluralRuleParser( pluralRules[pluralForms[i]], number ) ) {
if ( pluralRules[ pluralForms[ i ] ] ) {
if ( pluralRuleParser( pluralRules[ pluralForms[ i ] ], number ) ) {
return pluralFormIndex;
}
@@ -367,17 +367,17 @@
tmp = [];
for ( item in transformTable ) {
tmp[transformTable[item]] = item;
tmp[ transformTable[ item ] ] = item;
}
transformTable = tmp;
}
for ( i = 0; i < numberString.length; i++ ) {
if ( transformTable[numberString[i]] ) {
convertedNumber += transformTable[numberString[i]];
if ( transformTable[ numberString[ i ] ] ) {
convertedNumber += transformTable[ numberString[ i ] ];
} else {
convertedNumber += numberString[i];
convertedNumber += numberString[ i ];
}
}
@@ -418,18 +418,18 @@
}
while ( forms.length < 2 ) {
forms.push( forms[forms.length - 1] );
forms.push( forms[ forms.length - 1 ] );
}
if ( gender === 'male' ) {
return forms[0];
return forms[ 0 ];
}
if ( gender === 'female' ) {
return forms[1];
return forms[ 1 ];
}
return ( forms.length === 3 ) ? forms[2] : forms[0];
return ( forms.length === 3 ) ? forms[ 2 ] : forms[ 0 ];
},
/**
@@ -458,11 +458,11 @@
bo: '༠༡༢༣༤༥༦༧༨༩' // FIXME use iso 639 codes
};
if ( !tables[language] ) {
if ( !tables[ language ] ) {
return false;
}
return tables[language].split( '' );
return tables[ language ].split( '' );
}
};

View File

@@ -74,7 +74,7 @@
locale = key;
// No {locale} given, assume data is a group of languages,
// call this function again for each language.
deferreds.push( messageStore.load( source[key], locale ) );
deferreds.push( messageStore.load( source[ key ], locale ) );
}
}
return $.when.apply( $, deferreds );
@@ -89,10 +89,10 @@
* @param messages
*/
set: function ( locale, messages ) {
if ( !this.messages[locale] ) {
this.messages[locale] = messages;
if ( !this.messages[ locale ] ) {
this.messages[ locale ] = messages;
} else {
this.messages[locale] = $.extend( this.messages[locale], messages );
this.messages[ locale ] = $.extend( this.messages[ locale ], messages );
}
},
@@ -103,7 +103,7 @@
* @returns {Boolean}
*/
get: function ( locale, messageKey ) {
return this.messages[locale] && this.messages[locale][messageKey];
return this.messages[ locale ] && this.messages[ locale ][ messageKey ];
}
};

View File

@@ -18,7 +18,7 @@
var MessageParser = function ( options ) {
this.options = $.extend( {}, $.i18n.parser.defaults, options );
this.language = $.i18n.languages[String.locale] || $.i18n.languages['default'];
this.language = $.i18n.languages[ String.locale ] || $.i18n.languages[ 'default' ];
this.emitter = $.i18n.parser.emitter;
};
@@ -30,7 +30,7 @@
return message.replace( /\$(\d+)/g, function ( str, match ) {
var index = parseInt( match, 10 ) - 1;
return parameters[index] !== undefined ? parameters[index] : '$' + match;
return parameters[ index ] !== undefined ? parameters[ index ] : '$' + match;
} );
},
@@ -39,8 +39,8 @@
return this.simpleParse( message, replacements );
}
this.emitter.language = $.i18n.languages[$.i18n().locale] ||
$.i18n.languages['default'];
this.emitter.language = $.i18n.languages[ $.i18n().locale ] ||
$.i18n.languages[ 'default' ];
return this.emitter.emit( this.ast( message ), replacements );
},
@@ -58,7 +58,7 @@
var i, result;
for ( i = 0; i < parserSyntax.length; i++ ) {
result = parserSyntax[i]();
result = parserSyntax[ i ]();
if ( result !== null ) {
return result;
@@ -78,7 +78,7 @@
result = [];
for ( i = 0; i < parserSyntax.length; i++ ) {
res = parserSyntax[i]();
res = parserSyntax[ i ]();
if ( res === null ) {
pos = originalPos;
@@ -140,9 +140,9 @@
return null;
}
pos += matches[0].length;
pos += matches[ 0 ].length;
return matches[0];
return matches[ 0 ];
};
}
@@ -189,7 +189,7 @@
function escapedLiteral() {
var result = sequence( [ backslash, anyCharacter ] );
return result === null ? null : result[1];
return result === null ? null : result[ 1 ];
}
choice( [ escapedLiteral, regularLiteralWithoutSpace ] );
@@ -203,7 +203,7 @@
return null;
}
return [ 'REPLACE', parseInt( result[1], 10 ) - 1 ];
return [ 'REPLACE', parseInt( result[ 1 ], 10 ) - 1 ];
}
templateName = transform(
@@ -224,23 +224,23 @@
return null;
}
expr = result[1];
expr = result[ 1 ];
// use a "CONCAT" operator if there are multiple nodes,
// otherwise return the first node, raw.
return expr.length > 1 ? [ 'CONCAT' ].concat( expr ) : expr[0];
return expr.length > 1 ? [ 'CONCAT' ].concat( expr ) : expr[ 0 ];
}
function templateWithReplacement() {
var result = sequence( [ templateName, colon, replacement ] );
return result === null ? null : [ result[0], result[2] ];
return result === null ? null : [ result[ 0 ], result[ 2 ] ];
}
function templateWithOutReplacement() {
var result = sequence( [ templateName, colon, paramExpression ] );
return result === null ? null : [ result[0], result[2] ];
return result === null ? null : [ result[ 0 ], result[ 2 ] ];
}
templateContents = choice( [
@@ -254,7 +254,7 @@
nOrMore( 0, templateParam )
] );
return res === null ? null : res[0].concat( res[1] );
return res === null ? null : res[ 0 ].concat( res[ 1 ] );
},
function () {
var res = sequence( [ templateName, nOrMore( 0, templateParam ) ] );
@@ -263,7 +263,7 @@
return null;
}
return [ res[0] ].concat( res[1] );
return [ res[ 0 ] ].concat( res[ 1 ] );
}
] );
@@ -273,7 +273,7 @@
function template() {
var result = sequence( [ openTemplate, templateContents, closeTemplate ] );
return result === null ? null : result[1];
return result === null ? null : result[ 1 ];
}
expression = choice( [ template, replacement, literal ] );

View File

@@ -4,7 +4,7 @@
( function ( $ ) {
'use strict';
$.i18n.languages.bs = $.extend( {}, $.i18n.languages['default'], {
$.i18n.languages.bs = $.extend( {}, $.i18n.languages[ 'default' ], {
convertGrammar: function ( word, form ) {
switch ( form ) {
case 'instrumental': // instrumental

View File

@@ -4,7 +4,7 @@
( function ( $ ) {
'use strict';
$.i18n.languages.dsb = $.extend( {}, $.i18n.languages['default'], {
$.i18n.languages.dsb = $.extend( {}, $.i18n.languages[ 'default' ], {
convertGrammar: function ( word, form ) {
switch ( form ) {
case 'instrumental': // instrumental

View File

@@ -7,7 +7,7 @@
( function ( $ ) {
'use strict';
$.i18n.languages.fi = $.extend( {}, $.i18n.languages['default'], {
$.i18n.languages.fi = $.extend( {}, $.i18n.languages[ 'default' ], {
convertGrammar: function ( word, form ) {
// vowel harmony flag
var aou = word.match( /[aou][^äöy]*$/i ),

View File

@@ -4,7 +4,7 @@
( function ( $ ) {
'use strict';
$.i18n.languages.ga = $.extend( {}, $.i18n.languages['default'], {
$.i18n.languages.ga = $.extend( {}, $.i18n.languages[ 'default' ], {
convertGrammar: function ( word, form ) {
if ( form === 'ainmlae' ) {
switch ( word ) {

View File

@@ -4,7 +4,7 @@
( function ( $ ) {
'use strict';
$.i18n.languages.he = $.extend( {}, $.i18n.languages['default'], {
$.i18n.languages.he = $.extend( {}, $.i18n.languages[ 'default' ], {
convertGrammar: function ( word, form ) {
switch ( form ) {
case 'prefixed':

View File

@@ -4,7 +4,7 @@
( function ( $ ) {
'use strict';
$.i18n.languages.hsb = $.extend( {}, $.i18n.languages['default'], {
$.i18n.languages.hsb = $.extend( {}, $.i18n.languages[ 'default' ], {
convertGrammar: function ( word, form ) {
switch ( form ) {
case 'instrumental': // instrumental

View File

@@ -6,7 +6,7 @@
( function ( $ ) {
'use strict';
$.i18n.languages.hu = $.extend( {}, $.i18n.languages['default'], {
$.i18n.languages.hu = $.extend( {}, $.i18n.languages[ 'default' ], {
convertGrammar: function ( word, form ) {
switch ( form ) {
case 'rol':

View File

@@ -5,7 +5,7 @@
( function ( $ ) {
'use strict';
$.i18n.languages.hy = $.extend( {}, $.i18n.languages['default'], {
$.i18n.languages.hy = $.extend( {}, $.i18n.languages[ 'default' ], {
convertGrammar: function ( word, form ) {
if ( form === 'genitive' ) { // սեռական հոլով
if ( word.substr( -1 ) === 'ա' ) {

View File

@@ -7,7 +7,7 @@
( function ( $ ) {
'use strict';
$.i18n.languages.la = $.extend( {}, $.i18n.languages['default'], {
$.i18n.languages.la = $.extend( {}, $.i18n.languages[ 'default' ], {
convertGrammar: function ( word, form ) {
switch ( form ) {
case 'genitive':

View File

@@ -7,7 +7,7 @@
( function ( $ ) {
'use strict';
$.i18n.languages.ml = $.extend( {}, $.i18n.languages['default'], {
$.i18n.languages.ml = $.extend( {}, $.i18n.languages[ 'default' ], {
convertGrammar: function ( word, form ) {
form = form.toLowerCase();
switch ( form ) {

View File

@@ -7,7 +7,7 @@
( function ( $ ) {
'use strict';
$.i18n.languages.os = $.extend( {}, $.i18n.languages['default'], {
$.i18n.languages.os = $.extend( {}, $.i18n.languages[ 'default' ], {
convertGrammar: function ( word, form ) {
var endAllative, jot, hyphen, ending;

View File

@@ -5,7 +5,7 @@
( function ( $ ) {
'use strict';
$.i18n.languages.ru = $.extend( {}, $.i18n.languages['default'], {
$.i18n.languages.ru = $.extend( {}, $.i18n.languages[ 'default' ], {
convertGrammar: function ( word, form ) {
if ( form === 'genitive' ) { // родительный падеж
if ( word.substr( -1 ) === 'ь' ) {

View File

@@ -5,7 +5,7 @@
( function ( $ ) {
'use strict';
$.i18n.languages.sl = $.extend( {}, $.i18n.languages['default'], {
$.i18n.languages.sl = $.extend( {}, $.i18n.languages[ 'default' ], {
convertGrammar: function ( word, form ) {
switch ( form ) {
// locative

View File

@@ -5,7 +5,7 @@
( function ( $ ) {
'use strict';
$.i18n.languages.uk = $.extend( {}, $.i18n.languages['default'], {
$.i18n.languages.uk = $.extend( {}, $.i18n.languages[ 'default' ], {
convertGrammar: function ( word, form ) {
switch ( form ) {
case 'genitive': // родовий відмінок