class t{locale;locales;context;constructor(t){this.locale="",this.locales=t||{}}setLocale(t){this.locale=t}getLocale(){return this.locale}loadTranslations(t){return this.locales=t,this.context&&this.effect(this.context)}mergeTranslations(t){for(const e in t)this.locales[e]?this.locales[e]={...this.locales[e],...t[e]}:this.locales[e]=t[e];return this.context&&this.effect(this.context)}getLanguage(){return this.locales[this.locale]}effect(t){if(this.context=t,t.setData)return new Promise((e=>{t.setData({$language:this.getLanguage()},(()=>{e(t.$language)}))}))}toggleLanguage(t){return this.setLocale(t),this.effect(this.context)}}const e=new t;export{t as I18n,e as default,e as i18nInstance};