Use store

This commit is contained in:
Lim Chee Aun 2024-08-25 17:53:38 +08:00
parent c3eb33e230
commit fe5ec917da

View file

@ -4,6 +4,7 @@ import { useMemo } from 'preact/hooks';
import { CATALOGS, DEFAULT_LANG, DEV_LOCALES, LOCALES } from '../locales'; import { CATALOGS, DEFAULT_LANG, DEV_LOCALES, LOCALES } from '../locales';
import { activateLang } from '../utils/lang'; import { activateLang } from '../utils/lang';
import localeCode2Text from '../utils/localeCode2Text'; import localeCode2Text from '../utils/localeCode2Text';
import store from '../utils/store';
const regionMaps = { const regionMaps = {
'zh-CN': 'zh-Hans', 'zh-CN': 'zh-Hans',
@ -58,7 +59,7 @@ export default function LangSelector() {
class="small" class="small"
value={i18n.locale || DEFAULT_LANG} value={i18n.locale || DEFAULT_LANG}
onChange={(e) => { onChange={(e) => {
localStorage.setItem('lang', e.target.value); store.local.set('lang', e.target.value);
activateLang(e.target.value); activateLang(e.target.value);
}} }}
> >