/* * Copyright 2019, Yahoo Inc. * Copyrights licensed under the New BSD License. * See the accompanying LICENSE file for terms. */ import allLocaleData from '../locale-data/index.js'; import IntlMessageFormat from 'intl-messageformat'; import IntlRelativeFormat from 'intl-relativeformat'; import PropTypes from 'prop-types'; import React, { Children, Component, createElement, isValidElement } from 'react'; import hoistNonReactStatics from 'hoist-non-react-statics'; import invariant from 'invariant'; import memoizeIntlConstructor from 'intl-format-cache'; // GENERATED FILE var defaultLocaleData = { "locale": "en", "pluralRuleFunction": function pluralRuleFunction(n, ord) { var s = String(n).split("."), v0 = !s[1], t0 = Number(s[0]) == n, n10 = t0 && s[0].slice(-1), n100 = t0 && s[0].slice(-2);if (ord) return n10 == 1 && n100 != 11 ? "one" : n10 == 2 && n100 != 12 ? "two" : n10 == 3 && n100 != 13 ? "few" : "other";return n == 1 && v0 ? "one" : "other"; }, "fields": { "year": { "displayName": "year", "relative": { "0": "this year", "1": "next year", "-1": "last year" }, "relativeTime": { "future": { "one": "in {0} year", "other": "in {0} years" }, "past": { "one": "{0} year ago", "other": "{0} years ago" } } }, "year-short": { "displayName": "yr.", "relative": { "0": "this yr.", "1": "next yr.", "-1": "last yr." }, "relativeTime": { "future": { "one": "in {0} yr.", "other": "in {0} yr." }, "past": { "one": "{0} yr. ago", "other": "{0} yr. ago" } } }, "month": { "displayName": "month", "relative": { "0": "this month", "1": "next month", "-1": "last month" }, "relativeTime": { "future": { "one": "in {0} month", "other": "in {0} months" }, "past": { "one": "{0} month ago", "other": "{0} months ago" } } }, "month-short": { "displayName": "mo.", "relative": { "0": "this mo.", "1": "next mo.", "-1": "last mo." }, "relativeTime": { "future": { "one": "in {0} mo.", "other": "in {0} mo." }, "past": { "one": "{0} mo. ago", "other": "{0} mo. ago" } } }, "day": { "displayName": "day", "relative": { "0": "today", "1": "tomorrow", "-1": "yesterday" }, "relativeTime": { "future": { "one": "in {0} day", "other": "in {0} days" }, "past": { "one": "{0} day ago", "other": "{0} days ago" } } }, "day-short": { "displayName": "day", "relative": { "0": "today", "1": "tomorrow", "-1": "yesterday" }, "relativeTime": { "future": { "one": "in {0} day", "other": "in {0} days" }, "past": { "one": "{0} day ago", "other": "{0} days ago" } } }, "hour": { "displayName": "hour", "relative": { "0": "this hour" }, "relativeTime": { "future": { "one": "in {0} hour", "other": "in {0} hours" }, "past": { "one": "{0} hour ago", "other": "{0} hours ago" } } }, "hour-short": { "displayName": "hr.", "relative": { "0": "this hour" }, "relativeTime": { "future": { "one": "in {0} hr.", "other": "in {0} hr." }, "past": { "one": "{0} hr. ago", "other": "{0} hr. ago" } } }, "minute": { "displayName": "minute", "relative": { "0": "this minute" }, "relativeTime": { "future": { "one": "in {0} minute", "other": "in {0} minutes" }, "past": { "one": "{0} minute ago", "other": "{0} minutes ago" } } }, "minute-short": { "displayName": "min.", "relative": { "0": "this minute" }, "relativeTime": { "future": { "one": "in {0} min.", "other": "in {0} min." }, "past": { "one": "{0} min. ago", "other": "{0} min. ago" } } }, "second": { "displayName": "second", "relative": { "0": "now" }, "relativeTime": { "future": { "one": "in {0} second", "other": "in {0} seconds" }, "past": { "one": "{0} second ago", "other": "{0} seconds ago" } } }, "second-short": { "displayName": "sec.", "relative": { "0": "now" }, "relativeTime": { "future": { "one": "in {0} sec.", "other": "in {0} sec." }, "past": { "one": "{0} sec. ago", "other": "{0} sec. ago" } } } } }; /* * Copyright 2015, Yahoo Inc. * Copyrights licensed under the New BSD License. * See the accompanying LICENSE file for terms. */ function addLocaleData() { var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; var locales = Array.isArray(data) ? data : [data]; locales.forEach(function (localeData) { if (localeData && localeData.locale) { IntlMessageFormat.__addLocaleData(localeData); IntlRelativeFormat.__addLocaleData(localeData); } }); } function hasLocaleData(locale) { var localeParts = (locale || '').split('-'); while (localeParts.length > 0) { if (hasIMFAndIRFLocaleData(localeParts.join('-'))) { return true; } localeParts.pop(); } return false; } function hasIMFAndIRFLocaleData(locale) { var normalizedLocale = locale && locale.toLowerCase(); return !!(IntlMessageFormat.__localeData__[normalizedLocale] && IntlRelativeFormat.__localeData__[normalizedLocale]); } var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; var asyncGenerator = function () { function AwaitValue(value) { this.value = value; } function AsyncGenerator(gen) { var front, back; function send(key, arg) { return new Promise(function (resolve, reject) { var request = { key: key, arg: arg, resolve: resolve, reject: reject, next: null }; if (back) { back = back.next = request; } else { front = back = request; resume(key, arg); } }); } function resume(key, arg) { try { var result = gen[key](arg); var value = result.value; if (value instanceof AwaitValue) { Promise.resolve(value.value).then(function (arg) { resume("next", arg); }, function (arg) { resume("throw", arg); }); } else { settle(result.done ? "return" : "normal", result.value); } } catch (err) { settle("throw", err); } } function settle(type, value) { switch (type) { case "return": front.resolve({ value: value, done: true }); break; case "throw": front.reject(value); break; default: front.resolve({ value: value, done: false }); break; } front = front.next; if (front) { resume(front.key, front.arg); } else { back = null; } } this._invoke = send; if (typeof gen.return !== "function") { this.return = undefined; } } if (typeof Symbol === "function" && Symbol.asyncIterator) { AsyncGenerator.prototype[Symbol.asyncIterator] = function () { return this; }; } AsyncGenerator.prototype.next = function (arg) { return this._invoke("next", arg); }; AsyncGenerator.prototype.throw = function (arg) { return this._invoke("throw", arg); }; AsyncGenerator.prototype.return = function (arg) { return this._invoke("return", arg); }; return { wrap: function (fn) { return function () { return new AsyncGenerator(fn.apply(this, arguments)); }; }, await: function (value) { return new AwaitValue(value); } }; }(); var classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }; var createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); var defineProperty = function (obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }; var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; var inherits = function (subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }; var objectWithoutProperties = function (obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }; var possibleConstructorReturn = function (self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }; var toConsumableArray = function (arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; return arr2; } else { return Array.from(arr); } }; /* * Copyright 2015, Yahoo Inc. * Copyrights licensed under the New BSD License. * See the accompanying LICENSE file for terms. */ var bool = PropTypes.bool; var number = PropTypes.number; var string = PropTypes.string; var func = PropTypes.func; var object = PropTypes.object; var oneOf = PropTypes.oneOf; var shape = PropTypes.shape; var any = PropTypes.any; var oneOfType = PropTypes.oneOfType; var localeMatcher = oneOf(['best fit', 'lookup']); var narrowShortLong = oneOf(['narrow', 'short', 'long']); var numeric2digit = oneOf(['numeric', '2-digit']); var funcReq = func.isRequired; var intlConfigPropTypes = { locale: string, timeZone: string, formats: object, messages: object, textComponent: any, defaultLocale: string, defaultFormats: object, onError: func }; var intlFormatPropTypes = { formatDate: funcReq, formatTime: funcReq, formatRelative: funcReq, formatNumber: funcReq, formatPlural: funcReq, formatMessage: funcReq, formatHTMLMessage: funcReq }; var intlShape = shape(_extends({}, intlConfigPropTypes, intlFormatPropTypes, { formatters: object, now: funcReq })); var messageDescriptorPropTypes = { id: string.isRequired, description: oneOfType([string, object]), defaultMessage: string }; var dateTimeFormatPropTypes = { localeMatcher: localeMatcher, formatMatcher: oneOf(['basic', 'best fit']), timeZone: string, hour12: bool, weekday: narrowShortLong, era: narrowShortLong, year: numeric2digit, month: oneOf(['numeric', '2-digit', 'narrow', 'short', 'long']), day: numeric2digit, hour: numeric2digit, minute: numeric2digit, second: numeric2digit, timeZoneName: oneOf(['short', 'long']) }; var numberFormatPropTypes = { localeMatcher: localeMatcher, style: oneOf(['decimal', 'currency', 'percent']), currency: string, currencyDisplay: oneOf(['symbol', 'code', 'name']), useGrouping: bool, minimumIntegerDigits: number, minimumFractionDigits: number, maximumFractionDigits: number, minimumSignificantDigits: number, maximumSignificantDigits: number }; var relativeFormatPropTypes = { style: oneOf(['best fit', 'numeric']), units: oneOf(['second', 'minute', 'hour', 'day', 'month', 'year', 'second-short', 'minute-short', 'hour-short', 'day-short', 'month-short', 'year-short']) }; var pluralFormatPropTypes = { style: oneOf(['cardinal', 'ordinal']) }; /* HTML escaping and shallow-equals implementations are the same as React's (on purpose.) Therefore, it has the following Copyright and Licensing: Copyright 2013-2014, Facebook, Inc. All rights reserved. This source code is licensed under the BSD-style license found in the LICENSE file in the root directory of React's source tree. */ var intlConfigPropNames = Object.keys(intlConfigPropTypes); var ESCAPED_CHARS = { '&': '&', '>': '>', '<': '<', '"': '"', "'": ''' }; var UNSAFE_CHARS_REGEX = /[&><"']/g; function escape(str) { return ('' + str).replace(UNSAFE_CHARS_REGEX, function (match) { return ESCAPED_CHARS[match]; }); } function filterProps(props, whitelist) { var defaults$$1 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; return whitelist.reduce(function (filtered, name) { if (props.hasOwnProperty(name)) { filtered[name] = props[name]; } else if (defaults$$1.hasOwnProperty(name)) { filtered[name] = defaults$$1[name]; } return filtered; }, {}); } function invariantIntlContext() { var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, intl = _ref.intl; invariant(intl, '[React Intl] Could not find required `intl` object. ' + '<IntlProvider> needs to exist in the component ancestry.'); } function shallowEquals(objA, objB) { if (objA === objB) { return true; } if ((typeof objA === 'undefined' ? 'undefined' : _typeof(objA)) !== 'object' || objA === null || (typeof objB === 'undefined' ? 'undefined' : _typeof(objB)) !== 'object' || objB === null) { return false; } var keysA = Object.keys(objA); var keysB = Object.keys(objB); if (keysA.length !== keysB.length) { return false; } // Test for A's keys different from B. var bHasOwnProperty = Object.prototype.hasOwnProperty.bind(objB); for (var i = 0; i < keysA.length; i++) { if (!bHasOwnProperty(keysA[i]) || objA[keysA[i]] !== objB[keysA[i]]) { return false; } } return true; } function shouldIntlComponentUpdate(_ref2, nextProps, nextState) { var props = _ref2.props, state = _ref2.state, _ref2$context = _ref2.context, context = _ref2$context === undefined ? {} : _ref2$context; var nextContext = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; var _context$intl = context.intl, intl = _context$intl === undefined ? {} : _context$intl; var _nextContext$intl = nextContext.intl, nextIntl = _nextContext$intl === undefined ? {} : _nextContext$intl; return !shallowEquals(nextProps, props) || !shallowEquals(nextState, state) || !(nextIntl === intl || shallowEquals(filterProps(nextIntl, intlConfigPropNames), filterProps(intl, intlConfigPropNames))); } function createError(message, exception) { var eMsg = exception ? '\n' + exception : ''; return '[React Intl] ' + message + eMsg; } function defaultErrorHandler(error) { if (process.env.NODE_ENV !== 'production') { console.error(error); } } /* * Copyright 2015, Yahoo Inc. * Copyrights licensed under the New BSD License. * See the accompanying LICENSE file for terms. */ // Inspired by react-redux's `connect()` HOC factory function implementation: // https://github.com/rackt/react-redux function getDisplayName(Component$$1) { return Component$$1.displayName || Component$$1.name || 'Component'; } function injectIntl(WrappedComponent) { var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; var _options$intlPropName = options.intlPropName, intlPropName = _options$intlPropName === undefined ? 'intl' : _options$intlPropName, _options$withRef = options.withRef, withRef = _options$withRef === undefined ? false : _options$withRef; var InjectIntl = function (_Component) { inherits(InjectIntl, _Component); function InjectIntl(props, context) { classCallCheck(this, InjectIntl); var _this = possibleConstructorReturn(this, (InjectIntl.__proto__ || Object.getPrototypeOf(InjectIntl)).call(this, props, context)); invariantIntlContext(context); return _this; } createClass(InjectIntl, [{ key: 'getWrappedInstance', value: function getWrappedInstance() { invariant(withRef, '[React Intl] To access the wrapped instance, ' + 'the `{withRef: true}` option must be set when calling: ' + '`injectIntl()`'); return this._wrappedInstance; } }, { key: 'render', value: function render() { var _this2 = this; return React.createElement(WrappedComponent, _extends({}, this.props, defineProperty({}, intlPropName, this.context.intl), { ref: withRef ? /* istanbul ignore next */function (ref) { return _this2._wrappedInstance = ref; } : null })); } }]); return InjectIntl; }(Component); InjectIntl.displayName = 'InjectIntl(' + getDisplayName(WrappedComponent) + ')'; InjectIntl.contextTypes = { intl: intlShape }; InjectIntl.WrappedComponent = WrappedComponent; return hoistNonReactStatics(InjectIntl, WrappedComponent); } /* * Copyright 2015, Yahoo Inc. * Copyrights licensed under the New BSD License. * See the accompanying LICENSE file for terms. */ function defineMessages(messageDescriptors) { // This simply returns what's passed-in because it's meant to be a hook for // babel-plugin-react-intl. return messageDescriptors; } /* * Copyright 2015, Yahoo Inc. * Copyrights licensed under the New BSD License. * See the accompanying LICENSE file for terms. */ // This is a "hack" until a proper `intl-pluralformat` package is created. function resolveLocale(locales) { // IntlMessageFormat#_resolveLocale() does not depend on `this`. return IntlMessageFormat.prototype._resolveLocale(locales); } function findPluralFunction(locale) { // IntlMessageFormat#_findPluralFunction() does not depend on `this`. return IntlMessageFormat.prototype._findPluralRuleFunction(locale); } var IntlPluralFormat = function IntlPluralFormat(locales) { var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; classCallCheck(this, IntlPluralFormat); var useOrdinal = options.style === 'ordinal'; var pluralFn = findPluralFunction(resolveLocale(locales)); this.format = function (value) { return pluralFn(value, useOrdinal); }; }; /* * Copyright 2015, Yahoo Inc. * Copyrights licensed under the New BSD License. * See the accompanying LICENSE file for terms. */ var DATE_TIME_FORMAT_OPTIONS = Object.keys(dateTimeFormatPropTypes); var NUMBER_FORMAT_OPTIONS = Object.keys(numberFormatPropTypes); var RELATIVE_FORMAT_OPTIONS = Object.keys(relativeFormatPropTypes); var PLURAL_FORMAT_OPTIONS = Object.keys(pluralFormatPropTypes); var RELATIVE_FORMAT_THRESHOLDS = { second: 60, // seconds to minute minute: 60, // minutes to hour hour: 24, // hours to day day: 30, // days to month month: 12 }; function updateRelativeFormatThresholds(newThresholds) { var thresholds = IntlRelativeFormat.thresholds; thresholds.second = newThresholds.second; thresholds.minute = newThresholds.minute; thresholds.hour = newThresholds.hour; thresholds.day = newThresholds.day; thresholds.month = newThresholds.month; thresholds['second-short'] = newThresholds['second-short']; thresholds['minute-short'] = newThresholds['minute-short']; thresholds['hour-short'] = newThresholds['hour-short']; thresholds['day-short'] = newThresholds['day-short']; thresholds['month-short'] = newThresholds['month-short']; } function getNamedFormat(formats, type, name, onError) { var format = formats && formats[type] && formats[type][name]; if (format) { return format; } onError(createError('No ' + type + ' format named: ' + name)); } function formatDate(config, state, value) { var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; var locale = config.locale, formats = config.formats, timeZone = config.timeZone; var format = options.format; var onError = config.onError || defaultErrorHandler; var date = new Date(value); var defaults$$1 = _extends({}, timeZone && { timeZone: timeZone }, format && getNamedFormat(formats, 'date', format, onError)); var filteredOptions = filterProps(options, DATE_TIME_FORMAT_OPTIONS, defaults$$1); try { return state.getDateTimeFormat(locale, filteredOptions).format(date); } catch (e) { onError(createError('Error formatting date.', e)); } return String(date); } function formatTime(config, state, value) { var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; var locale = config.locale, formats = config.formats, timeZone = config.timeZone; var format = options.format; var onError = config.onError || defaultErrorHandler; var date = new Date(value); var defaults$$1 = _extends({}, timeZone && { timeZone: timeZone }, format && getNamedFormat(formats, 'time', format, onError)); var filteredOptions = filterProps(options, DATE_TIME_FORMAT_OPTIONS, defaults$$1); if (!filteredOptions.hour && !filteredOptions.minute && !filteredOptions.second) { // Add default formatting options if hour, minute, or second isn't defined. filteredOptions = _extends({}, filteredOptions, { hour: 'numeric', minute: 'numeric' }); } try { return state.getDateTimeFormat(locale, filteredOptions).format(date); } catch (e) { onError(createError('Error formatting time.', e)); } return String(date); } function formatRelative(config, state, value) { var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; var locale = config.locale, formats = config.formats; var format = options.format; var onError = config.onError || defaultErrorHandler; var date = new Date(value); var now = new Date(options.now); var defaults$$1 = format && getNamedFormat(formats, 'relative', format, onError); var filteredOptions = filterProps(options, RELATIVE_FORMAT_OPTIONS, defaults$$1); // Capture the current threshold values, then temporarily override them with // specific values just for this render. var oldThresholds = _extends({}, IntlRelativeFormat.thresholds); updateRelativeFormatThresholds(RELATIVE_FORMAT_THRESHOLDS); try { return state.getRelativeFormat(locale, filteredOptions).format(date, { now: isFinite(now) ? now : state.now() }); } catch (e) { onError(createError('Error formatting relative time.', e)); } finally { updateRelativeFormatThresholds(oldThresholds); } return String(date); } function formatNumber(config, state, value) { var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; var locale = config.locale, formats = config.formats; var format = options.format; var onError = config.onError || defaultErrorHandler; var defaults$$1 = format && getNamedFormat(formats, 'number', format, onError); var filteredOptions = filterProps(options, NUMBER_FORMAT_OPTIONS, defaults$$1); try { return state.getNumberFormat(locale, filteredOptions).format(value); } catch (e) { onError(createError('Error formatting number.', e)); } return String(value); } function formatPlural(config, state, value) { var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; var locale = config.locale; var filteredOptions = filterProps(options, PLURAL_FORMAT_OPTIONS); var onError = config.onError || defaultErrorHandler; try { return state.getPluralFormat(locale, filteredOptions).format(value); } catch (e) { onError(createError('Error formatting plural.', e)); } return 'other'; } function formatMessage(config, state) { var messageDescriptor = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; var values = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; var locale = config.locale, formats = config.formats, messages = config.messages, defaultLocale = config.defaultLocale, defaultFormats = config.defaultFormats; var id = messageDescriptor.id, defaultMessage = messageDescriptor.defaultMessage; // Produce a better error if the user calls `intl.formatMessage(element)` if (process.env.NODE_ENV !== 'production') { invariant(!isValidElement(config), '[React Intl] Don\'t pass React elements to ' + 'formatMessage(), pass `.props`.'); } // `id` is a required field of a Message Descriptor. invariant(id, '[React Intl] An `id` must be provided to format a message.'); var message = messages && messages[id]; var hasValues = Object.keys(values).length > 0; // Avoid expensive message formatting for simple messages without values. In // development messages will always be formatted in case of missing values. if (!hasValues && process.env.NODE_ENV === 'production') { return message || defaultMessage || id; } var formattedMessage = void 0; var onError = config.onError || defaultErrorHandler; if (message) { try { var formatter = state.getMessageFormat(message, locale, formats); formattedMessage = formatter.format(values); } catch (e) { onError(createError('Error formatting message: "' + id + '" for locale: "' + locale + '"' + (defaultMessage ? ', using default message as fallback.' : ''), e)); } } else { // This prevents warnings from littering the console in development // when no `messages` are passed into the <IntlProvider> for the // default locale, and a default message is in the source. if (!defaultMessage || locale && locale.toLowerCase() !== defaultLocale.toLowerCase()) { onError(createError('Missing message: "' + id + '" for locale: "' + locale + '"' + (defaultMessage ? ', using default message as fallback.' : ''))); } } if (!formattedMessage && defaultMessage) { try { var _formatter = state.getMessageFormat(defaultMessage, defaultLocale, defaultFormats); formattedMessage = _formatter.format(values); } catch (e) { onError(createError('Error formatting the default message for: "' + id + '"', e)); } } if (!formattedMessage) { onError(createError('Cannot format message: "' + id + '", ' + ('using message ' + (message || defaultMessage ? 'source' : 'id') + ' as fallback.'))); } return formattedMessage || message || defaultMessage || id; } function formatHTMLMessage(config, state, messageDescriptor) { var rawValues = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; // Process all the values before they are used when formatting the ICU // Message string. Since the formatted message might be injected via // `innerHTML`, all String-based values need to be HTML-escaped. var escapedValues = Object.keys(rawValues).reduce(function (escaped, name) { var value = rawValues[name]; escaped[name] = typeof value === 'string' ? escape(value) : value; return escaped; }, {}); return formatMessage(config, state, messageDescriptor, escapedValues); } var format = Object.freeze({ formatDate: formatDate, formatTime: formatTime, formatRelative: formatRelative, formatNumber: formatNumber, formatPlural: formatPlural, formatMessage: formatMessage, formatHTMLMessage: formatHTMLMessage }); /* * Copyright 2015, Yahoo Inc. * Copyrights licensed under the New BSD License. * See the accompanying LICENSE file for terms. */ var intlConfigPropNames$1 = Object.keys(intlConfigPropTypes); var intlFormatPropNames = Object.keys(intlFormatPropTypes); // These are not a static property on the `IntlProvider` class so the intl // config values can be inherited from an <IntlProvider> ancestor. var defaultProps = { formats: {}, messages: {}, timeZone: null, textComponent: 'span', defaultLocale: 'en', defaultFormats: {}, onError: defaultErrorHandler }; var IntlProvider = function (_Component) { inherits(IntlProvider, _Component); function IntlProvider(props) { var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; classCallCheck(this, IntlProvider); var _this = possibleConstructorReturn(this, (IntlProvider.__proto__ || Object.getPrototypeOf(IntlProvider)).call(this, props, context)); invariant(typeof Intl !== 'undefined', '[React Intl] The `Intl` APIs must be available in the runtime, ' + 'and do not appear to be built-in. An `Intl` polyfill should be loaded.\n' + 'See: http://formatjs.io/guides/runtime-environments/'); var intlContext = context.intl; // Used to stabilize time when performing an initial rendering so that // all relative times use the same reference "now" time. var initialNow = void 0; if (isFinite(props.initialNow)) { initialNow = Number(props.initialNow); } else { // When an `initialNow` isn't provided via `props`, look to see an // <IntlProvider> exists in the ancestry and call its `now()` // function to propagate its value for "now". initialNow = intlContext ? intlContext.now() : Date.now(); } // Creating `Intl*` formatters is expensive. If there's a parent // `<IntlProvider>`, then its formatters will be used. Otherwise, this // memoize the `Intl*` constructors and cache them for the lifecycle of // this IntlProvider instance. var _ref = intlContext || {}, _ref$formatters = _ref.formatters, formatters = _ref$formatters === undefined ? { getDateTimeFormat: memoizeIntlConstructor(Intl.DateTimeFormat), getNumberFormat: memoizeIntlConstructor(Intl.NumberFormat), getMessageFormat: memoizeIntlConstructor(IntlMessageFormat), getRelativeFormat: memoizeIntlConstructor(IntlRelativeFormat), getPluralFormat: memoizeIntlConstructor(IntlPluralFormat) } : _ref$formatters; _this.state = _extends({}, formatters, { // Wrapper to provide stable "now" time for initial render. now: function now() { return _this._didDisplay ? Date.now() : initialNow; } }); return _this; } createClass(IntlProvider, [{ key: 'getConfig', value: function getConfig() { var intlContext = this.context.intl; // Build a whitelisted config object from `props`, defaults, and // `context.intl`, if an <IntlProvider> exists in the ancestry. var config = filterProps(this.props, intlConfigPropNames$1, intlContext); // Apply default props. This must be applied last after the props have // been resolved and inherited from any <IntlProvider> in the ancestry. // This matches how React resolves `defaultProps`. for (var propName in defaultProps) { if (config[propName] === undefined) { config[propName] = defaultProps[propName]; } } if (!hasLocaleData(config.locale)) { var _config = config, locale = _config.locale, defaultLocale = _config.defaultLocale, defaultFormats = _config.defaultFormats, onError = _config.onError; onError(createError('Missing locale data for locale: "' + locale + '". ' + ('Using default locale: "' + defaultLocale + '" as fallback.'))); // Since there's no registered locale data for `locale`, this will // fallback to the `defaultLocale` to make sure things can render. // The `messages` are overridden to the `defaultProps` empty object // to maintain referential equality across re-renders. It's assumed // each <FormattedMessage> contains a `defaultMessage` prop. config = _extends({}, config, { locale: defaultLocale, formats: defaultFormats, messages: defaultProps.messages }); } return config; } }, { key: 'getBoundFormatFns', value: function getBoundFormatFns(config, state) { return intlFormatPropNames.reduce(function (boundFormatFns, name) { boundFormatFns[name] = format[name].bind(null, config, state); return boundFormatFns; }, {}); } }, { key: 'getChildContext', value: function getChildContext() { var config = this.getConfig(); // Bind intl factories and current config to the format functions. var boundFormatFns = this.getBoundFormatFns(config, this.state); var _state = this.state, now = _state.now, formatters = objectWithoutProperties(_state, ['now']); return { intl: _extends({}, config, boundFormatFns, { formatters: formatters, now: now }) }; } }, { key: 'shouldComponentUpdate', value: function shouldComponentUpdate() { for (var _len = arguments.length, next = Array(_len), _key = 0; _key < _len; _key++) { next[_key] = arguments[_key]; } return shouldIntlComponentUpdate.apply(undefined, [this].concat(next)); } }, { key: 'componentDidMount', value: function componentDidMount() { this._didDisplay = true; } }, { key: 'render', value: function render() { return Children.only(this.props.children); } }]); return IntlProvider; }(Component); IntlProvider.displayName = 'IntlProvider'; IntlProvider.contextTypes = { intl: intlShape }; IntlProvider.childContextTypes = { intl: intlShape.isRequired }; process.env.NODE_ENV !== "production" ? IntlProvider.propTypes = _extends({}, intlConfigPropTypes, { children: PropTypes.element.isRequired, initialNow: PropTypes.any }) : void 0; /* * Copyright 2015, Yahoo Inc. * Copyrights licensed under the New BSD License. * See the accompanying LICENSE file for terms. */ var FormattedDate = function (_Component) { inherits(FormattedDate, _Component); function FormattedDate(props, context) { classCallCheck(this, FormattedDate); var _this = possibleConstructorReturn(this, (FormattedDate.__proto__ || Object.getPrototypeOf(FormattedDate)).call(this, props, context)); invariantIntlContext(context); return _this; } createClass(FormattedDate, [{ key: 'shouldComponentUpdate', value: function shouldComponentUpdate() { for (var _len = arguments.length, next = Array(_len), _key = 0; _key < _len; _key++) { next[_key] = arguments[_key]; } return shouldIntlComponentUpdate.apply(undefined, [this].concat(next)); } }, { key: 'render', value: function render() { var _context$intl = this.context.intl, formatDate = _context$intl.formatDate, Text = _context$intl.textComponent; var _props = this.props, value = _props.value, children = _props.children; var formattedDate = formatDate(value, this.props); if (typeof children === 'function') { return children(formattedDate); } return React.createElement( Text, null, formattedDate ); } }]); return FormattedDate; }(Component); FormattedDate.displayName = 'FormattedDate'; FormattedDate.contextTypes = { intl: intlShape }; process.env.NODE_ENV !== "production" ? FormattedDate.propTypes = _extends({}, dateTimeFormatPropTypes, { value: PropTypes.any.isRequired, format: PropTypes.string, children: PropTypes.func }) : void 0; /* * Copyright 2015, Yahoo Inc. * Copyrights licensed under the New BSD License. * See the accompanying LICENSE file for terms. */ var FormattedTime = function (_Component) { inherits(FormattedTime, _Component); function FormattedTime(props, context) { classCallCheck(this, FormattedTime); var _this = possibleConstructorReturn(this, (FormattedTime.__proto__ || Object.getPrototypeOf(FormattedTime)).call(this, props, context)); invariantIntlContext(context); return _this; } createClass(FormattedTime, [{ key: 'shouldComponentUpdate', value: function shouldComponentUpdate() { for (var _len = arguments.length, next = Array(_len), _key = 0; _key < _len; _key++) { next[_key] = arguments[_key]; } return shouldIntlComponentUpdate.apply(undefined, [this].concat(next)); } }, { key: 'render', value: function render() { var _context$intl = this.context.intl, formatTime = _context$intl.formatTime, Text = _context$intl.textComponent; var _props = this.props, value = _props.value, children = _props.children; var formattedTime = formatTime(value, this.props); if (typeof children === 'function') { return children(formattedTime); } return React.createElement( Text, null, formattedTime ); } }]); return FormattedTime; }(Component); FormattedTime.displayName = 'FormattedTime'; FormattedTime.contextTypes = { intl: intlShape }; process.env.NODE_ENV !== "production" ? FormattedTime.propTypes = _extends({}, dateTimeFormatPropTypes, { value: PropTypes.any.isRequired, format: PropTypes.string, children: PropTypes.func }) : void 0; /* * Copyright 2015, Yahoo Inc. * Copyrights licensed under the New BSD License. * See the accompanying LICENSE file for terms. */ var SECOND = 1000; var MINUTE = 1000 * 60; var HOUR = 1000 * 60 * 60; var DAY = 1000 * 60 * 60 * 24; // The maximum timer delay value is a 32-bit signed integer. // See: https://mdn.io/setTimeout var MAX_TIMER_DELAY = 2147483647; function selectUnits(delta) { var absDelta = Math.abs(delta); if (absDelta < MINUTE) { return 'second'; } if (absDelta < HOUR) { return 'minute'; } if (absDelta < DAY) { return 'hour'; } // The maximum scheduled delay will be measured in days since the maximum // timer delay is less than the number of milliseconds in 25 days. return 'day'; } function getUnitDelay(units) { switch (units) { case 'second': return SECOND; case 'minute': return MINUTE; case 'hour': return HOUR; case 'day': return DAY; default: return MAX_TIMER_DELAY; } } function isSameDate(a, b) { if (a === b) { return true; } var aTime = new Date(a).getTime(); var bTime = new Date(b).getTime(); return isFinite(aTime) && isFinite(bTime) && aTime === bTime; } var FormattedRelative = function (_Component) { inherits(FormattedRelative, _Component); function FormattedRelative(props, context) { classCallCheck(this, FormattedRelative); var _this = possibleConstructorReturn(this, (FormattedRelative.__proto__ || Object.getPrototypeOf(FormattedRelative)).call(this, props, context)); invariantIntlContext(context); var now = isFinite(props.initialNow) ? Number(props.initialNow) : context.intl.now(); // `now` is stored as state so that `render()` remains a function of // props + state, instead of accessing `Date.now()` inside `render()`. _this.state = { now: now }; return _this; } createClass(FormattedRelative, [{ key: 'scheduleNextUpdate', value: function scheduleNextUpdate(props, state) { var _this2 = this; // Cancel and pending update because we're scheduling a new update. clearTimeout(this._timer); var value = props.value, units = props.units, updateInterval = props.updateInterval; var time = new Date(value).getTime(); // If the `updateInterval` is falsy, including `0` or we don't have a // valid date, then auto updates have been turned off, so we bail and // skip scheduling an update. if (!updateInterval || !isFinite(time)) { return; } var delta = time - state.now; var unitDelay = getUnitDelay(units || selectUnits(delta)); var unitRemainder = Math.abs(delta % unitDelay); // We want the largest possible timer delay which will still display // accurate information while reducing unnecessary re-renders. The delay // should be until the next "interesting" moment, like a tick from // "1 minute ago" to "2 minutes ago" when the delta is 120,000ms. var delay = delta < 0 ? Math.max(updateInterval, unitDelay - unitRemainder) : Math.max(updateInterval, unitRemainder); this._timer = setTimeout(function () { _this2.setState({ now: _this2.context.intl.now() }); }, delay); } }, { key: 'componentDidMount', value: function componentDidMount() { this.scheduleNextUpdate(this.props, this.state); } }, { key: 'componentWillReceiveProps', value: function componentWillReceiveProps(_ref) { var nextValue = _ref.value; // When the `props.value` date changes, `state.now` needs to be updated, // and the next update can be rescheduled. if (!isSameDate(nextValue, this.props.value)) { this.setState({ now: this.context.intl.now() }); } } }, { key: 'shouldComponentUpdate', value: function shouldComponentUpdate() { for (var _len = arguments.length, next = Array(_len), _key = 0; _key < _len; _key++) { next[_key] = arguments[_key]; } return shouldIntlComponentUpdate.apply(undefined, [this].concat(next)); } }, { key: 'componentWillUpdate', value: function componentWillUpdate(nextProps, nextState) { this.scheduleNextUpdate(nextProps, nextState); } }, { key: 'componentWillUnmount', value: function componentWillUnmount() { clearTimeout(this._timer); } }, { key: 'render', value: function render() { var _context$intl = this.context.intl, formatRelative = _context$intl.formatRelative, Text = _context$intl.textComponent; var _props = this.props, value = _props.value, children = _props.children; var formattedRelative = formatRelative(value, _extends({}, this.props, this.state)); if (typeof children === 'function') { return children(formattedRelative); } return React.createElement( Text, null, formattedRelative ); } }]); return FormattedRelative; }(Component); FormattedRelative.displayName = 'FormattedRelative'; FormattedRelative.contextTypes = { intl: intlShape }; FormattedRelative.defaultProps = { updateInterval: 1000 * 10 }; process.env.NODE_ENV !== "production" ? FormattedRelative.propTypes = _extends({}, relativeFormatPropTypes, { value: PropTypes.any.isRequired, format: PropTypes.string, updateInterval: PropTypes.number, initialNow: PropTypes.any, children: PropTypes.func }) : void 0; /* * Copyright 2015, Yahoo Inc. * Copyrights licensed under the New BSD License. * See the accompanying LICENSE file for terms. */ var FormattedNumber = function (_Component) { inherits(FormattedNumber, _Component); function FormattedNumber(props, context) { classCallCheck(this, FormattedNumber); var _this = possibleConstructorReturn(this, (FormattedNumber.__proto__ || Object.getPrototypeOf(FormattedNumber)).call(this, props, context)); invariantIntlContext(context); return _this; } createClass(FormattedNumber, [{ key: 'shouldComponentUpdate', value: function shouldComponentUpdate() { for (var _len = arguments.length, next = Array(_len), _key = 0; _key < _len; _key++) { next[_key] = arguments[_key]; } return shouldIntlComponentUpdate.apply(undefined, [this].concat(next)); } }, { key: 'render', value: function render() { var _context$intl = this.context.intl, formatNumber = _context$intl.formatNumber, Text = _context$intl.textComponent; var _props = this.props, value = _props.value, children = _props.children; var formattedNumber = formatNumber(value, this.props); if (typeof children === 'function') { return children(formattedNumber); } return React.createElement( Text, null, formattedNumber ); } }]); return FormattedNumber; }(Component); FormattedNumber.displayName = 'FormattedNumber'; FormattedNumber.contextTypes = { intl: intlShape }; process.env.NODE_ENV !== "production" ? FormattedNumber.propTypes = _extends({}, numberFormatPropTypes, { value: PropTypes.any.isRequired, format: PropTypes.string, children: PropTypes.func }) : void 0; /* * Copyright 2015, Yahoo Inc. * Copyrights licensed under the New BSD License. * See the accompanying LICENSE file for terms. */ var FormattedPlural = function (_Component) { inherits(FormattedPlural, _Component); function FormattedPlural(props, context) { classCallCheck(this, FormattedPlural); var _this = possibleConstructorReturn(this, (FormattedPlural.__proto__ || Object.getPrototypeOf(FormattedPlural)).call(this, props, context)); invariantIntlContext(context); return _this; } createClass(FormattedPlural, [{ key: 'shouldComponentUpdate', value: function shouldComponentUpdate() { for (var _len = arguments.length, next = Array(_len), _key = 0; _key < _len; _key++) { next[_key] = arguments[_key]; } return shouldIntlComponentUpdate.apply(undefined, [this].concat(next)); } }, { key: 'render', value: function render() { var _context$intl = this.context.intl, formatPlural = _context$intl.formatPlural, Text = _context$intl.textComponent; var _props = this.props, value = _props.value, other = _props.other, children = _props.children; var pluralCategory = formatPlural(value, this.props); var formattedPlural = this.props[pluralCategory] || other; if (typeof children === 'function') { return children(formattedPlural); } return React.createElement( Text, null, formattedPlural ); } }]); return FormattedPlural; }(Component); FormattedPlural.displayName = 'FormattedPlural'; FormattedPlural.contextTypes = { intl: intlShape }; FormattedPlural.defaultProps = { style: 'cardinal' }; process.env.NODE_ENV !== "production" ? FormattedPlural.propTypes = _extends({}, pluralFormatPropTypes, { value: PropTypes.any.isRequired, other: PropTypes.node.isRequired, zero: PropTypes.node, one: PropTypes.node, two: PropTypes.node, few: PropTypes.node, many: PropTypes.node, children: PropTypes.func }) : void 0; /* * Copyright 2015, Yahoo Inc. * Copyrights licensed under the New BSD License. * See the accompanying LICENSE file for terms. */ var defaultFormatMessage = function defaultFormatMessage(descriptor, values) { if (process.env.NODE_ENV !== 'production') { console.error('[React Intl] Could not find required `intl` object. <IntlProvider> needs to exist in the component ancestry. Using default message as fallback.'); } return formatMessage({}, { getMessageFormat: memoizeIntlConstructor(IntlMessageFormat) }, descriptor, values); }; var FormattedMessage = function (_Component) { inherits(FormattedMessage, _Component); function FormattedMessage(props, context) { classCallCheck(this, FormattedMessage); var _this = possibleConstructorReturn(this, (FormattedMessage.__proto__ || Object.getPrototypeOf(FormattedMessage)).call(this, props, context)); if (!props.defaultMessage) { invariantIntlContext(context); } return _this; } createClass(FormattedMessage, [{ key: 'shouldComponentUpdate', value: function shouldComponentUpdate(nextProps) { var values = this.props.values; var nextValues = nextProps.values; if (!shallowEquals(nextValues, values)) { return true; } // Since `values` has already been checked, we know they're not // different, so the current `values` are carried over so the shallow // equals comparison on the other props isn't affected by the `values`. var nextPropsToCheck = _extends({}, nextProps, { values: values }); for (var _len = arguments.length, next = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { next[_key - 1] = arguments[_key]; } return shouldIntlComponentUpdate.apply(undefined, [this, nextPropsToCheck].concat(next)); } }, { key: 'render', value: function render() { var _ref = this.context.intl || {}, _ref$formatMessage = _ref.formatMessage, formatMessage$$1 = _ref$formatMessage === undefined ? defaultFormatMessage : _ref$formatMessage, _ref$textComponent = _ref.textComponent, Text = _ref$textComponent === undefined ? 'span' : _ref$textComponent; var _props = this.props, id = _props.id, description = _props.description, defaultMessage = _props.defaultMessage, values = _props.values, _props$tagName = _props.tagName, Component$$1 = _props$tagName === undefined ? Text : _props$tagName, children = _props.children; var tokenDelimiter = void 0; var tokenizedValues = void 0; var elements = void 0; var hasValues = values && Object.keys(values).length > 0; if (hasValues) { // Creates a token with a random UID that should not be guessable or // conflict with other parts of the `message` string. var uid = Math.floor(Math.random() * 0x10000000000).toString(16); var generateToken = function () { var counter = 0; return function () { return 'ELEMENT-' + uid + '-' + (counter += 1); }; }(); // Splitting with a delimiter to support IE8. When using a regex // with a capture group IE8 does not include the capture group in // the resulting array. tokenDelimiter = '@__' + uid + '__@'; tokenizedValues = {}; elements = {}; // Iterates over the `props` to keep track of any React Element // values so they can be represented by the `token` as a placeholder // when the `message` is formatted. This allows the formatted // message to then be broken-up into parts with references to the // React Elements inserted back in. Object.keys(values).forEach(function (name) { var value = values[name]; if (isValidElement(value)) { var token = generateToken(); tokenizedValues[name] = tokenDelimiter + token + tokenDelimiter; elements[token] = value; } else { tokenizedValues[name] = value; } }); } var descriptor = { id: id, description: description, defaultMessage: defaultMessage }; var formattedMessage = formatMessage$$1(descriptor, tokenizedValues || values); var nodes = void 0; var hasElements = elements && Object.keys(elements).length > 0; if (hasElements) { // Split the message into parts so the React Element values captured // above can be inserted back into the rendered message. This // approach allows messages to render with React Elements while // keeping React's virtual diffing working properly. nodes = formattedMessage.split(tokenDelimiter).filter(function (part) { return !!part; }).map(function (part) { return elements[part] || part; }); } else { nodes = [formattedMessage]; } if (typeof children === 'function') { return children.apply(undefined, toConsumableArray(nodes)); } // Needs to use `createElement()` instead of JSX, otherwise React will // warn about a missing `key` prop with rich-text message formatting. return createElement.apply(undefined, [Component$$1, null].concat(toConsumableArray(nodes))); } }]); return FormattedMessage; }(Component); FormattedMessage.displayName = 'FormattedMessage'; FormattedMessage.contextTypes = { intl: intlShape }; FormattedMessage.defaultProps = { values: {} }; process.env.NODE_ENV !== "production" ? FormattedMessage.propTypes = _extends({}, messageDescriptorPropTypes, { values: PropTypes.object, tagName: PropTypes.oneOfType([PropTypes.string, PropTypes.element]), children: PropTypes.func }) : void 0; /* * Copyright 2015, Yahoo Inc. * Copyrights licensed under the New BSD License. * See the accompanying LICENSE file for terms. */ var FormattedHTMLMessage = function (_Component) { inherits(FormattedHTMLMessage, _Component); function FormattedHTMLMessage(props, context) { classCallCheck(this, FormattedHTMLMessage); var _this = possibleConstructorReturn(this, (FormattedHTMLMessage.__proto__ || Object.getPrototypeOf(FormattedHTMLMessage)).call(this, props, context)); invariantIntlContext(context); return _this; } createClass(FormattedHTMLMessage, [{ key: 'shouldComponentUpdate', value: function shouldComponentUpdate(nextProps) { var values = this.props.values; var nextValues = nextProps.values; if (!shallowEquals(nextValues, values)) { return true; } // Since `values` has already been checked, we know they're not // different, so the current `values` are carried over so the shallow // equals comparison on the other props isn't affected by the `values`. var nextPropsToCheck = _extends({}, nextProps, { values: values }); for (var _len = arguments.length, next = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { next[_key - 1] = arguments[_key]; } return shouldIntlComponentUpdate.apply(undefined, [this, nextPropsToCheck].concat(next)); } }, { key: 'render', value: function render() { var _context$intl = this.context.intl, formatHTMLMessage = _context$intl.formatHTMLMessage, Text = _context$intl.textComponent; var _props = this.props, id = _props.id, description = _props.description, defaultMessage = _props.defaultMessage, rawValues = _props.values, _props$tagName = _props.tagName, Component$$1 = _props$tagName === undefined ? Text : _props$tagName, children = _props.children; var descriptor = { id: id, description: description, defaultMessage: defaultMessage }; var formattedHTMLMessage = formatHTMLMessage(descriptor, rawValues); if (typeof children === 'function') { return children(formattedHTMLMessage); } // Since the message presumably has HTML in it, we need to set // `innerHTML` in order for it to be rendered and not escaped by React. // To be safe, all string prop values were escaped when formatting the // message. It is assumed that the message is not UGC, and came from the // developer making it more like a template. // // Note: There's a perf impact of using this component since there's no // way for React to do its virtual DOM diffing. var html = { __html: formattedHTMLMessage }; return React.createElement(Component$$1, { dangerouslySetInnerHTML: html }); } }]); return FormattedHTMLMessage; }(Component); FormattedHTMLMessage.displayName = 'FormattedHTMLMessage'; FormattedHTMLMessage.contextTypes = { intl: intlShape }; FormattedHTMLMessage.defaultProps = { values: {} }; process.env.NODE_ENV !== "production" ? FormattedHTMLMessage.propTypes = _extends({}, messageDescriptorPropTypes, { values: PropTypes.object, tagName: PropTypes.string, children: PropTypes.func }) : void 0; /* * Copyright 2015, Yahoo Inc. * Copyrights licensed under the New BSD License. * See the accompanying LICENSE file for terms. */ addLocaleData(defaultLocaleData); /* * Copyright 2015, Yahoo Inc. * Copyrights licensed under the New BSD License. * See the accompanying LICENSE file for terms. */ addLocaleData(allLocaleData); export { addLocaleData, intlShape, injectIntl, defineMessages, IntlProvider, FormattedDate, FormattedTime, FormattedRelative, FormattedNumber, FormattedPlural, FormattedMessage, FormattedHTMLMessage };