mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-03-14 01:48:50 +01:00
Use store
This commit is contained in:
parent
c3eb33e230
commit
fe5ec917da
1 changed files with 2 additions and 1 deletions
|
@ -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);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
|
Loading…
Reference in a new issue