fix: backward compat

This commit is contained in:
Methapon Metanipat 2024-11-25 09:03:22 +07:00
parent 972f6ba13e
commit 4f3d39bf59

View file

@ -51,7 +51,13 @@ export enum Lang {
export function initLang(): Lang {
const { locale } = i18n.global;
const current = localStorage.getItem('currentLanguage') as Lang | null;
if (locale.value !== Lang.English && locale.value !== Lang.Thai) {
return setLang(Lang.Thai);
}
if (!current) return setLang(locale.value as Lang);
return setLang(current);
}