export var FormatType;
(function (FormatType) {
    FormatType["currency"] = "currency";
    FormatType["number"] = "number";
})(FormatType || (FormatType = {}));
/** @experimental */
export class I18nFormatter {
    constructor(locale = 'en-US') {
        this.locale = locale;
        this.formatters = {
            currency: {},
            number: {}
        };
        Object.keys(FormatType).map((t) => this.createFormatter(t, this.locale));
    }
    number(value, locale = this.locale) {
        const formatter = this.getFormatter(FormatType.number, locale);
        return formatter(value);
    }
    createFormatter(type, locale) {
        let formatter;
        switch (type) {
            case FormatType.currency:
                formatter = Intl.NumberFormat(locale, { style: 'currency', currency: 'USD' }).format;
                break;
            case FormatType.number:
                formatter = Intl.NumberFormat(locale).format;
                break;
        }
        this.formatters[type][locale] = formatter;
        return formatter;
    }
    getFormatter(type, locale) {
        return this.formatters[type][locale] ? this.formatters[type][locale] : this.createFormatter(type, locale);
    }
}
export const defaultFormatter = new I18nFormatter();
