mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-30 07:26:45 +00:00
多语言切换
This commit is contained in:
@@ -14,7 +14,8 @@ const GlobalContext = createContext()
|
||||
* @constructor
|
||||
*/
|
||||
export function GlobalContextProvider({ children }) {
|
||||
const [locale, updateLocale] = useState(generateLocaleDict('en-US'))
|
||||
const [lang, updateLang] = useState(BLOG.LANG)
|
||||
const [locale, updateLocale] = useState(generateLocaleDict(lang))
|
||||
const [isDarkMode, updateDarkMode] = useState(false)
|
||||
const [onLoading, changeLoadingState] = useState(false)
|
||||
const [theme, setTheme] = useState(BLOG.THEME)
|
||||
@@ -43,7 +44,7 @@ export function GlobalContextProvider({ children }) {
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
initLocale(locale, updateLocale)
|
||||
initLocale(lang, locale, updateLang, updateLocale)
|
||||
initDarkMode(isDarkMode, updateDarkMode)
|
||||
initTheme(theme, changeTheme)
|
||||
}, [])
|
||||
|
||||
Reference in New Issue
Block a user