import { isNullish } from "remeda";
import { translateMap } from "./i18nData.js";
class Intl {
    static instance;
    translateMap = translateMap;
    locale = 'zh-CN';
    canTranslate = (value)=>!!this.translateMap[value];
    i18n = (segments, ...values)=>{
        const text = segments.map((segment, index)=>segment + (values[index] || '')).join('');
        const translatedText = this.translateMap?.[text]?.[this.locale];
        if (isNullish(translatedText)) return text;
        return translatedText;
    };
    setLocale = (locale)=>{
        this.locale = locale;
    };
    getLocale = ()=>this.locale;
    static getInstance() {
        if (!Intl.instance) Intl.instance = new Intl();
        return Intl.instance;
    }
}
const intl = Intl.getInstance();
export { intl };

//# sourceMappingURL=i18n.js.map