html/js/i18n/jquery.i18n.js
function () {
			var 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,
					tryingLocale, message;

				value = this.valueOf();
				locale = i18n.locale;
				fallbackIndex = 0;

				while ( locale ) {
					// Iterate through locales starting at most-specific until
					// localization is found. As in fi-Latn-FI, fi-Latn and fi.
					localeParts = locale.split( '-' );
					localePartIndex = localeParts.length;

					do {
						tryingLocale = localeParts.slice( 0, localePartIndex ).join( '-' );
						message = i18n.messageStore.get( tryingLocale, value );

						if ( message ) {
							return message;
						}

						localePartIndex--;
					} while ( localePartIndex );

					if ( locale === 'en' ) {
						break;
					}

					locale = ( $.i18n.fallbacks[i18n.locale] && $.i18n.fallbacks[i18n.locale][fallbackIndex] ) ||
						i18n.options.fallbackLocale;
					$.i18n.log( 'Trying fallback locale for ' + i18n.locale + ': ' + locale );

					fallbackIndex++;
				}

				// key not found
				return '';
			};
		}
function () {
			var 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,
					tryingLocale, message;

				value = this.valueOf();
				locale = i18n.locale;
				fallbackIndex = 0;

				while ( locale ) {
					// Iterate through locales starting at most-specific until
					// localization is found. As in fi-Latn-FI, fi-Latn and fi.
					localeParts = locale.split( '-' );
					localePartIndex = localeParts.length;

					do {
						tryingLocale = localeParts.slice( 0, localePartIndex ).join( '-' );
						message = i18n.messageStore.get( tryingLocale, value );

						if ( message ) {
							return message;
						}

						localePartIndex--;
					} while ( localePartIndex );

					if ( locale === 'en' ) {
						break;
					}

					locale = ( $.i18n.fallbacks[i18n.locale] && $.i18n.fallbacks[i18n.locale][fallbackIndex] ) ||
						i18n.options.fallbackLocale;
					$.i18n.log( 'Trying fallback locale for ' + i18n.locale + ': ' + locale );

					fallbackIndex++;
				}

				// key not found
				return '';
			};
		}
function ( ) { var 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 , tryingLocale , message ; value = this . valueOf ( ) ; locale = i18n . locale ; fallbackIndex = 0 ; while ( locale ) { // Iterate through locales starting at most-specific until // localization is found. As in fi-Latn-FI, fi-Latn and fi. localeParts = locale . split ( '-' ) ; localePartIndex = localeParts . length ; do { tryingLocale = localeParts . slice ( 0 , localePartIndex ) . join ( '-' ) ; message = i18n . messageStore . get ( tryingLocale , value ) ; if ( message ) { return message ; } localePartIndex -- ; } while ( localePartIndex ) ; if ( locale === 'en' ) { break ; } locale = ( $ . i18n . fallbacks [ i18n . locale ] && $ . i18n . fallbacks [ i18n . locale ] [ fallbackIndex ] ) || i18n . options . fallbackLocale ; $ . i18n . log ( 'Trying fallback locale for ' + i18n . locale + ': ' + locale ) ; fallbackIndex ++ ; } // key not found return '' ; } ; }
Initialize by loading locales and setting up
String.prototype.toLocaleString and String.locale.
Initialize by loading locales and setting up String . prototype . toLocaleString and String . locale .