From c35c10fecfe6742ff4d477fc69b63f0de38c3ae5 Mon Sep 17 00:00:00 2001 From: Juan Ignacio Dopazo Date: Fri, 27 Jun 2014 13:38:58 -0300 Subject: [PATCH 1/2] Add license information --- LICENSE.md | 27 +++++++++++++++++++++++++++ README.md | 7 +++++++ package.json | 1 + 3 files changed, 35 insertions(+) create mode 100644 LICENSE.md diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000000..0da75135fb --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,27 @@ +Copyright 2014 Yahoo Inc. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + * Neither the name of the Yahoo Inc. nor the + names of its contributors may be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL YAHOO! INC. BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/README.md b/README.md index 38c13c333c..de595c9294 100644 --- a/README.md +++ b/README.md @@ -375,6 +375,12 @@ Limitations Not all browsers have implemented [ECMAScript 402][], which is the internationalization API, for older browsers, and Safari, you might need to patch the browser by loading [Intl.js][] polyfill before including `react-intl.js` library. +License +------- + +This software is free to use under the Yahoo Inc. BSD license. +See the [LICENSE file][] for license text and copyright information. + [Intl.js]: https://github.com/andyearnshaw/Intl.js [ECMAScript 402]: http://www.ecma-international.org/ecma-402/1.0/ [ReactJS]: http://facebook.github.io/react/ @@ -384,3 +390,4 @@ Not all browsers have implemented [ECMAScript 402][], which is the international [Intl.NumberFormat]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/NumberFormat [Intl.DateTimeFormat]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat [Strawman Draft]: http://wiki.ecmascript.org/doku.php?id=globalization:messageformatting +[LICENSE file]: https://github.com/caridy/react-intl/blob/master/LICENSE.md diff --git a/package.json b/package.json index 6831018ebf..05b69b7a20 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,7 @@ "reactjs" ], "author": "Caridy Patino ", + "license": "BSD-3-Clause", "bugs": { "url": "https://github.com/caridy/react-intl/issues" }, From 695003866bfdb4f7faac6a99fc0583bd847245cf Mon Sep 17 00:00:00 2001 From: Juan Ignacio Dopazo Date: Fri, 27 Jun 2014 13:49:58 -0300 Subject: [PATCH 2/2] Add built files to the repo --- .gitignore | 3 +- dist/react-intl.js | 1293 ++++++++++++++++++++++++++++++++++++++++ dist/react-intl.min.js | 1 + 3 files changed, 1295 insertions(+), 2 deletions(-) create mode 100644 dist/react-intl.js create mode 100644 dist/react-intl.min.js diff --git a/.gitignore b/.gitignore index d86115b24e..83ce9ce240 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,5 @@ node_modules coverage -dist tmp example/build/ -example/react-*/ \ No newline at end of file +example/react-*/ diff --git a/dist/react-intl.js b/dist/react-intl.js new file mode 100644 index 0000000000..7527483d83 --- /dev/null +++ b/dist/react-intl.js @@ -0,0 +1,1293 @@ +(function (global) { + /* + Copyright (c) 2014, Yahoo! Inc. All rights reserved. + Copyrights licensed under the New BSD License. + See the accompanying LICENSE file for terms. + */ + + (function (root, factory) { + 'use strict'; + + var Intl = root.Intl || root.IntlPolyfill, + MessageFormat = factory(Intl); + + // register in -all- the module systems (at once) + if (typeof define === 'function' && define.amd) { + define(MessageFormat); + } + + if (typeof module === 'object' && typeof module.exports === 'object') { + module.exports = MessageFormat; + } + + if (root) { + root.IntlMessageFormat = MessageFormat; + } + + })(typeof global !== 'undefined' ? global : this, function (Intl) { + 'use strict'; + + if (!Intl) { + throw new ReferenceError ('Intl must be available'); + } + + // -- ES5 Built-ins -------------------------------------------------------- + + // Purposely using the same implementation as the Intl.js `Intl` polyfill. + // Copyright 2013 Andy Earnshaw, MIT License + + // Used for proto-less objects which won't have this method. + var hop = Object.prototype.hasOwnProperty; + + var realDefineProp = (function () { + try { return !!Object.defineProperty({}, 'a', {}); } + catch (e) { return false; } + })(); + + var es3 = !realDefineProp && !Object.prototype.__defineGetter__; + + var defineProperty = realDefineProp ? Object.defineProperty : + function (obj, name, desc) { + + if ('get' in desc && obj.__defineGetter__) { + obj.__defineGetter__(name, desc.get); + } else if (!hop.call(obj, name) || 'value' in desc) { + obj[name] = desc.value; + } + }; + + var objCreate = Object.create || function (proto, props) { + var obj, k; + + function F() {} + F.prototype = proto; + obj = new F(); + + for (k in props) { + if (hop.call(props, k)) { + defineProperty(obj, k, props[k]); + } + } + + return obj; + }; + + var fnBind = Function.prototype.bind || function (thisObj) { + var fn = this, + args = [].slice.call(arguments, 1); + + return function () { + fn.apply(thisObj, args.concat([].slice.call(arguments))); + }; + }; + + // -- MessageFormat -------------------------------------------------------- + + function MessageFormat(pattern, locales, formats) { + // Parse string messages into a tokenized JSON structure for traversal. + if (typeof pattern === 'string') { + pattern = MessageFormat.__parse(pattern); + } + + if (!(pattern && typeof pattern.length === 'number')) { + throw new TypeError('A pattern must be provided as a String or Array.'); + } + + // Creates a new object with the specified `formats` merged with the + // default formats. + formats = this._mergeFormats(MessageFormat.FORMATS, formats); + + // Defined first because it's used to build the format pattern. + defineProperty(this, '_locale', {value: this._resolveLocale(locales)}); + + // Define the `pattern` property, a compiled pattern that is highly + // optimized for repeated `format()` invocations. **Note:** This passes + // the `locales` set provided to the constructor instead of just the + // resolved locale. + pattern = this._compilePattern(pattern, locales, formats); + defineProperty(this, '_pattern', {value: pattern}); + + // Bind `format()` method to `this` so it can be passed by reference + // like the other `Intl` APIs. + this.format = fnBind.call(this.format, this); + } + + // Default format options used as the prototype of the `formats` provided to + // the constructor. These are used when constructing the internal + // Intl.NumberFormat and Intl.DateTimeFormat instances. + defineProperty(MessageFormat, 'FORMATS', { + enumerable: true, + + value: { + number: { + 'currency': { + style: 'currency' + }, + + 'percent': { + style: 'percent' + } + }, + + date: { + 'short': { + month: 'numeric', + day : 'numeric', + year : '2-digit' + }, + + 'medium': { + month: 'short', + day : 'numeric', + year : 'numeric' + }, + + 'long': { + month: 'long', + day : 'numeric', + year : 'numeric' + }, + + 'full': { + weekday: 'long', + month : 'long', + day : 'numeric', + year : 'numeric' + } + }, + + time: { + 'short': { + hour : 'numeric', + minute: 'numeric' + }, + + 'medium': { + hour : 'numeric', + minute: 'numeric', + second: 'numeric' + }, + + 'long': { + hour : 'numeric', + minute : 'numeric', + second : 'numeric', + timeZoneName: 'short' + }, + + 'full': { + hour : 'numeric', + minute : 'numeric', + second : 'numeric', + timeZoneName: 'short' + } + } + } + }); + + // Define internal private properties for dealing with locale data. + defineProperty(MessageFormat, '__availableLocales__', {value: []}); + defineProperty(MessageFormat, '__localeData__', {value: objCreate(null)}); + defineProperty(MessageFormat, '__addLocaleData', {value: function (data) { + if (!(data && data.locale)) { + throw new Error('Object passed does not identify itself with a valid language tag'); + } + + if (!data.messageformat) { + throw new Error('Object passed does not contain locale data for IntlMessageFormat'); + } + + var availableLocales = MessageFormat.__availableLocales__, + localeData = MessageFormat.__localeData__; + + // Message format locale data only requires the first part of the tag. + var locale = data.locale.toLowerCase().split('-')[0]; + + availableLocales.push(locale); + localeData[locale] = data.messageformat; + + if (MessageFormat.defaultLocale === undefined) { + MessageFormat.defaultLocale = locale; + } + }}); + + // Defines `__parse()` static method as an exposed private. + defineProperty(MessageFormat, '__parse', {value: parse}); + + // Define public `defaultLocale` property which is set when the first bundle + // of locale data is added. + defineProperty(MessageFormat, 'defaultLocale', { + enumerable: true, + writable : true + }); + + MessageFormat.prototype.format = function (values) { + return this._format(this._pattern, values); + }; + + MessageFormat.prototype.resolvedOptions = function () { + // TODO: Provide anything else? + return { + locale: this._locale + }; + }; + + MessageFormat.prototype._compilePattern = function (pattern, locales, formats) { + // Wrap string patterns with an array for iteration control flow. + if (typeof pattern === 'string') { + pattern = [pattern]; + } + + var locale = this._locale, + localeData = MessageFormat.__localeData__, + formatPattern = [], + i, len, part, type, valueName, format, pluralFunction, options, + key, optionsParts, option; + + for (i = 0, len = pattern.length; i < len; i += 1) { + part = pattern[i]; + + // Checks if string part is a simple string, or if it has a + // tokenized place-holder that needs to be substituted. + if (typeof part === 'string') { + formatPattern.push(createStringPart(part)); + continue; + } + + type = part.type; + valueName = part.valueName; + options = part.options; + + // Handles plural and select parts' options by building format + // patterns for each option. + if (options) { + optionsParts = {}; + + for (key in options) { + if (!hop.call(options, key)) { continue; } + + option = options[key]; + + // Early exit and special handling for plural options with a + // "${#}" token. These options will have this token replaced + // with NumberFormat wrap with optional prefix and suffix. + if (type === 'plural' && typeof option === 'string' && + option.indexOf('${#}') >= 0) { + + option = option.match(/(.*)\${#}(.*)/); + + optionsParts[key] = [ + option[1], // prefix + { + valueName: valueName, + format : new Intl.NumberFormat(locales).format + }, + option[2] // suffix + ]; + + continue; + } + + // Recursively compiles a format pattern for the option. + optionsParts[key] = this._compilePattern(option, + locales, formats); + } + } + + // Create a specialized format part for each type. This creates a + // common interface for the `format()` method and encapsulates the + // relevant data need for each type of formatting. + switch (type) { + case 'date': + format = formats.date[part.format]; + formatPattern.push({ + valueName: valueName, + format : new Intl.DateTimeFormat(locales, format).format + }); + break; + + case 'time': + format = formats.time[part.format]; + formatPattern.push({ + valueName: valueName, + format : new Intl.DateTimeFormat(locales, format).format + }); + break; + + case 'number': + format = formats.number[part.format]; + formatPattern.push({ + valueName: valueName, + format : new Intl.NumberFormat(locales, format).format + }); + break; + + case 'plural': + pluralFunction = localeData[locale].pluralFunction; + formatPattern.push(new PluralPart(valueName, optionsParts, + pluralFunction)); + break; + + case 'select': + formatPattern.push(new SelectPart(valueName, optionsParts)); + break; + + default: + throw new Error('Message pattern part at index ' + i + ' does not have a valid type'); + } + } + + return formatPattern; + }; + + MessageFormat.prototype._format = function (pattern, values) { + var result = '', + i, len, part, valueName, value, options; + + for (i = 0, len = pattern.length; i < len; i += 1) { + part = pattern[i]; + + // Exist early for string parts. + if (typeof part === 'string') { + result += part; + continue; + } + + valueName = part.valueName; + + // Enforce that all required values are provided by the caller. + if (!(values && hop.call(values, valueName))) { + throw new Error('A value must be provided for: ' + valueName); + } + + value = values[valueName]; + options = part.options; + + // Recursively format plural and select parts' option — which can be + // a nested pattern structure. The choosing of the option to use is + // abstracted-by and delegated-to the part helper object. + if (options) { + result += this._format(part.getOption(value), values); + } else { + result += part.format(value); + } + } + + return result; + }; + + MessageFormat.prototype._mergeFormats = function (defaults, formats) { + var mergedFormats = {}, + type, mergedType; + + for (type in defaults) { + if (!hop.call(defaults, type)) { continue; } + + mergedFormats[type] = mergedType = objCreate(defaults[type]); + + if (formats && hop.call(formats, type)) { + extend(mergedType, formats[type]); + } + } + + return mergedFormats; + }; + + MessageFormat.prototype._resolveLocale = function (locales) { + var availableLocales = MessageFormat.__availableLocales__, + locale, parts, i, len; + + if (availableLocales.length === 0) { + throw new Error('No locale data has been provided for IntlMessageFormat yet'); + } + + if (typeof locales === 'string') { + locales = [locales]; + } + + if (locales && locales.length) { + for (i = 0, len = locales.length; i < len; i += 1) { + locale = locales[i].toLowerCase().split('-')[0]; + + // Make sure the first part of the locale that we care about is + // structurally valid. + if (!/[a-z]{2,3}/i.test(locale)) { + throw new RangeError('"' + locales[i] + '" is not a structurally valid language tag'); + } + + if (availableLocales.indexOf(locale) >= 0) { + break; + } + } + } + + return locale || MessageFormat.defaultLocale; + }; + + // -- MessageFormat Helpers ------------------------------------------------ + + var RE_PARSED_TOKEN = /^\${([-\w]+)}$/; + + function createStringPart(str) { + var token = str.match(RE_PARSED_TOKEN); + return token ? new StringPart(token[1]) : str; + } + + function StringPart(valueName) { + this.valueName = valueName; + } + + StringPart.prototype.format = function (value) { + if (!value) { + return ''; + } + + return typeof value === 'string' ? value : String(value); + }; + + function SelectPart(valueName, options) { + this.valueName = valueName; + this.options = options; + } + + SelectPart.prototype.getOption = function (value) { + var options = this.options; + return options[value] || options.other; + }; + + function PluralPart(valueName, options, pluralFunction) { + this.valueName = valueName; + this.options = options; + this.pluralFunction = pluralFunction; + } + + PluralPart.prototype.getOption = function (value) { + var options = this.options, + option = this.pluralFunction(value); + + return options[option] || options.other; + }; + + // -- MessageFormat Parser ------------------------------------------------- + // Copied from: https://github.com/yahoo/locator-lang + + // `type` (required): The name of the message format type. + // `regex` (required): The regex used to check if this formatter can parse the message. + // `parse` (required): The main parse method which is given the full message. + // `tokenParser` (optional): Used to parse the remaining tokens of a message (what remains after the variable and the format type). + // `postParser` (optional): Used to format the output before returning from the main `parse` method. + // `outputFormatter` (optional): Used to format the fully parsed string returned from the base case of the recursive parser. + var FORMATTERS = [ + { + type: 'string', + regex: /^{\s*([-\w]+)\s*}$/, + parse: formatElementParser, + postParser: function (parsed) { + return '${' + parsed.valueName + '}'; + } + }, + { + type: 'select', + regex: /^{\s*([-\w]+)\s*,\s*select\s*,\s*(.*)\s*}$/, + parse: formatElementParser, + tokenParser: pairedOptionsParser + }, + { + type: 'plural', + regex: /^{\s*([-\w]+)\s*,\s*plural\s*,\s*(.*)\s*}$/, + parse: formatElementParser, + tokenParser: pairedOptionsParser, + outputFormatter: function (str) { + return str.replace(/#/g, '${#}'); + } + }, + { + type: 'time', + regex: /^{\s*([-\w]+)\s*,\s*time(?:,(.*))?\s*}$/, + parse: formatElementParser, + tokenParser: formatOptionParser, + postParser: function (parsed) { + parsed.format = parsed.format || 'medium'; + return parsed; + } + }, + { + type: 'date', + regex: /^{\s*([-\w]+)\s*,\s*date(?:,(.*))?\s*}$/, + parse: formatElementParser, + tokenParser: formatOptionParser, + postParser: function (parsed) { + parsed.format = parsed.format || 'medium'; + return parsed; + } + }, + { + type: 'number', + regex: /^{\s*([-\w]+)\s*,\s*number(?:,(.*))?\s*}$/, + parse: formatElementParser, + tokenParser: formatOptionParser + }, + { + type: 'custom', + regex: /^{\s*([-\w]+)\s*,\s*([a-zA-Z]*)(?:,(.*))?\s*}$/, + parse: formatElementParser, + tokenParser:formatOptionParser + } + ]; + + /** + Tokenizes a MessageFormat pattern. + @method tokenize + @param {String} pattern A pattern + @param {Boolean} trim Whether or not the tokens should be trimmed of whitespace + @return {Array} Tokens + **/ + function tokenize (pattern, trim) { + var bracketRE = /[{}]/g, + tokens = [], + balance = 0, + startIndex = 0, + endIndex, + substr, + match, + i, + len; + + + match = bracketRE.exec(pattern); + + while (match) { + // Keep track of balanced brackets + balance += match[0] === '{' ? 1 : -1; + + // Imbalanced brackets detected (e.g. "}hello{", "{hello}}") + if (balance < 0) { + throw new Error('Imbalanced bracket detected at index ' + + match.index + ' for message "' + pattern + '"'); + } + + // Tokenize a pair of balanced brackets + if (balance === 0) { + endIndex = match.index + 1; + + tokens.push( + pattern.slice(startIndex, endIndex) + ); + + startIndex = endIndex; + } + + // Tokenize any text that comes before the first opening bracket + if (balance === 1 && startIndex !== match.index) { + substr = pattern.slice(startIndex, match.index); + if (substr.indexOf('{') === -1) { + tokens.push(substr); + startIndex = match.index; + } + } + + match = bracketRE.exec(pattern); + } + + // Imbalanced brackets detected (e.g. "{{hello}") + if (balance !== 0) { + throw new Error('Brackets were not properly closed: ' + pattern); + } + + // Tokenize any remaining non-empty string + if (startIndex !== pattern.length) { + tokens.push( + pattern.slice(startIndex) + ); + } + + if (trim) { + for (i = 0, len = tokens.length; i < len; i++) { + tokens[i] = tokens[i].replace(/^\s+|\s+$/gm, ''); + } + } + + return tokens; + } + + /** + Gets the content of the format element by peeling off the outermost pair of + brackets. + @method getFormatElementContent + @param {String} formatElement Format element + @return {String} Contents of format element + **/ + function getFormatElementContent (formatElement) { + return formatElement.replace(/^\{\s*/,'').replace(/\s*\}$/, ''); + } + + /** + Checks if the pattern contains a format element. + @method containsFormatElement + @param {String} pattern Pattern + @return {Boolean} Whether or not the pattern contains a format element + **/ + function containsFormatElement (pattern) { + return pattern.indexOf('{') >= 0; + } + + /** + Parses a list of tokens into paired options where the key is the option name + and the value is the pattern. + @method pairedOptionsParser + @param {Object} parsed Parsed object + @param {Array} tokens Remaining tokens that come after the value name and the + format id + @return {Object} Parsed object with added options + **/ + function pairedOptionsParser (parsed, tokens) { + var hasDefault, + value, + name, + l, + i; + + parsed.options = {}; + + if (tokens.length % 2) { + throw new Error('Options must come in pairs: ' + tokens.join(', ')); + } + + for (i = 0, l = tokens.length; i < l; i += 2) { + name = tokens[i]; + value = tokens[i + 1]; + + parsed.options[name] = value; + + hasDefault = hasDefault || name === 'other'; + } + + if (!hasDefault) { + throw new Error('Options must include default "other" option: ' + tokens.join(', ')); + } + + return parsed; + } + + function formatOptionParser (parsed, tokens) { + parsed.format = tokens[0]; + return parsed; + } + + /** + Parses a format element. Format elements are surrounded by curly braces, and + contain at least a value name. + @method formatElementParser + @param {String} formatElement A format element + @param {Object} match The result of a String.match() that has at least the + value name at index 1 and a subformat at index 2 + @return {Object} Parsed object + **/ + function formatElementParser (formatElement, match, formatter) { + var parsed = { + type: formatter.type, + valueName: match[1] + }, + tokens = match[2] && tokenize(match[2], true); + + // If there are any additional tokens to parse, it should be done here + if (formatter.tokenParser && tokens) { + parsed = formatter.tokenParser(parsed, tokens); + } + + // Any final modifications to the parsed output should be done here + if (formatter.postParser) { + parsed = formatter.postParser(parsed); + } + + return parsed; + } + + /** + For each formatter, test it on the token in order. Exit early on first + token matched. + @method parseToken + @param {Array} tokens + @param {Number} index + @return {String|Object} Parsed token or original token + */ + function parseToken (tokens, index) { + var i, len; + + for (i = 0, len = FORMATTERS.length; i < len; i++) { + if (parseFormatTokens(FORMATTERS[i], tokens, index)) { + return tokens[index]; + } + } + + return tokens[index]; + } + + /** + Attempts to parse a token at the given index with the provided formatter. + If the token fails the `formatter.regex`, `false` is returned. Otherwise, + the token is parsed with `formatter.parse`. Then if the token contains + options due to the parsing process, it has each option processed. Then it + returns `true` alerting the caller the token was parsed. + + @method parseFormatTokens + @param {Object} formatter + @param {Array} tokens + @param {Number} tokenIndex + @return {Boolean} + */ + function parseFormatTokens (formatter, tokens, tokenIndex) { + var token = tokens[tokenIndex], + match = token.match(formatter.regex), + parsedToken, + parsedKeys = [], + key, + i, len; + + if (match) { + parsedToken = formatter.parse(token, match, formatter); + tokens[tokenIndex] = parsedToken; + + // if we have options, each option must be parsed + if (parsedToken && parsedToken.options && typeof parsedToken.options === 'object') { + for (key in parsedToken.options) { + if (parsedToken.options.hasOwnProperty(key)) { + parsedKeys.push(key); + } + } + } + + for (i = 0, len = parsedKeys.length; i < len; i++) { + parseFormatOptions(parsedToken, parsedKeys[i], formatter); + } + + return true; + } + + return !!match; + } + + /** + @method parseFormatOptions + @param {Object} + */ + function parseFormatOptions (parsedToken, key, formatter) { + var value = parsedToken.options && parsedToken.options[key]; + value = getFormatElementContent(value); + parsedToken.options[key] = parse(value, formatter.outputFormatter); + } + + /** + Parses a pattern that may contain nested format elements. + @method parse + @param {String} pattern A pattern + @return {Object|Array} Parsed output + **/ + function parse (pattern, outputFormatter) { + + var tokens, + i, len; + + // base case (plain string) + if (!containsFormatElement(pattern)) { + // Final chance to format the string before the parser spits it out + return outputFormatter ? outputFormatter(pattern) : [pattern]; + } + + tokens = tokenize(pattern); + + for (i = 0, len = tokens.length; i < len; i++) { + if (tokens[i].charAt(0) === '{') { // tokens must start with a { + tokens[i] = parseToken(tokens, i); + } + } + + return tokens; + } + + // -- Utilities ------------------------------------------------------------ + + function extend(obj) { + var sources = Array.prototype.slice.call(arguments, 1), + i, len, source, key; + + for (i = 0, len = sources.length; i < len; i += 1) { + source = sources[i]; + if (!source) { continue; } + + for (key in source) { + if (source.hasOwnProperty(key)) { + obj[key] = source[key]; + } + } + } + + return obj; + } + + return MessageFormat; + }); + (function(global) { + var IntlMessageFormat = global.IntlMessageFormat; + var funcs = [ + function (n) { }, + function (n) { n=Math.floor(n);if(n===1)return"one";return"other"; }, + function (n) { n=Math.floor(n);if(n>=0&&n<=1)return"one";return"other"; }, + function (n) { var i=Math.floor(Math.abs(n));n=Math.floor(n);if(i===0||n===1)return"one";return"other"; }, + function (n) { n=Math.floor(n);if(n===0)return"zero";if(n===1)return"one";if(n===2)return"two";if(n%100>=3&&n%100<=10)return"few";if(n%100>=11&&n%100<=99)return"many";return"other"; }, + function (n) { n=Math.floor(n);if(n%10===1&&(n%100!==11))return"one";if(n%10>=2&&n%10<=4&&!(n%100>=12&&n%100<=14))return"few";if(n%10===0||n%10>=5&&n%10<=9||n%100>=11&&n%100<=14)return"many";return"other"; }, + function (n) { return"other"; }, + function (n) { n=Math.floor(n);if(n%10===1&&!(n%100===11||n%100===71||n%100===91))return"one";if(n%10===2&&!(n%100===12||n%100===72||n%100===92))return"two";if((n%10>=3&&n%10<=4||n%10===9)&&!(n%100>=10&&n%100<=19||n%100>=70&&n%100<=79||n%100>=90&&n%100<=99))return"few";if((n!==0)&&n%1e6===0)return"many";return"other"; }, + function (n) { var i=Math.floor(Math.abs(n)),v=n.toString().replace(/^[^.]*\.?/,"").length,f=parseInt(n.toString().replace(/^[^.]*\.?/,""),10);n=Math.floor(n);if(v===0&&i%10===1&&((i%100!==11)||f%10===1&&(f%100!==11)))return"one";if(v===0&&i%10>=2&&i%10<=4&&(!(i%100>=12&&i%100<=14)||f%10>=2&&f%10<=4&&!(f%100>=12&&f%100<=14)))return"few";return"other"; }, + function (n) { var i=Math.floor(Math.abs(n)),v=n.toString().replace(/^[^.]*\.?/,"").length;n=Math.floor(n);if(i===1&&v===0)return"one";return"other"; }, + function (n) { var i=Math.floor(Math.abs(n)),v=n.toString().replace(/^[^.]*\.?/,"").length;n=Math.floor(n);if(i===1&&v===0)return"one";if(i>=2&&i<=4&&v===0)return"few";if((v!==0))return"many";return"other"; }, + function (n) { n=Math.floor(n);if(n===0)return"zero";if(n===1)return"one";if(n===2)return"two";if(n===3)return"few";if(n===6)return"many";return"other"; }, + function (n) { var i=Math.floor(Math.abs(n)),t=parseInt(n.toString().replace(/^[^.]*\.?|0+$/g,""),10);n=Math.floor(n);if(n===1||(t!==0)&&(i===0||i===1))return"one";return"other"; }, + function (n) { var i=Math.floor(Math.abs(n));n=Math.floor(n);if(i===0||i===1)return"one";return"other"; }, + function (n) { var i=Math.floor(Math.abs(n)),v=n.toString().replace(/^[^.]*\.?/,"").length;n=Math.floor(n);if(i>=0&&i<=1&&v===0)return"one";return"other"; }, + function (n) { n=Math.floor(n);if(n===1)return"one";if(n===2)return"two";if(n>=3&&n<=6)return"few";if(n>=7&&n<=10)return"many";return"other"; }, + function (n) { n=Math.floor(n);if(n===1||n===11)return"one";if(n===2||n===12)return"two";if(n>=3&&n<=10||n>=13&&n<=19)return"few";return"other"; }, + function (n) { n=Math.floor(n);if(n%10===1)return"one";if(n%10===2)return"two";if(n%100===0||n%100===20||n%100===40||n%100===60)return"few";return"other"; }, + function (n) { var i=Math.floor(Math.abs(n)),v=n.toString().replace(/^[^.]*\.?/,"").length;n=Math.floor(n);if(i===1&&v===0)return"one";if(i===2&&v===0)return"two";if(v===0&&!(n>=0&&n<=10)&&n%10===0)return"many";return"other"; }, + function (n) { var i=Math.floor(Math.abs(n)),t=parseInt(n.toString().replace(/^[^.]*\.?|0+$/g,""),10);n=Math.floor(n);if(t===0&&i%10===1&&((i%100!==11)||(t!==0)))return"one";return"other"; }, + function (n) { n=Math.floor(n);if(n===0)return"zero";if(n===1)return"one";return"other"; }, + function (n) { n=Math.floor(n);if(n===1)return"one";if(n===2)return"two";return"other"; }, + function (n) { var i=Math.floor(Math.abs(n));n=Math.floor(n);if(n===0)return"zero";if((i===0||i===1)&&(n!==0))return"one";return"other"; }, + function (n) { var f=parseInt(n.toString().replace(/^[^.]*\.?/,""),10);n=Math.floor(n);if(n%10===1&&!(n%100>=11&&n%100<=19))return"one";if(n%10>=2&&n%10<=9&&!(n%100>=11&&n%100<=19))return"few";if((f!==0))return"many";return"other"; }, + function (n) { var v=n.toString().replace(/^[^.]*\.?/,"").length,f=parseInt(n.toString().replace(/^[^.]*\.?/,""),10);n=Math.floor(n);if(n%10===0||n%100>=11&&n%100<=19||v===2&&f%100>=11&&f%100<=19)return"zero";if(n%10===1&&((n%100!==11)||v===2&&f%10===1&&((f%100!==11)||(v!==2)&&f%10===1)))return"one";return"other"; }, + function (n) { var i=Math.floor(Math.abs(n)),v=n.toString().replace(/^[^.]*\.?/,"").length,f=parseInt(n.toString().replace(/^[^.]*\.?/,""),10);n=Math.floor(n);if(v===0&&(i%10===1||f%10===1))return"one";return"other"; }, + function (n) { n=Math.floor(n);if(n===1)return"one";if(n===0||n%100>=2&&n%100<=10)return"few";if(n%100>=11&&n%100<=19)return"many";return"other"; }, + function (n) { var i=Math.floor(Math.abs(n)),v=n.toString().replace(/^[^.]*\.?/,"").length;n=Math.floor(n);if(i===1&&v===0)return"one";if(v===0&&i%10>=2&&i%10<=4&&!(i%100>=12&&i%100<=14))return"few";if(v===0&&(i!==1)&&(i%10>=0&&i%10<=1||v===0&&(i%10>=5&&i%10<=9||v===0&&i%100>=12&&i%100<=14)))return"many";return"other"; }, + function (n) { var i=Math.floor(Math.abs(n)),v=n.toString().replace(/^[^.]*\.?/,"").length,t=parseInt(n.toString().replace(/^[^.]*\.?|0+$/g,""),10);n=Math.floor(n);if(i===1&&(v===0||i===0&&t===1))return"one";return"other"; }, + function (n) { var i=Math.floor(Math.abs(n)),v=n.toString().replace(/^[^.]*\.?/,"").length;n=Math.floor(n);if(i===1&&v===0)return"one";if((v!==0)||n===0||(n!==1)&&n%100>=1&&n%100<=19)return"few";return"other"; }, + function (n) { var i=Math.floor(Math.abs(n)),v=n.toString().replace(/^[^.]*\.?/,"").length;n=Math.floor(n);if(v===0&&i%10===1&&(i%100!==11))return"one";if(v===0&&(i%10===0||v===0&&(i%10>=5&&i%10<=9||v===0&&i%100>=11&&i%100<=14)))return"many";return"other"; }, + function (n) { var i=Math.floor(Math.abs(n));n=Math.floor(n);if(i===0||n===1)return"one";if(n>=2&&n<=10)return"few";return"other"; }, + function (n) { var i=Math.floor(Math.abs(n)),f=parseInt(n.toString().replace(/^[^.]*\.?/,""),10);n=Math.floor(n);if(n===0||n===1||i===0&&f===1)return"one";return"other"; }, + function (n) { var i=Math.floor(Math.abs(n)),v=n.toString().replace(/^[^.]*\.?/,"").length;n=Math.floor(n);if(v===0&&i%100===1)return"one";if(v===0&&i%100===2)return"two";if(v===0&&(i%100>=3&&i%100<=4||(v!==0)))return"few";return"other"; }, + function (n) { n=Math.floor(n);if(n>=0&&n<=1||n>=11&&n<=99)return"one";return"other"; }, + function (n) { var i=Math.floor(Math.abs(n)),v=n.toString().replace(/^[^.]*\.?/,"").length;n=Math.floor(n);if(v===0&&i%10===1&&(i%100!==11))return"one";if(v===0&&i%10>=2&&i%10<=4&&!(i%100>=12&&i%100<=14))return"few";if(v===0&&(i%10===0||v===0&&(i%10>=5&&i%10<=9||v===0&&i%100>=11&&i%100<=14)))return"many";return"other"; } + ]; + IntlMessageFormat.__addLocaleData({locale:"aa", messageformat:{pluralFunction:funcs[0]}}); + IntlMessageFormat.__addLocaleData({locale:"af", messageformat:{pluralFunction:funcs[1]}}); + IntlMessageFormat.__addLocaleData({locale:"agq", messageformat:{pluralFunction:funcs[0]}}); + IntlMessageFormat.__addLocaleData({locale:"ak", messageformat:{pluralFunction:funcs[2]}}); + IntlMessageFormat.__addLocaleData({locale:"am", messageformat:{pluralFunction:funcs[3]}}); + IntlMessageFormat.__addLocaleData({locale:"ar", messageformat:{pluralFunction:funcs[4]}}); + IntlMessageFormat.__addLocaleData({locale:"as", messageformat:{pluralFunction:funcs[0]}}); + IntlMessageFormat.__addLocaleData({locale:"asa", messageformat:{pluralFunction:funcs[1]}}); + IntlMessageFormat.__addLocaleData({locale:"ast", messageformat:{pluralFunction:funcs[1]}}); + IntlMessageFormat.__addLocaleData({locale:"az", messageformat:{pluralFunction:funcs[1]}}); + IntlMessageFormat.__addLocaleData({locale:"bas", messageformat:{pluralFunction:funcs[0]}}); + IntlMessageFormat.__addLocaleData({locale:"be", messageformat:{pluralFunction:funcs[5]}}); + IntlMessageFormat.__addLocaleData({locale:"bem", messageformat:{pluralFunction:funcs[1]}}); + IntlMessageFormat.__addLocaleData({locale:"bez", messageformat:{pluralFunction:funcs[1]}}); + IntlMessageFormat.__addLocaleData({locale:"bg", messageformat:{pluralFunction:funcs[1]}}); + IntlMessageFormat.__addLocaleData({locale:"bm", messageformat:{pluralFunction:funcs[6]}}); + IntlMessageFormat.__addLocaleData({locale:"bn", messageformat:{pluralFunction:funcs[3]}}); + IntlMessageFormat.__addLocaleData({locale:"bo", messageformat:{pluralFunction:funcs[6]}}); + IntlMessageFormat.__addLocaleData({locale:"br", messageformat:{pluralFunction:funcs[7]}}); + IntlMessageFormat.__addLocaleData({locale:"brx", messageformat:{pluralFunction:funcs[1]}}); + IntlMessageFormat.__addLocaleData({locale:"bs", messageformat:{pluralFunction:funcs[8]}}); + IntlMessageFormat.__addLocaleData({locale:"byn", messageformat:{pluralFunction:funcs[0]}}); + IntlMessageFormat.__addLocaleData({locale:"ca", messageformat:{pluralFunction:funcs[9]}}); + IntlMessageFormat.__addLocaleData({locale:"cgg", messageformat:{pluralFunction:funcs[1]}}); + IntlMessageFormat.__addLocaleData({locale:"chr", messageformat:{pluralFunction:funcs[1]}}); + IntlMessageFormat.__addLocaleData({locale:"cs", messageformat:{pluralFunction:funcs[10]}}); + IntlMessageFormat.__addLocaleData({locale:"cy", messageformat:{pluralFunction:funcs[11]}}); + IntlMessageFormat.__addLocaleData({locale:"da", messageformat:{pluralFunction:funcs[12]}}); + IntlMessageFormat.__addLocaleData({locale:"dav", messageformat:{pluralFunction:funcs[0]}}); + IntlMessageFormat.__addLocaleData({locale:"de", messageformat:{pluralFunction:funcs[9]}}); + IntlMessageFormat.__addLocaleData({locale:"dje", messageformat:{pluralFunction:funcs[0]}}); + IntlMessageFormat.__addLocaleData({locale:"dua", messageformat:{pluralFunction:funcs[0]}}); + IntlMessageFormat.__addLocaleData({locale:"dyo", messageformat:{pluralFunction:funcs[0]}}); + IntlMessageFormat.__addLocaleData({locale:"dz", messageformat:{pluralFunction:funcs[6]}}); + IntlMessageFormat.__addLocaleData({locale:"ebu", messageformat:{pluralFunction:funcs[0]}}); + IntlMessageFormat.__addLocaleData({locale:"ee", messageformat:{pluralFunction:funcs[1]}}); + IntlMessageFormat.__addLocaleData({locale:"el", messageformat:{pluralFunction:funcs[1]}}); + IntlMessageFormat.__addLocaleData({locale:"en", messageformat:{pluralFunction:funcs[9]}}); + IntlMessageFormat.__addLocaleData({locale:"eo", messageformat:{pluralFunction:funcs[1]}}); + IntlMessageFormat.__addLocaleData({locale:"es", messageformat:{pluralFunction:funcs[1]}}); + IntlMessageFormat.__addLocaleData({locale:"et", messageformat:{pluralFunction:funcs[9]}}); + IntlMessageFormat.__addLocaleData({locale:"eu", messageformat:{pluralFunction:funcs[1]}}); + IntlMessageFormat.__addLocaleData({locale:"ewo", messageformat:{pluralFunction:funcs[0]}}); + IntlMessageFormat.__addLocaleData({locale:"fa", messageformat:{pluralFunction:funcs[3]}}); + IntlMessageFormat.__addLocaleData({locale:"ff", messageformat:{pluralFunction:funcs[13]}}); + IntlMessageFormat.__addLocaleData({locale:"fi", messageformat:{pluralFunction:funcs[14]}}); + IntlMessageFormat.__addLocaleData({locale:"fil", messageformat:{pluralFunction:funcs[14]}}); + IntlMessageFormat.__addLocaleData({locale:"fo", messageformat:{pluralFunction:funcs[1]}}); + IntlMessageFormat.__addLocaleData({locale:"fr", messageformat:{pluralFunction:funcs[13]}}); + IntlMessageFormat.__addLocaleData({locale:"fur", messageformat:{pluralFunction:funcs[1]}}); + IntlMessageFormat.__addLocaleData({locale:"ga", messageformat:{pluralFunction:funcs[15]}}); + IntlMessageFormat.__addLocaleData({locale:"gd", messageformat:{pluralFunction:funcs[16]}}); + IntlMessageFormat.__addLocaleData({locale:"gl", messageformat:{pluralFunction:funcs[9]}}); + IntlMessageFormat.__addLocaleData({locale:"gsw", messageformat:{pluralFunction:funcs[1]}}); + IntlMessageFormat.__addLocaleData({locale:"gu", messageformat:{pluralFunction:funcs[3]}}); + IntlMessageFormat.__addLocaleData({locale:"guz", messageformat:{pluralFunction:funcs[0]}}); + IntlMessageFormat.__addLocaleData({locale:"gv", messageformat:{pluralFunction:funcs[17]}}); + IntlMessageFormat.__addLocaleData({locale:"ha", messageformat:{pluralFunction:funcs[1]}}); + IntlMessageFormat.__addLocaleData({locale:"haw", messageformat:{pluralFunction:funcs[1]}}); + IntlMessageFormat.__addLocaleData({locale:"he", messageformat:{pluralFunction:funcs[18]}}); + IntlMessageFormat.__addLocaleData({locale:"hi", messageformat:{pluralFunction:funcs[3]}}); + IntlMessageFormat.__addLocaleData({locale:"hr", messageformat:{pluralFunction:funcs[8]}}); + IntlMessageFormat.__addLocaleData({locale:"hu", messageformat:{pluralFunction:funcs[1]}}); + IntlMessageFormat.__addLocaleData({locale:"hy", messageformat:{pluralFunction:funcs[13]}}); + IntlMessageFormat.__addLocaleData({locale:"ia", messageformat:{pluralFunction:funcs[0]}}); + IntlMessageFormat.__addLocaleData({locale:"id", messageformat:{pluralFunction:funcs[6]}}); + IntlMessageFormat.__addLocaleData({locale:"ig", messageformat:{pluralFunction:funcs[6]}}); + IntlMessageFormat.__addLocaleData({locale:"ii", messageformat:{pluralFunction:funcs[6]}}); + IntlMessageFormat.__addLocaleData({locale:"is", messageformat:{pluralFunction:funcs[19]}}); + IntlMessageFormat.__addLocaleData({locale:"it", messageformat:{pluralFunction:funcs[9]}}); + IntlMessageFormat.__addLocaleData({locale:"ja", messageformat:{pluralFunction:funcs[6]}}); + IntlMessageFormat.__addLocaleData({locale:"jgo", messageformat:{pluralFunction:funcs[1]}}); + IntlMessageFormat.__addLocaleData({locale:"jmc", messageformat:{pluralFunction:funcs[1]}}); + IntlMessageFormat.__addLocaleData({locale:"ka", messageformat:{pluralFunction:funcs[1]}}); + IntlMessageFormat.__addLocaleData({locale:"kab", messageformat:{pluralFunction:funcs[13]}}); + IntlMessageFormat.__addLocaleData({locale:"kam", messageformat:{pluralFunction:funcs[0]}}); + IntlMessageFormat.__addLocaleData({locale:"kde", messageformat:{pluralFunction:funcs[6]}}); + IntlMessageFormat.__addLocaleData({locale:"kea", messageformat:{pluralFunction:funcs[6]}}); + IntlMessageFormat.__addLocaleData({locale:"khq", messageformat:{pluralFunction:funcs[0]}}); + IntlMessageFormat.__addLocaleData({locale:"ki", messageformat:{pluralFunction:funcs[0]}}); + IntlMessageFormat.__addLocaleData({locale:"kk", messageformat:{pluralFunction:funcs[1]}}); + IntlMessageFormat.__addLocaleData({locale:"kkj", messageformat:{pluralFunction:funcs[1]}}); + IntlMessageFormat.__addLocaleData({locale:"kl", messageformat:{pluralFunction:funcs[1]}}); + IntlMessageFormat.__addLocaleData({locale:"kln", messageformat:{pluralFunction:funcs[0]}}); + IntlMessageFormat.__addLocaleData({locale:"km", messageformat:{pluralFunction:funcs[6]}}); + IntlMessageFormat.__addLocaleData({locale:"kn", messageformat:{pluralFunction:funcs[3]}}); + IntlMessageFormat.__addLocaleData({locale:"ko", messageformat:{pluralFunction:funcs[6]}}); + IntlMessageFormat.__addLocaleData({locale:"kok", messageformat:{pluralFunction:funcs[0]}}); + IntlMessageFormat.__addLocaleData({locale:"ks", messageformat:{pluralFunction:funcs[1]}}); + IntlMessageFormat.__addLocaleData({locale:"ksb", messageformat:{pluralFunction:funcs[1]}}); + IntlMessageFormat.__addLocaleData({locale:"ksf", messageformat:{pluralFunction:funcs[0]}}); + IntlMessageFormat.__addLocaleData({locale:"ksh", messageformat:{pluralFunction:funcs[20]}}); + IntlMessageFormat.__addLocaleData({locale:"kw", messageformat:{pluralFunction:funcs[21]}}); + IntlMessageFormat.__addLocaleData({locale:"ky", messageformat:{pluralFunction:funcs[1]}}); + IntlMessageFormat.__addLocaleData({locale:"lag", messageformat:{pluralFunction:funcs[22]}}); + IntlMessageFormat.__addLocaleData({locale:"lg", messageformat:{pluralFunction:funcs[1]}}); + IntlMessageFormat.__addLocaleData({locale:"lkt", messageformat:{pluralFunction:funcs[6]}}); + IntlMessageFormat.__addLocaleData({locale:"ln", messageformat:{pluralFunction:funcs[2]}}); + IntlMessageFormat.__addLocaleData({locale:"lo", messageformat:{pluralFunction:funcs[6]}}); + IntlMessageFormat.__addLocaleData({locale:"lt", messageformat:{pluralFunction:funcs[23]}}); + IntlMessageFormat.__addLocaleData({locale:"lu", messageformat:{pluralFunction:funcs[0]}}); + IntlMessageFormat.__addLocaleData({locale:"luo", messageformat:{pluralFunction:funcs[0]}}); + IntlMessageFormat.__addLocaleData({locale:"luy", messageformat:{pluralFunction:funcs[0]}}); + IntlMessageFormat.__addLocaleData({locale:"lv", messageformat:{pluralFunction:funcs[24]}}); + IntlMessageFormat.__addLocaleData({locale:"mas", messageformat:{pluralFunction:funcs[1]}}); + IntlMessageFormat.__addLocaleData({locale:"mer", messageformat:{pluralFunction:funcs[0]}}); + IntlMessageFormat.__addLocaleData({locale:"mfe", messageformat:{pluralFunction:funcs[0]}}); + IntlMessageFormat.__addLocaleData({locale:"mg", messageformat:{pluralFunction:funcs[2]}}); + IntlMessageFormat.__addLocaleData({locale:"mgh", messageformat:{pluralFunction:funcs[0]}}); + IntlMessageFormat.__addLocaleData({locale:"mgo", messageformat:{pluralFunction:funcs[1]}}); + IntlMessageFormat.__addLocaleData({locale:"mk", messageformat:{pluralFunction:funcs[25]}}); + IntlMessageFormat.__addLocaleData({locale:"ml", messageformat:{pluralFunction:funcs[1]}}); + IntlMessageFormat.__addLocaleData({locale:"mn", messageformat:{pluralFunction:funcs[1]}}); + IntlMessageFormat.__addLocaleData({locale:"mr", messageformat:{pluralFunction:funcs[3]}}); + IntlMessageFormat.__addLocaleData({locale:"ms", messageformat:{pluralFunction:funcs[6]}}); + IntlMessageFormat.__addLocaleData({locale:"mt", messageformat:{pluralFunction:funcs[26]}}); + IntlMessageFormat.__addLocaleData({locale:"mua", messageformat:{pluralFunction:funcs[0]}}); + IntlMessageFormat.__addLocaleData({locale:"my", messageformat:{pluralFunction:funcs[6]}}); + IntlMessageFormat.__addLocaleData({locale:"naq", messageformat:{pluralFunction:funcs[21]}}); + IntlMessageFormat.__addLocaleData({locale:"nb", messageformat:{pluralFunction:funcs[1]}}); + IntlMessageFormat.__addLocaleData({locale:"nd", messageformat:{pluralFunction:funcs[1]}}); + IntlMessageFormat.__addLocaleData({locale:"ne", messageformat:{pluralFunction:funcs[1]}}); + IntlMessageFormat.__addLocaleData({locale:"nl", messageformat:{pluralFunction:funcs[9]}}); + IntlMessageFormat.__addLocaleData({locale:"nmg", messageformat:{pluralFunction:funcs[0]}}); + IntlMessageFormat.__addLocaleData({locale:"nn", messageformat:{pluralFunction:funcs[1]}}); + IntlMessageFormat.__addLocaleData({locale:"nnh", messageformat:{pluralFunction:funcs[1]}}); + IntlMessageFormat.__addLocaleData({locale:"nr", messageformat:{pluralFunction:funcs[1]}}); + IntlMessageFormat.__addLocaleData({locale:"nso", messageformat:{pluralFunction:funcs[2]}}); + IntlMessageFormat.__addLocaleData({locale:"nus", messageformat:{pluralFunction:funcs[0]}}); + IntlMessageFormat.__addLocaleData({locale:"nyn", messageformat:{pluralFunction:funcs[1]}}); + IntlMessageFormat.__addLocaleData({locale:"om", messageformat:{pluralFunction:funcs[1]}}); + IntlMessageFormat.__addLocaleData({locale:"or", messageformat:{pluralFunction:funcs[1]}}); + IntlMessageFormat.__addLocaleData({locale:"os", messageformat:{pluralFunction:funcs[1]}}); + IntlMessageFormat.__addLocaleData({locale:"pa", messageformat:{pluralFunction:funcs[2]}}); + IntlMessageFormat.__addLocaleData({locale:"pl", messageformat:{pluralFunction:funcs[27]}}); + IntlMessageFormat.__addLocaleData({locale:"ps", messageformat:{pluralFunction:funcs[1]}}); + IntlMessageFormat.__addLocaleData({locale:"pt", messageformat:{pluralFunction:funcs[28]}}); + IntlMessageFormat.__addLocaleData({locale:"rm", messageformat:{pluralFunction:funcs[1]}}); + IntlMessageFormat.__addLocaleData({locale:"rn", messageformat:{pluralFunction:funcs[0]}}); + IntlMessageFormat.__addLocaleData({locale:"ro", messageformat:{pluralFunction:funcs[29]}}); + IntlMessageFormat.__addLocaleData({locale:"rof", messageformat:{pluralFunction:funcs[1]}}); + IntlMessageFormat.__addLocaleData({locale:"ru", messageformat:{pluralFunction:funcs[30]}}); + IntlMessageFormat.__addLocaleData({locale:"rw", messageformat:{pluralFunction:funcs[0]}}); + IntlMessageFormat.__addLocaleData({locale:"rwk", messageformat:{pluralFunction:funcs[1]}}); + IntlMessageFormat.__addLocaleData({locale:"sah", messageformat:{pluralFunction:funcs[6]}}); + IntlMessageFormat.__addLocaleData({locale:"saq", messageformat:{pluralFunction:funcs[1]}}); + IntlMessageFormat.__addLocaleData({locale:"sbp", messageformat:{pluralFunction:funcs[0]}}); + IntlMessageFormat.__addLocaleData({locale:"se", messageformat:{pluralFunction:funcs[21]}}); + IntlMessageFormat.__addLocaleData({locale:"seh", messageformat:{pluralFunction:funcs[1]}}); + IntlMessageFormat.__addLocaleData({locale:"ses", messageformat:{pluralFunction:funcs[6]}}); + IntlMessageFormat.__addLocaleData({locale:"sg", messageformat:{pluralFunction:funcs[6]}}); + IntlMessageFormat.__addLocaleData({locale:"shi", messageformat:{pluralFunction:funcs[31]}}); + IntlMessageFormat.__addLocaleData({locale:"si", messageformat:{pluralFunction:funcs[32]}}); + IntlMessageFormat.__addLocaleData({locale:"sk", messageformat:{pluralFunction:funcs[10]}}); + IntlMessageFormat.__addLocaleData({locale:"sl", messageformat:{pluralFunction:funcs[33]}}); + IntlMessageFormat.__addLocaleData({locale:"sn", messageformat:{pluralFunction:funcs[1]}}); + IntlMessageFormat.__addLocaleData({locale:"so", messageformat:{pluralFunction:funcs[1]}}); + IntlMessageFormat.__addLocaleData({locale:"sq", messageformat:{pluralFunction:funcs[1]}}); + IntlMessageFormat.__addLocaleData({locale:"sr", messageformat:{pluralFunction:funcs[8]}}); + IntlMessageFormat.__addLocaleData({locale:"ss", messageformat:{pluralFunction:funcs[1]}}); + IntlMessageFormat.__addLocaleData({locale:"ssy", messageformat:{pluralFunction:funcs[1]}}); + IntlMessageFormat.__addLocaleData({locale:"st", messageformat:{pluralFunction:funcs[1]}}); + IntlMessageFormat.__addLocaleData({locale:"sv", messageformat:{pluralFunction:funcs[9]}}); + IntlMessageFormat.__addLocaleData({locale:"sw", messageformat:{pluralFunction:funcs[9]}}); + IntlMessageFormat.__addLocaleData({locale:"swc", messageformat:{pluralFunction:funcs[0]}}); + IntlMessageFormat.__addLocaleData({locale:"ta", messageformat:{pluralFunction:funcs[1]}}); + IntlMessageFormat.__addLocaleData({locale:"te", messageformat:{pluralFunction:funcs[1]}}); + IntlMessageFormat.__addLocaleData({locale:"teo", messageformat:{pluralFunction:funcs[1]}}); + IntlMessageFormat.__addLocaleData({locale:"tg", messageformat:{pluralFunction:funcs[0]}}); + IntlMessageFormat.__addLocaleData({locale:"th", messageformat:{pluralFunction:funcs[6]}}); + IntlMessageFormat.__addLocaleData({locale:"ti", messageformat:{pluralFunction:funcs[2]}}); + IntlMessageFormat.__addLocaleData({locale:"tig", messageformat:{pluralFunction:funcs[1]}}); + IntlMessageFormat.__addLocaleData({locale:"tn", messageformat:{pluralFunction:funcs[1]}}); + IntlMessageFormat.__addLocaleData({locale:"to", messageformat:{pluralFunction:funcs[6]}}); + IntlMessageFormat.__addLocaleData({locale:"tr", messageformat:{pluralFunction:funcs[1]}}); + IntlMessageFormat.__addLocaleData({locale:"ts", messageformat:{pluralFunction:funcs[1]}}); + IntlMessageFormat.__addLocaleData({locale:"twq", messageformat:{pluralFunction:funcs[0]}}); + IntlMessageFormat.__addLocaleData({locale:"tzm", messageformat:{pluralFunction:funcs[34]}}); + IntlMessageFormat.__addLocaleData({locale:"uk", messageformat:{pluralFunction:funcs[35]}}); + IntlMessageFormat.__addLocaleData({locale:"ur", messageformat:{pluralFunction:funcs[9]}}); + IntlMessageFormat.__addLocaleData({locale:"uz", messageformat:{pluralFunction:funcs[1]}}); + IntlMessageFormat.__addLocaleData({locale:"vai", messageformat:{pluralFunction:funcs[0]}}); + IntlMessageFormat.__addLocaleData({locale:"ve", messageformat:{pluralFunction:funcs[1]}}); + IntlMessageFormat.__addLocaleData({locale:"vi", messageformat:{pluralFunction:funcs[6]}}); + IntlMessageFormat.__addLocaleData({locale:"vo", messageformat:{pluralFunction:funcs[1]}}); + IntlMessageFormat.__addLocaleData({locale:"vun", messageformat:{pluralFunction:funcs[1]}}); + IntlMessageFormat.__addLocaleData({locale:"wae", messageformat:{pluralFunction:funcs[1]}}); + IntlMessageFormat.__addLocaleData({locale:"wal", messageformat:{pluralFunction:funcs[0]}}); + IntlMessageFormat.__addLocaleData({locale:"xh", messageformat:{pluralFunction:funcs[1]}}); + IntlMessageFormat.__addLocaleData({locale:"xog", messageformat:{pluralFunction:funcs[1]}}); + IntlMessageFormat.__addLocaleData({locale:"yav", messageformat:{pluralFunction:funcs[0]}}); + IntlMessageFormat.__addLocaleData({locale:"yo", messageformat:{pluralFunction:funcs[6]}}); + IntlMessageFormat.__addLocaleData({locale:"zgh", messageformat:{pluralFunction:funcs[0]}}); + IntlMessageFormat.__addLocaleData({locale:"zh", messageformat:{pluralFunction:funcs[6]}}); + IntlMessageFormat.__addLocaleData({locale:"zu", messageformat:{pluralFunction:funcs[3]}}); + })(typeof global !== "undefined" ? global : this); + + /* jslint -W040, node: true */ + + 'use strict'; + + // IntlMessageFormat and Intl are dependencies of this package. The built-in + // `Intl` is preferred, but when not available it looks for the polyfill. + var Intl = global.Intl || global.IntlPolyfill, + IntlMessageFormat = global.IntlMessageFormat, + // Cache to hold NumberFormat and DateTimeFormat instances for reuse. + formatsCache = { + number: {}, + date : {} + }, + isArray = Array.isArray, + isObject = function (o) { + return (typeof o === 'object' && !isArray(o)); + }, + isFunction = function (fn) { + return (typeof fn === 'function'); + }; + + if (!Intl) { + throw new ReferenceError('Intl must be available.'); + } + + if (!IntlMessageFormat) { + throw new ReferenceError('IntlMessageFormat must be available.'); + } + + function intlDate(date, formatOptions) { + var locales = this.props.locales || this.context.locales, + formats = this.props.formats || this.context.formats; + + date = new Date(date); + + // Determine if the `date` is valid. + if (!(date && date.getTime())) { + throw new TypeError('A date must be provided.'); + } + + if (formatOptions) { + if (typeof formatOptions === 'string') { + try { + formatOptions = formats.date[formatOptions]; + } catch (e) { + throw new ReferenceError('Invalid date formatter: `' + formatOptions + '`.'); + } + } + + formatOptions = extend({}, formatOptions); + } + + return getFormat('date', locales, formatOptions).format(date); + } + + function intlNumber(num, formatOptions) { + var locales = this.props.locales || this.context.locales, + formats = this.props.formats || this.context.formats; + + if (typeof num !== 'number') { + throw new TypeError('A number must be provided.'); + } + + if (formatOptions) { + if (typeof formatOptions === 'string') { + try { + formatOptions = formats.number[formatOptions]; + } catch (e) { + throw new ReferenceError('Invalid number formatter: `' + formatOptions + '`.'); + } + } + + formatOptions = extend({}, formatOptions); + } + + return getFormat('number', locales, formatOptions).format(num); + } + + function intlMessage(message, values) { + var locales = this.props.locales || this.context.locales, + formats = this.props.formats || this.context.formats; + + // When `message` is a function, assume it's an IntlMessageFormat + // instance's `format()` method passed by reference, and call it. + // This is possible because its `this` will be pre-bound to the + // instance. + if (isFunction(message)) { + return message(values); + } + + // Assume that an object with a `format()` method is already an + // IntlMessageFormat instance, and use it; otherwise create a new + // one. + if (!isFunction(message.format)) { + message = new IntlMessageFormat(message, locales, formats); + } + + return message.format(values); + } + + // -- Utilities ------------------------------------------------------------ + + function getFormat(type, locales, options) { + var orderedOptions, option, key, i, len, id, format; + + // When JSON is available in the environment, use it build a cache-id + // to reuse formats for increased performance. + if (global.JSON) { + // Order the keys in `options` to create a serialized semantic + // representation which is reproducible. + if (options) { + orderedOptions = []; + + for (key in options) { + if (options.hasOwnProperty(key)) { + orderedOptions.push(key); + } + } + + orderedOptions.sort(); + + for (i = 0, len = orderedOptions.length; i < len; i += 1) { + key = orderedOptions[i]; + option = {}; + + option[key] = options[key]; + orderedOptions[i] = option; + } + } + + id = global.JSON.stringify([locales, orderedOptions]); + } + + // Check for a cached format instance, and use it. + format = formatsCache[type][id]; + if (format) { return format; } + + switch (type) { + case 'number': + format = new Intl.NumberFormat(locales, options); + break; + case 'date': + format = new Intl.DateTimeFormat(locales, options); + break; + } + + // Cache format for reuse. + if (id) { + formatsCache[type][id] = format; + } + + return format; + } + + function extend(obj) { + var sources = Array.prototype.slice.call(arguments, 1), + i, len, source, key; + + for (i = 0, len = sources.length; i < len; i += 1) { + source = sources[i]; + if (!source) { continue; } + + for (key in source) { + if (source.hasOwnProperty(key)) { + obj[key] = source[key]; + } + } + } + + return obj; + } + + // -- exports--------------------------------------------------------------- + + global.ReactIntlMixin = { + contextTypes: { + locales: function(context) { + if (context.locales && !isArray(context.locales)) { + console.warn('Invalid `context.locales` value, it should be an array!'); + } + }, + formats: function(context) { + if (context.formats && !isObject(context.formats)) { + console.warn('Invalid `context.formats` value, it should be an object!'); + } + } + }, + childContextTypes: { + locales: function(context) { + if (context.locales && !isArray(context.locales)) { + console.warn('Invalid `locales` value in getChildContext(), it should be an array!'); + } + }, + formats: function(context) { + if (context.formats && !isObject(context.formats)) { + console.warn('Invalid `formats` value in getChildContext(), it should be an object!'); + } + } + }, + propsTypes: { + locales: function(props) { + if (props.locales && !isArray(props.locales)) { + console.warn('Invalid `props.locales` value, it should be an array!'); + } + }, + formats: function(props) { + if (props.formats && !isObject(props.formats)) { + console.warn('Invalid `props.formats` value, it should be an object!'); + } + } + }, + getChildContext: function () { + var childContext = Object.create(this.context); + if (this.props.locales) { + childContext.locales = this.props.locales; + } + if (this.props.formats) { + childContext.formats = this.props.formats; + } + return childContext; + }, + intlDate : intlDate, + intlNumber : intlNumber, + intlMessage: intlMessage + }; + +})(window); \ No newline at end of file diff --git a/dist/react-intl.min.js b/dist/react-intl.min.js new file mode 100644 index 0000000000..6511338bea --- /dev/null +++ b/dist/react-intl.min.js @@ -0,0 +1 @@ +!function(a){function b(a,b){var c=this.props.locales||this.context.locales,d=this.props.formats||this.context.formats;if(a=new Date(a),!a||!a.getTime())throw new TypeError("A date must be provided.");if(b){if("string"==typeof b)try{b=d.date[b]}catch(g){throw new ReferenceError("Invalid date formatter: `"+b+"`.")}b=f({},b)}return e("date",c,b).format(a)}function c(a,b){var c=this.props.locales||this.context.locales,d=this.props.formats||this.context.formats;if("number"!=typeof a)throw new TypeError("A number must be provided.");if(b){if("string"==typeof b)try{b=d.number[b]}catch(g){throw new ReferenceError("Invalid number formatter: `"+b+"`.")}b=f({},b)}return e("number",c,b).format(a)}function d(a,b){var c=this.props.locales||this.context.locales,d=this.props.formats||this.context.formats;return l(a)?a(b):(l(a.format)||(a=new h(a,c,d)),a.format(b))}function e(b,c,d){var e,f,h,j,k,l,m;if(a.JSON){if(d){e=[];for(h in d)d.hasOwnProperty(h)&&e.push(h);for(e.sort(),j=0,k=e.length;k>j;j+=1)h=e[j],f={},f[h]=d[h],e[j]=f}l=a.JSON.stringify([c,e])}if(m=i[b][l])return m;switch(b){case"number":m=new g.NumberFormat(c,d);break;case"date":m=new g.DateTimeFormat(c,d)}return l&&(i[b][l]=m),m}function f(a){var b,c,d,e,f=Array.prototype.slice.call(arguments,1);for(b=0,c=f.length;c>b;b+=1)if(d=f[b])for(e in d)d.hasOwnProperty(e)&&(a[e]=d[e]);return a}!function(a,b){"use strict";var c=a.Intl||a.IntlPolyfill,d=b(c);"function"==typeof define&&define.amd&&define(d),"object"==typeof module&&"object"==typeof module.exports&&(module.exports=d),a&&(a.IntlMessageFormat=d)}("undefined"!=typeof a?a:this,function(a){"use strict";function b(a,c,d){if("string"==typeof a&&(a=b.__parse(a)),!a||"number"!=typeof a.length)throw new TypeError("A pattern must be provided as a String or Array.");d=this._mergeFormats(b.FORMATS,d),t(this,"_locale",{value:this._resolveLocale(c)}),a=this._compilePattern(a,c,d),t(this,"_pattern",{value:a}),this.format=v.call(this.format,this)}function c(a){var b=a.match(w);return b?new d(b[1]):a}function d(a){this.valueName=a}function e(a,b){this.valueName=a,this.options=b}function f(a,b,c){this.valueName=a,this.options=b,this.pluralFunction=c}function g(a,b){var c,d,e,f,g,h=/[{}]/g,i=[],j=0,k=0;for(e=h.exec(a);e;){if(j+="{"===e[0]?1:-1,0>j)throw new Error("Imbalanced bracket detected at index "+e.index+' for message "'+a+'"');0===j&&(c=e.index+1,i.push(a.slice(k,c)),k=c),1===j&&k!==e.index&&(d=a.slice(k,e.index),-1===d.indexOf("{")&&(i.push(d),k=e.index)),e=h.exec(a)}if(0!==j)throw new Error("Brackets were not properly closed: "+a);if(k!==a.length&&i.push(a.slice(k)),b)for(f=0,g=i.length;g>f;f++)i[f]=i[f].replace(/^\s+|\s+$/gm,"");return i}function h(a){return a.replace(/^\{\s*/,"").replace(/\s*\}$/,"")}function i(a){return a.indexOf("{")>=0}function j(a,b){var c,d,e,f,g;if(a.options={},b.length%2)throw new Error("Options must come in pairs: "+b.join(", "));for(g=0,f=b.length;f>g;g+=2)e=b[g],d=b[g+1],a.options[e]=d,c=c||"other"===e;if(!c)throw new Error('Options must include default "other" option: '+b.join(", "));return a}function k(a,b){return a.format=b[0],a}function l(a,b,c){var d={type:c.type,valueName:b[1]},e=b[2]&&g(b[2],!0);return c.tokenParser&&e&&(d=c.tokenParser(d,e)),c.postParser&&(d=c.postParser(d)),d}function m(a,b){var c,d;for(c=0,d=x.length;d>c;c++)if(n(x[c],a,b))return a[b];return a[b]}function n(a,b,c){var d,e,f,g,h=b[c],i=h.match(a.regex),j=[];if(i){if(d=a.parse(h,i,a),b[c]=d,d&&d.options&&"object"==typeof d.options)for(e in d.options)d.options.hasOwnProperty(e)&&j.push(e);for(f=0,g=j.length;g>f;f++)o(d,j[f],a);return!0}return!!i}function o(a,b,c){var d=a.options&&a.options[b];d=h(d),a.options[b]=p(d,c.outputFormatter)}function p(a,b){var c,d,e;if(!i(a))return b?b(a):[a];for(c=g(a),d=0,e=c.length;e>d;d++)"{"===c[d].charAt(0)&&(c[d]=m(c,d));return c}function q(a){var b,c,d,e,f=Array.prototype.slice.call(arguments,1);for(b=0,c=f.length;c>b;b+=1)if(d=f[b])for(e in d)d.hasOwnProperty(e)&&(a[e]=d[e]);return a}if(!a)throw new ReferenceError("Intl must be available");var r=Object.prototype.hasOwnProperty,s=function(){try{return!!Object.defineProperty({},"a",{})}catch(a){return!1}}(),t=(!s&&!Object.prototype.__defineGetter__,s?Object.defineProperty:function(a,b,c){"get"in c&&a.__defineGetter__?a.__defineGetter__(b,c.get):(!r.call(a,b)||"value"in c)&&(a[b]=c.value)}),u=Object.create||function(a,b){function c(){}var d,e;c.prototype=a,d=new c;for(e in b)r.call(b,e)&&t(d,e,b[e]);return d},v=Function.prototype.bind||function(a){var b=this,c=[].slice.call(arguments,1);return function(){b.apply(a,c.concat([].slice.call(arguments)))}};t(b,"FORMATS",{enumerable:!0,value:{number:{currency:{style:"currency"},percent:{style:"percent"}},date:{"short":{month:"numeric",day:"numeric",year:"2-digit"},medium:{month:"short",day:"numeric",year:"numeric"},"long":{month:"long",day:"numeric",year:"numeric"},full:{weekday:"long",month:"long",day:"numeric",year:"numeric"}},time:{"short":{hour:"numeric",minute:"numeric"},medium:{hour:"numeric",minute:"numeric",second:"numeric"},"long":{hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"short"},full:{hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"short"}}}}),t(b,"__availableLocales__",{value:[]}),t(b,"__localeData__",{value:u(null)}),t(b,"__addLocaleData",{value:function(a){if(!a||!a.locale)throw new Error("Object passed does not identify itself with a valid language tag");if(!a.messageformat)throw new Error("Object passed does not contain locale data for IntlMessageFormat");var c=b.__availableLocales__,d=b.__localeData__,e=a.locale.toLowerCase().split("-")[0];c.push(e),d[e]=a.messageformat,void 0===b.defaultLocale&&(b.defaultLocale=e)}}),t(b,"__parse",{value:p}),t(b,"defaultLocale",{enumerable:!0,writable:!0}),b.prototype.format=function(a){return this._format(this._pattern,a)},b.prototype.resolvedOptions=function(){return{locale:this._locale}},b.prototype._compilePattern=function(d,g,h){"string"==typeof d&&(d=[d]);var i,j,k,l,m,n,o,p,q,s,t,u=this._locale,v=b.__localeData__,w=[];for(i=0,j=d.length;j>i;i+=1)if(k=d[i],"string"!=typeof k){if(l=k.type,m=k.valueName,p=k.options){s={};for(q in p)r.call(p,q)&&(t=p[q],"plural"===l&&"string"==typeof t&&t.indexOf("${#}")>=0?(t=t.match(/(.*)\${#}(.*)/),s[q]=[t[1],{valueName:m,format:new a.NumberFormat(g).format},t[2]]):s[q]=this._compilePattern(t,g,h))}switch(l){case"date":n=h.date[k.format],w.push({valueName:m,format:new a.DateTimeFormat(g,n).format});break;case"time":n=h.time[k.format],w.push({valueName:m,format:new a.DateTimeFormat(g,n).format});break;case"number":n=h.number[k.format],w.push({valueName:m,format:new a.NumberFormat(g,n).format});break;case"plural":o=v[u].pluralFunction,w.push(new f(m,s,o));break;case"select":w.push(new e(m,s));break;default:throw new Error("Message pattern part at index "+i+" does not have a valid type")}}else w.push(c(k));return w},b.prototype._format=function(a,b){var c,d,e,f,g,h,i="";for(c=0,d=a.length;d>c;c+=1)if(e=a[c],"string"!=typeof e){if(f=e.valueName,!b||!r.call(b,f))throw new Error("A value must be provided for: "+f);g=b[f],h=e.options,i+=h?this._format(e.getOption(g),b):e.format(g)}else i+=e;return i},b.prototype._mergeFormats=function(a,b){var c,d,e={};for(c in a)r.call(a,c)&&(e[c]=d=u(a[c]),b&&r.call(b,c)&&q(d,b[c]));return e},b.prototype._resolveLocale=function(a){var c,d,e,f=b.__availableLocales__;if(0===f.length)throw new Error("No locale data has been provided for IntlMessageFormat yet");if("string"==typeof a&&(a=[a]),a&&a.length)for(d=0,e=a.length;e>d;d+=1){if(c=a[d].toLowerCase().split("-")[0],!/[a-z]{2,3}/i.test(c))throw new RangeError('"'+a[d]+'" is not a structurally valid language tag');if(f.indexOf(c)>=0)break}return c||b.defaultLocale};var w=/^\${([-\w]+)}$/;d.prototype.format=function(a){return a?"string"==typeof a?a:String(a):""},e.prototype.getOption=function(a){var b=this.options;return b[a]||b.other},f.prototype.getOption=function(a){var b=this.options,c=this.pluralFunction(a);return b[c]||b.other};var x=[{type:"string",regex:/^{\s*([-\w]+)\s*}$/,parse:l,postParser:function(a){return"${"+a.valueName+"}"}},{type:"select",regex:/^{\s*([-\w]+)\s*,\s*select\s*,\s*(.*)\s*}$/,parse:l,tokenParser:j},{type:"plural",regex:/^{\s*([-\w]+)\s*,\s*plural\s*,\s*(.*)\s*}$/,parse:l,tokenParser:j,outputFormatter:function(a){return a.replace(/#/g,"${#}")}},{type:"time",regex:/^{\s*([-\w]+)\s*,\s*time(?:,(.*))?\s*}$/,parse:l,tokenParser:k,postParser:function(a){return a.format=a.format||"medium",a}},{type:"date",regex:/^{\s*([-\w]+)\s*,\s*date(?:,(.*))?\s*}$/,parse:l,tokenParser:k,postParser:function(a){return a.format=a.format||"medium",a}},{type:"number",regex:/^{\s*([-\w]+)\s*,\s*number(?:,(.*))?\s*}$/,parse:l,tokenParser:k},{type:"custom",regex:/^{\s*([-\w]+)\s*,\s*([a-zA-Z]*)(?:,(.*))?\s*}$/,parse:l,tokenParser:k}];return b}),function(a){var b=a.IntlMessageFormat,c=[function(){},function(a){return a=Math.floor(a),1===a?"one":"other"},function(a){return a=Math.floor(a),a>=0&&1>=a?"one":"other"},function(a){var b=Math.floor(Math.abs(a));return a=Math.floor(a),0===b||1===a?"one":"other"},function(a){return a=Math.floor(a),0===a?"zero":1===a?"one":2===a?"two":a%100>=3&&10>=a%100?"few":a%100>=11&&99>=a%100?"many":"other"},function(a){return a=Math.floor(a),a%10===1&&a%100!==11?"one":a%10>=2&&4>=a%10&&!(a%100>=12&&14>=a%100)?"few":a%10===0||a%10>=5&&9>=a%10||a%100>=11&&14>=a%100?"many":"other"},function(){return"other"},function(a){return a=Math.floor(a),a%10===1&&a%100!==11&&a%100!==71&&a%100!==91?"one":a%10===2&&a%100!==12&&a%100!==72&&a%100!==92?"two":(a%10>=3&&4>=a%10||a%10===9)&&!(a%100>=10&&19>=a%100||a%100>=70&&79>=a%100||a%100>=90&&99>=a%100)?"few":0!==a&&a%1e6===0?"many":"other"},function(a){var b=Math.floor(Math.abs(a)),c=a.toString().replace(/^[^.]*\.?/,"").length,d=parseInt(a.toString().replace(/^[^.]*\.?/,""),10);return a=Math.floor(a),0===c&&b%10===1&&(b%100!==11||d%10===1&&d%100!==11)?"one":0===c&&b%10>=2&&4>=b%10&&(!(b%100>=12&&14>=b%100)||d%10>=2&&4>=d%10&&!(d%100>=12&&14>=d%100))?"few":"other"},function(a){var b=Math.floor(Math.abs(a)),c=a.toString().replace(/^[^.]*\.?/,"").length;return a=Math.floor(a),1===b&&0===c?"one":"other"},function(a){var b=Math.floor(Math.abs(a)),c=a.toString().replace(/^[^.]*\.?/,"").length;return a=Math.floor(a),1===b&&0===c?"one":b>=2&&4>=b&&0===c?"few":0!==c?"many":"other"},function(a){return a=Math.floor(a),0===a?"zero":1===a?"one":2===a?"two":3===a?"few":6===a?"many":"other"},function(a){var b=Math.floor(Math.abs(a)),c=parseInt(a.toString().replace(/^[^.]*\.?|0+$/g,""),10);return a=Math.floor(a),1===a||0!==c&&(0===b||1===b)?"one":"other"},function(a){var b=Math.floor(Math.abs(a));return a=Math.floor(a),0===b||1===b?"one":"other"},function(a){var b=Math.floor(Math.abs(a)),c=a.toString().replace(/^[^.]*\.?/,"").length;return a=Math.floor(a),b>=0&&1>=b&&0===c?"one":"other"},function(a){return a=Math.floor(a),1===a?"one":2===a?"two":a>=3&&6>=a?"few":a>=7&&10>=a?"many":"other"},function(a){return a=Math.floor(a),1===a||11===a?"one":2===a||12===a?"two":a>=3&&10>=a||a>=13&&19>=a?"few":"other"},function(a){return a=Math.floor(a),a%10===1?"one":a%10===2?"two":a%100===0||a%100===20||a%100===40||a%100===60?"few":"other"},function(a){var b=Math.floor(Math.abs(a)),c=a.toString().replace(/^[^.]*\.?/,"").length;return a=Math.floor(a),1===b&&0===c?"one":2===b&&0===c?"two":0!==c||a>=0&&10>=a||a%10!==0?"other":"many"},function(a){var b=Math.floor(Math.abs(a)),c=parseInt(a.toString().replace(/^[^.]*\.?|0+$/g,""),10);return a=Math.floor(a),0!==c||b%10!==1||b%100===11&&0===c?"other":"one"},function(a){return a=Math.floor(a),0===a?"zero":1===a?"one":"other"},function(a){return a=Math.floor(a),1===a?"one":2===a?"two":"other"},function(a){var b=Math.floor(Math.abs(a));return a=Math.floor(a),0===a?"zero":0!==b&&1!==b||0===a?"other":"one"},function(a){var b=parseInt(a.toString().replace(/^[^.]*\.?/,""),10);return a=Math.floor(a),a%10!==1||a%100>=11&&19>=a%100?a%10>=2&&9>=a%10&&!(a%100>=11&&19>=a%100)?"few":0!==b?"many":"other":"one"},function(a){var b=a.toString().replace(/^[^.]*\.?/,"").length,c=parseInt(a.toString().replace(/^[^.]*\.?/,""),10);return a=Math.floor(a),a%10===0||a%100>=11&&19>=a%100||2===b&&c%100>=11&&19>=c%100?"zero":a%10===1&&(a%100!==11||2===b&&c%10===1&&(c%100!==11||2!==b&&c%10===1))?"one":"other"},function(a){var b=Math.floor(Math.abs(a)),c=a.toString().replace(/^[^.]*\.?/,"").length,d=parseInt(a.toString().replace(/^[^.]*\.?/,""),10);return a=Math.floor(a),0!==c||b%10!==1&&d%10!==1?"other":"one"},function(a){return a=Math.floor(a),1===a?"one":0===a||a%100>=2&&10>=a%100?"few":a%100>=11&&19>=a%100?"many":"other"},function(a){var b=Math.floor(Math.abs(a)),c=a.toString().replace(/^[^.]*\.?/,"").length;return a=Math.floor(a),1===b&&0===c?"one":0===c&&b%10>=2&&4>=b%10&&!(b%100>=12&&14>=b%100)?"few":0===c&&1!==b&&(b%10>=0&&1>=b%10||0===c&&(b%10>=5&&9>=b%10||0===c&&b%100>=12&&14>=b%100))?"many":"other"},function(a){var b=Math.floor(Math.abs(a)),c=a.toString().replace(/^[^.]*\.?/,"").length,d=parseInt(a.toString().replace(/^[^.]*\.?|0+$/g,""),10);return a=Math.floor(a),1===b&&(0===c||0===b&&1===d)?"one":"other"},function(a){var b=Math.floor(Math.abs(a)),c=a.toString().replace(/^[^.]*\.?/,"").length;return a=Math.floor(a),1===b&&0===c?"one":0!==c||0===a||1!==a&&a%100>=1&&19>=a%100?"few":"other"},function(a){var b=Math.floor(Math.abs(a)),c=a.toString().replace(/^[^.]*\.?/,"").length;return a=Math.floor(a),0===c&&b%10===1&&b%100!==11?"one":0===c&&(b%10===0||0===c&&(b%10>=5&&9>=b%10||0===c&&b%100>=11&&14>=b%100))?"many":"other"},function(a){var b=Math.floor(Math.abs(a));return a=Math.floor(a),0===b||1===a?"one":a>=2&&10>=a?"few":"other"},function(a){var b=Math.floor(Math.abs(a)),c=parseInt(a.toString().replace(/^[^.]*\.?/,""),10);return a=Math.floor(a),0===a||1===a||0===b&&1===c?"one":"other"},function(a){var b=Math.floor(Math.abs(a)),c=a.toString().replace(/^[^.]*\.?/,"").length;return a=Math.floor(a),0===c&&b%100===1?"one":0===c&&b%100===2?"two":0===c&&(b%100>=3&&4>=b%100||0!==c)?"few":"other"},function(a){return a=Math.floor(a),a>=0&&1>=a||a>=11&&99>=a?"one":"other"},function(a){var b=Math.floor(Math.abs(a)),c=a.toString().replace(/^[^.]*\.?/,"").length;return a=Math.floor(a),0===c&&b%10===1&&b%100!==11?"one":0===c&&b%10>=2&&4>=b%10&&!(b%100>=12&&14>=b%100)?"few":0===c&&(b%10===0||0===c&&(b%10>=5&&9>=b%10||0===c&&b%100>=11&&14>=b%100))?"many":"other"}];b.__addLocaleData({locale:"aa",messageformat:{pluralFunction:c[0]}}),b.__addLocaleData({locale:"af",messageformat:{pluralFunction:c[1]}}),b.__addLocaleData({locale:"agq",messageformat:{pluralFunction:c[0]}}),b.__addLocaleData({locale:"ak",messageformat:{pluralFunction:c[2]}}),b.__addLocaleData({locale:"am",messageformat:{pluralFunction:c[3]}}),b.__addLocaleData({locale:"ar",messageformat:{pluralFunction:c[4]}}),b.__addLocaleData({locale:"as",messageformat:{pluralFunction:c[0]}}),b.__addLocaleData({locale:"asa",messageformat:{pluralFunction:c[1]}}),b.__addLocaleData({locale:"ast",messageformat:{pluralFunction:c[1]}}),b.__addLocaleData({locale:"az",messageformat:{pluralFunction:c[1]}}),b.__addLocaleData({locale:"bas",messageformat:{pluralFunction:c[0]}}),b.__addLocaleData({locale:"be",messageformat:{pluralFunction:c[5]}}),b.__addLocaleData({locale:"bem",messageformat:{pluralFunction:c[1]}}),b.__addLocaleData({locale:"bez",messageformat:{pluralFunction:c[1]}}),b.__addLocaleData({locale:"bg",messageformat:{pluralFunction:c[1]}}),b.__addLocaleData({locale:"bm",messageformat:{pluralFunction:c[6]}}),b.__addLocaleData({locale:"bn",messageformat:{pluralFunction:c[3]}}),b.__addLocaleData({locale:"bo",messageformat:{pluralFunction:c[6]}}),b.__addLocaleData({locale:"br",messageformat:{pluralFunction:c[7]}}),b.__addLocaleData({locale:"brx",messageformat:{pluralFunction:c[1]}}),b.__addLocaleData({locale:"bs",messageformat:{pluralFunction:c[8]}}),b.__addLocaleData({locale:"byn",messageformat:{pluralFunction:c[0]}}),b.__addLocaleData({locale:"ca",messageformat:{pluralFunction:c[9]}}),b.__addLocaleData({locale:"cgg",messageformat:{pluralFunction:c[1]}}),b.__addLocaleData({locale:"chr",messageformat:{pluralFunction:c[1]}}),b.__addLocaleData({locale:"cs",messageformat:{pluralFunction:c[10]}}),b.__addLocaleData({locale:"cy",messageformat:{pluralFunction:c[11]}}),b.__addLocaleData({locale:"da",messageformat:{pluralFunction:c[12]}}),b.__addLocaleData({locale:"dav",messageformat:{pluralFunction:c[0]}}),b.__addLocaleData({locale:"de",messageformat:{pluralFunction:c[9]}}),b.__addLocaleData({locale:"dje",messageformat:{pluralFunction:c[0]}}),b.__addLocaleData({locale:"dua",messageformat:{pluralFunction:c[0]}}),b.__addLocaleData({locale:"dyo",messageformat:{pluralFunction:c[0]}}),b.__addLocaleData({locale:"dz",messageformat:{pluralFunction:c[6]}}),b.__addLocaleData({locale:"ebu",messageformat:{pluralFunction:c[0]}}),b.__addLocaleData({locale:"ee",messageformat:{pluralFunction:c[1]}}),b.__addLocaleData({locale:"el",messageformat:{pluralFunction:c[1]}}),b.__addLocaleData({locale:"en",messageformat:{pluralFunction:c[9]}}),b.__addLocaleData({locale:"eo",messageformat:{pluralFunction:c[1]}}),b.__addLocaleData({locale:"es",messageformat:{pluralFunction:c[1]}}),b.__addLocaleData({locale:"et",messageformat:{pluralFunction:c[9]}}),b.__addLocaleData({locale:"eu",messageformat:{pluralFunction:c[1]}}),b.__addLocaleData({locale:"ewo",messageformat:{pluralFunction:c[0]}}),b.__addLocaleData({locale:"fa",messageformat:{pluralFunction:c[3]}}),b.__addLocaleData({locale:"ff",messageformat:{pluralFunction:c[13]}}),b.__addLocaleData({locale:"fi",messageformat:{pluralFunction:c[14]}}),b.__addLocaleData({locale:"fil",messageformat:{pluralFunction:c[14]}}),b.__addLocaleData({locale:"fo",messageformat:{pluralFunction:c[1]}}),b.__addLocaleData({locale:"fr",messageformat:{pluralFunction:c[13]}}),b.__addLocaleData({locale:"fur",messageformat:{pluralFunction:c[1]}}),b.__addLocaleData({locale:"ga",messageformat:{pluralFunction:c[15]}}),b.__addLocaleData({locale:"gd",messageformat:{pluralFunction:c[16]}}),b.__addLocaleData({locale:"gl",messageformat:{pluralFunction:c[9]}}),b.__addLocaleData({locale:"gsw",messageformat:{pluralFunction:c[1]}}),b.__addLocaleData({locale:"gu",messageformat:{pluralFunction:c[3]}}),b.__addLocaleData({locale:"guz",messageformat:{pluralFunction:c[0]}}),b.__addLocaleData({locale:"gv",messageformat:{pluralFunction:c[17]}}),b.__addLocaleData({locale:"ha",messageformat:{pluralFunction:c[1]}}),b.__addLocaleData({locale:"haw",messageformat:{pluralFunction:c[1]}}),b.__addLocaleData({locale:"he",messageformat:{pluralFunction:c[18]}}),b.__addLocaleData({locale:"hi",messageformat:{pluralFunction:c[3]}}),b.__addLocaleData({locale:"hr",messageformat:{pluralFunction:c[8]}}),b.__addLocaleData({locale:"hu",messageformat:{pluralFunction:c[1]}}),b.__addLocaleData({locale:"hy",messageformat:{pluralFunction:c[13]}}),b.__addLocaleData({locale:"ia",messageformat:{pluralFunction:c[0]}}),b.__addLocaleData({locale:"id",messageformat:{pluralFunction:c[6]}}),b.__addLocaleData({locale:"ig",messageformat:{pluralFunction:c[6]}}),b.__addLocaleData({locale:"ii",messageformat:{pluralFunction:c[6]}}),b.__addLocaleData({locale:"is",messageformat:{pluralFunction:c[19]}}),b.__addLocaleData({locale:"it",messageformat:{pluralFunction:c[9]}}),b.__addLocaleData({locale:"ja",messageformat:{pluralFunction:c[6]}}),b.__addLocaleData({locale:"jgo",messageformat:{pluralFunction:c[1]}}),b.__addLocaleData({locale:"jmc",messageformat:{pluralFunction:c[1]}}),b.__addLocaleData({locale:"ka",messageformat:{pluralFunction:c[1]}}),b.__addLocaleData({locale:"kab",messageformat:{pluralFunction:c[13]}}),b.__addLocaleData({locale:"kam",messageformat:{pluralFunction:c[0]}}),b.__addLocaleData({locale:"kde",messageformat:{pluralFunction:c[6]}}),b.__addLocaleData({locale:"kea",messageformat:{pluralFunction:c[6]}}),b.__addLocaleData({locale:"khq",messageformat:{pluralFunction:c[0]}}),b.__addLocaleData({locale:"ki",messageformat:{pluralFunction:c[0]}}),b.__addLocaleData({locale:"kk",messageformat:{pluralFunction:c[1]}}),b.__addLocaleData({locale:"kkj",messageformat:{pluralFunction:c[1]}}),b.__addLocaleData({locale:"kl",messageformat:{pluralFunction:c[1]}}),b.__addLocaleData({locale:"kln",messageformat:{pluralFunction:c[0]}}),b.__addLocaleData({locale:"km",messageformat:{pluralFunction:c[6]}}),b.__addLocaleData({locale:"kn",messageformat:{pluralFunction:c[3]}}),b.__addLocaleData({locale:"ko",messageformat:{pluralFunction:c[6]}}),b.__addLocaleData({locale:"kok",messageformat:{pluralFunction:c[0]}}),b.__addLocaleData({locale:"ks",messageformat:{pluralFunction:c[1]}}),b.__addLocaleData({locale:"ksb",messageformat:{pluralFunction:c[1]}}),b.__addLocaleData({locale:"ksf",messageformat:{pluralFunction:c[0]}}),b.__addLocaleData({locale:"ksh",messageformat:{pluralFunction:c[20]}}),b.__addLocaleData({locale:"kw",messageformat:{pluralFunction:c[21]}}),b.__addLocaleData({locale:"ky",messageformat:{pluralFunction:c[1]}}),b.__addLocaleData({locale:"lag",messageformat:{pluralFunction:c[22]}}),b.__addLocaleData({locale:"lg",messageformat:{pluralFunction:c[1]}}),b.__addLocaleData({locale:"lkt",messageformat:{pluralFunction:c[6]}}),b.__addLocaleData({locale:"ln",messageformat:{pluralFunction:c[2]}}),b.__addLocaleData({locale:"lo",messageformat:{pluralFunction:c[6]}}),b.__addLocaleData({locale:"lt",messageformat:{pluralFunction:c[23]}}),b.__addLocaleData({locale:"lu",messageformat:{pluralFunction:c[0]}}),b.__addLocaleData({locale:"luo",messageformat:{pluralFunction:c[0]}}),b.__addLocaleData({locale:"luy",messageformat:{pluralFunction:c[0]}}),b.__addLocaleData({locale:"lv",messageformat:{pluralFunction:c[24]}}),b.__addLocaleData({locale:"mas",messageformat:{pluralFunction:c[1]}}),b.__addLocaleData({locale:"mer",messageformat:{pluralFunction:c[0]}}),b.__addLocaleData({locale:"mfe",messageformat:{pluralFunction:c[0]}}),b.__addLocaleData({locale:"mg",messageformat:{pluralFunction:c[2]}}),b.__addLocaleData({locale:"mgh",messageformat:{pluralFunction:c[0]}}),b.__addLocaleData({locale:"mgo",messageformat:{pluralFunction:c[1]}}),b.__addLocaleData({locale:"mk",messageformat:{pluralFunction:c[25]}}),b.__addLocaleData({locale:"ml",messageformat:{pluralFunction:c[1]}}),b.__addLocaleData({locale:"mn",messageformat:{pluralFunction:c[1]}}),b.__addLocaleData({locale:"mr",messageformat:{pluralFunction:c[3]}}),b.__addLocaleData({locale:"ms",messageformat:{pluralFunction:c[6]}}),b.__addLocaleData({locale:"mt",messageformat:{pluralFunction:c[26]}}),b.__addLocaleData({locale:"mua",messageformat:{pluralFunction:c[0]}}),b.__addLocaleData({locale:"my",messageformat:{pluralFunction:c[6]}}),b.__addLocaleData({locale:"naq",messageformat:{pluralFunction:c[21]}}),b.__addLocaleData({locale:"nb",messageformat:{pluralFunction:c[1]}}),b.__addLocaleData({locale:"nd",messageformat:{pluralFunction:c[1]}}),b.__addLocaleData({locale:"ne",messageformat:{pluralFunction:c[1]}}),b.__addLocaleData({locale:"nl",messageformat:{pluralFunction:c[9]}}),b.__addLocaleData({locale:"nmg",messageformat:{pluralFunction:c[0]}}),b.__addLocaleData({locale:"nn",messageformat:{pluralFunction:c[1]}}),b.__addLocaleData({locale:"nnh",messageformat:{pluralFunction:c[1]}}),b.__addLocaleData({locale:"nr",messageformat:{pluralFunction:c[1]}}),b.__addLocaleData({locale:"nso",messageformat:{pluralFunction:c[2]}}),b.__addLocaleData({locale:"nus",messageformat:{pluralFunction:c[0]}}),b.__addLocaleData({locale:"nyn",messageformat:{pluralFunction:c[1]}}),b.__addLocaleData({locale:"om",messageformat:{pluralFunction:c[1]}}),b.__addLocaleData({locale:"or",messageformat:{pluralFunction:c[1]}}),b.__addLocaleData({locale:"os",messageformat:{pluralFunction:c[1]}}),b.__addLocaleData({locale:"pa",messageformat:{pluralFunction:c[2]}}),b.__addLocaleData({locale:"pl",messageformat:{pluralFunction:c[27]}}),b.__addLocaleData({locale:"ps",messageformat:{pluralFunction:c[1]}}),b.__addLocaleData({locale:"pt",messageformat:{pluralFunction:c[28]}}),b.__addLocaleData({locale:"rm",messageformat:{pluralFunction:c[1]}}),b.__addLocaleData({locale:"rn",messageformat:{pluralFunction:c[0]}}),b.__addLocaleData({locale:"ro",messageformat:{pluralFunction:c[29]}}),b.__addLocaleData({locale:"rof",messageformat:{pluralFunction:c[1]}}),b.__addLocaleData({locale:"ru",messageformat:{pluralFunction:c[30]}}),b.__addLocaleData({locale:"rw",messageformat:{pluralFunction:c[0]}}),b.__addLocaleData({locale:"rwk",messageformat:{pluralFunction:c[1]}}),b.__addLocaleData({locale:"sah",messageformat:{pluralFunction:c[6]}}),b.__addLocaleData({locale:"saq",messageformat:{pluralFunction:c[1]}}),b.__addLocaleData({locale:"sbp",messageformat:{pluralFunction:c[0]}}),b.__addLocaleData({locale:"se",messageformat:{pluralFunction:c[21]}}),b.__addLocaleData({locale:"seh",messageformat:{pluralFunction:c[1]}}),b.__addLocaleData({locale:"ses",messageformat:{pluralFunction:c[6]}}),b.__addLocaleData({locale:"sg",messageformat:{pluralFunction:c[6]}}),b.__addLocaleData({locale:"shi",messageformat:{pluralFunction:c[31]}}),b.__addLocaleData({locale:"si",messageformat:{pluralFunction:c[32]}}),b.__addLocaleData({locale:"sk",messageformat:{pluralFunction:c[10]}}),b.__addLocaleData({locale:"sl",messageformat:{pluralFunction:c[33]}}),b.__addLocaleData({locale:"sn",messageformat:{pluralFunction:c[1]}}),b.__addLocaleData({locale:"so",messageformat:{pluralFunction:c[1]}}),b.__addLocaleData({locale:"sq",messageformat:{pluralFunction:c[1]}}),b.__addLocaleData({locale:"sr",messageformat:{pluralFunction:c[8]}}),b.__addLocaleData({locale:"ss",messageformat:{pluralFunction:c[1]}}),b.__addLocaleData({locale:"ssy",messageformat:{pluralFunction:c[1]}}),b.__addLocaleData({locale:"st",messageformat:{pluralFunction:c[1]}}),b.__addLocaleData({locale:"sv",messageformat:{pluralFunction:c[9]}}),b.__addLocaleData({locale:"sw",messageformat:{pluralFunction:c[9]}}),b.__addLocaleData({locale:"swc",messageformat:{pluralFunction:c[0]}}),b.__addLocaleData({locale:"ta",messageformat:{pluralFunction:c[1]}}),b.__addLocaleData({locale:"te",messageformat:{pluralFunction:c[1]}}),b.__addLocaleData({locale:"teo",messageformat:{pluralFunction:c[1]}}),b.__addLocaleData({locale:"tg",messageformat:{pluralFunction:c[0]}}),b.__addLocaleData({locale:"th",messageformat:{pluralFunction:c[6]}}),b.__addLocaleData({locale:"ti",messageformat:{pluralFunction:c[2]}}),b.__addLocaleData({locale:"tig",messageformat:{pluralFunction:c[1]}}),b.__addLocaleData({locale:"tn",messageformat:{pluralFunction:c[1]}}),b.__addLocaleData({locale:"to",messageformat:{pluralFunction:c[6]}}),b.__addLocaleData({locale:"tr",messageformat:{pluralFunction:c[1]}}),b.__addLocaleData({locale:"ts",messageformat:{pluralFunction:c[1]}}),b.__addLocaleData({locale:"twq",messageformat:{pluralFunction:c[0]}}),b.__addLocaleData({locale:"tzm",messageformat:{pluralFunction:c[34]}}),b.__addLocaleData({locale:"uk",messageformat:{pluralFunction:c[35]}}),b.__addLocaleData({locale:"ur",messageformat:{pluralFunction:c[9]}}),b.__addLocaleData({locale:"uz",messageformat:{pluralFunction:c[1]}}),b.__addLocaleData({locale:"vai",messageformat:{pluralFunction:c[0]}}),b.__addLocaleData({locale:"ve",messageformat:{pluralFunction:c[1]}}),b.__addLocaleData({locale:"vi",messageformat:{pluralFunction:c[6]}}),b.__addLocaleData({locale:"vo",messageformat:{pluralFunction:c[1]}}),b.__addLocaleData({locale:"vun",messageformat:{pluralFunction:c[1]}}),b.__addLocaleData({locale:"wae",messageformat:{pluralFunction:c[1]}}),b.__addLocaleData({locale:"wal",messageformat:{pluralFunction:c[0]}}),b.__addLocaleData({locale:"xh",messageformat:{pluralFunction:c[1]}}),b.__addLocaleData({locale:"xog",messageformat:{pluralFunction:c[1]}}),b.__addLocaleData({locale:"yav",messageformat:{pluralFunction:c[0]}}),b.__addLocaleData({locale:"yo",messageformat:{pluralFunction:c[6]}}),b.__addLocaleData({locale:"zgh",messageformat:{pluralFunction:c[0]}}),b.__addLocaleData({locale:"zh",messageformat:{pluralFunction:c[6]}}),b.__addLocaleData({locale:"zu",messageformat:{pluralFunction:c[3]}})}("undefined"!=typeof a?a:this);var g=a.Intl||a.IntlPolyfill,h=a.IntlMessageFormat,i={number:{},date:{}},j=Array.isArray,k=function(a){return"object"==typeof a&&!j(a)},l=function(a){return"function"==typeof a};if(!g)throw new ReferenceError("Intl must be available.");if(!h)throw new ReferenceError("IntlMessageFormat must be available.");a.ReactIntlMixin={contextTypes:{locales:function(a){a.locales&&!j(a.locales)&&console.warn("Invalid `context.locales` value, it should be an array!")},formats:function(a){a.formats&&!k(a.formats)&&console.warn("Invalid `context.formats` value, it should be an object!")}},childContextTypes:{locales:function(a){a.locales&&!j(a.locales)&&console.warn("Invalid `locales` value in getChildContext(), it should be an array!")},formats:function(a){a.formats&&!k(a.formats)&&console.warn("Invalid `formats` value in getChildContext(), it should be an object!")}},propsTypes:{locales:function(a){a.locales&&!j(a.locales)&&console.warn("Invalid `props.locales` value, it should be an array!")},formats:function(a){a.formats&&!k(a.formats)&&console.warn("Invalid `props.formats` value, it should be an object!")}},getChildContext:function(){var a=Object.create(this.context);return this.props.locales&&(a.locales=this.props.locales),this.props.formats&&(a.formats=this.props.formats),a},intlDate:b,intlNumber:c,intlMessage:d}}(window); \ No newline at end of file