function createIntl(config, cache) {
    var formatters = utils_1.createFormatters(cache);
    var resolvedConfig = tslib_1.__assign(tslib_1.__assign({}, utils_1.DEFAULT_INTL_CONFIG), config);
    var locale = resolvedConfig.locale, defaultLocale = resolvedConfig.defaultLocale, onError = resolvedConfig.onError;
    if (!locale) {
        if (onError) {
            onError(new error_1.InvalidConfigError("\"locale\" was not configured, using \"" + defaultLocale + "\" as fallback. See https://formatjs.io/docs/react-intl/api#intlshape for more details"));
        }
        // 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.
        resolvedConfig.locale = resolvedConfig.defaultLocale || 'en';
    }
    else if (!Intl.NumberFormat.supportedLocalesOf(locale).length && onError) {
        onError(new error_1.MissingDataError("Missing locale data for locale: \"" + locale + "\" in Intl.NumberFormat. Using default locale: \"" + defaultLocale + "\" as fallback. See https://formatjs.io/docs/react-intl#runtime-requirements for more details"));
    }
    else if (!Intl.DateTimeFormat.supportedLocalesOf(locale).length &&
        onError) {
        onError(new error_1.MissingDataError("Missing locale data for locale: \"" + locale + "\" in Intl.DateTimeFormat. Using default locale: \"" + defaultLocale + "\" as fallback. See https://formatjs.io/docs/react-intl#runtime-requirements for more details"));
    }
    return tslib_1.__assign(tslib_1.__assign({}, resolvedConfig), { formatters: formatters, formatNumber: number_1.formatNumber.bind(null, resolvedConfig, formatters.getNumberFormat), formatNumberToParts: number_1.formatNumberToParts.bind(null, resolvedConfig, formatters.getNumberFormat), formatRelativeTime: relativeTime_1.formatRelativeTime.bind(null, resolvedConfig, formatters.getRelativeTimeFormat), formatDate: dateTime_1.formatDate.bind(null, resolvedConfig, formatters.getDateTimeFormat), formatDateToParts: dateTime_1.formatDateToParts.bind(null, resolvedConfig, formatters.getDateTimeFormat), formatTime: dateTime_1.formatTime.bind(null, resolvedConfig, formatters.getDateTimeFormat), formatTimeToParts: dateTime_1.formatTimeToParts.bind(null, resolvedConfig, formatters.getDateTimeFormat), formatPlural: plural_1.formatPlural.bind(null, resolvedConfig, formatters.getPluralRules), formatMessage: message_1.formatMessage.bind(null, resolvedConfig, formatters), formatList: list_1.formatList.bind(null, resolvedConfig, formatters.getListFormat), formatDisplayName: displayName_1.formatDisplayName.bind(null, resolvedConfig, formatters.getDisplayNames) });
}
/**
 * Create intl object
 * @param config intl config
 * @param cache cache for formatter instances to prevent memory leak
 */
Create intl object
@param config intl config
@param cache cache for formatter instances to prevent memory leak
Create intl object @param config intl config @param cache cache for formatter instances to prevent memory leak
function createIntl(config, cache) {
    var formatters = utils_1.createFormatters(cache);
    var resolvedConfig = tslib_1.__assign(tslib_1.__assign({}, utils_1.DEFAULT_INTL_CONFIG), config);
    var locale = resolvedConfig.locale, defaultLocale = resolvedConfig.defaultLocale, onError = resolvedConfig.onError;
    if (!locale) {
        if (onError) {
            onError(new error_1.InvalidConfigError("\"locale\" was not configured, using \"" + defaultLocale + "\" as fallback. See https://formatjs.io/docs/react-intl/api#intlshape for more details"));
        }
        resolvedConfig.locale = resolvedConfig.defaultLocale || 'en';
    }
    else if (!Intl.NumberFormat.supportedLocalesOf(locale).length && onError) {
        onError(new error_1.MissingDataError("Missing locale data for locale: \"" + locale + "\" in Intl.NumberFormat. Using default locale: \"" + defaultLocale + "\" as fallback. See https://formatjs.io/docs/react-intl#runtime-requirements for more details"));
    }
    else if (!Intl.DateTimeFormat.supportedLocalesOf(locale).length &&
        onError) {
        onError(new error_1.MissingDataError("Missing locale data for locale: \"" + locale + "\" in Intl.DateTimeFormat. Using default locale: \"" + defaultLocale + "\" as fallback. See https://formatjs.io/docs/react-intl#runtime-requirements for more details"));
    }
    return tslib_1.__assign(tslib_1.__assign({}, resolvedConfig), { formatters: formatters, formatNumber: number_1.formatNumber.bind(null, resolvedConfig, formatters.getNumberFormat), formatNumberToParts: number_1.formatNumberToParts.bind(null, resolvedConfig, formatters.getNumberFormat), formatRelativeTime: relativeTime_1.formatRelativeTime.bind(null, resolvedConfig, formatters.getRelativeTimeFormat), formatDate: dateTime_1.formatDate.bind(null, resolvedConfig, formatters.getDateTimeFormat), formatDateToParts: dateTime_1.formatDateToParts.bind(null, resolvedConfig, formatters.getDateTimeFormat), formatTime: dateTime_1.formatTime.bind(null, resolvedConfig, formatters.getDateTimeFormat), formatTimeToParts: dateTime_1.formatTimeToParts.bind(null, resolvedConfig, formatters.getDateTimeFormat), formatPlural: plural_1.formatPlural.bind(null, resolvedConfig, formatters.getPluralRules), formatMessage: message_1.formatMessage.bind(null, resolvedConfig, formatters), formatList: list_1.formatList.bind(null, resolvedConfig, formatters.getListFormat), formatDisplayName: displayName_1.formatDisplayName.bind(null, resolvedConfig, formatters.getDisplayNames) });
}
function createIntl ( config , cache ) { var formatters = utils_1 . createFormatters ( cache ) ; var resolvedConfig = tslib_1 . __assign ( tslib_1 . __assign ( { } , utils_1 . DEFAULT_INTL_CONFIG ) , config ) ; var locale = resolvedConfig . locale , defaultLocale = resolvedConfig . defaultLocale , onError = resolvedConfig . onError ; if ( ! locale ) { if ( onError ) { onError ( new error_1 . InvalidConfigError ( "\"locale\" was not configured, using \"" + defaultLocale + "\" as fallback. See https://formatjs.io/docs/react-intl/api#intlshape for more details" ) ) ; } resolvedConfig . locale = resolvedConfig . defaultLocale || 'en' ; } else if ( ! Intl . NumberFormat . supportedLocalesOf ( locale ) . length && onError ) { onError ( new error_1 . MissingDataError ( "Missing locale data for locale: \"" + locale + "\" in Intl.NumberFormat. Using default locale: \"" + defaultLocale + "\" as fallback. See https://formatjs.io/docs/react-intl#runtime-requirements for more details" ) ) ; } else if ( ! Intl . DateTimeFormat . supportedLocalesOf ( locale ) . length && onError ) { onError ( new error_1 . MissingDataError ( "Missing locale data for locale: \"" + locale + "\" in Intl.DateTimeFormat. Using default locale: \"" + defaultLocale + "\" as fallback. See https://formatjs.io/docs/react-intl#runtime-requirements for more details" ) ) ; } return tslib_1 . __assign ( tslib_1 . __assign ( { } , resolvedConfig ) , { formatters : formatters , formatNumber : number_1 . formatNumber . bind ( null , resolvedConfig , formatters . getNumberFormat ) , formatNumberToParts : number_1 . formatNumberToParts . bind ( null , resolvedConfig , formatters . getNumberFormat ) , formatRelativeTime : relativeTime_1 . formatRelativeTime . bind ( null , resolvedConfig , formatters . getRelativeTimeFormat ) , formatDate : dateTime_1 . formatDate . bind ( null , resolvedConfig , formatters . getDateTimeFormat ) , formatDateToParts : dateTime_1 . formatDateToParts . bind ( null , resolvedConfig , formatters . getDateTimeFormat ) , formatTime : dateTime_1 . formatTime . bind ( null , resolvedConfig , formatters . getDateTimeFormat ) , formatTimeToParts : dateTime_1 . formatTimeToParts . bind ( null , resolvedConfig , formatters . getDateTimeFormat ) , formatPlural : plural_1 . formatPlural . bind ( null , resolvedConfig , formatters . getPluralRules ) , formatMessage : message_1 . formatMessage . bind ( null , resolvedConfig , formatters ) , formatList : list_1 . formatList . bind ( null , resolvedConfig , formatters . getListFormat ) , formatDisplayName : displayName_1 . formatDisplayName . bind ( null , resolvedConfig , formatters . getDisplayNames ) } ) ; }
Create intl object
 @param config intl config
 @param cache cache for formatter instances to prevent memory leak
Create intl object @param config intl config @param cache cache for formatter instances to prevent memory leak
// 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.