Skip to content

Commit

Permalink
修复刷新页面时的语言切换
Browse files Browse the repository at this point in the history
  • Loading branch information
tangly1024 committed Jan 9, 2024
1 parent b56dc81 commit 4479f36
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/global.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { generateLocaleDict, initLocale } from './lang'
import { generateLocaleDict, initLocale, saveLangToCookies } from './lang'
import { createContext, useContext, useEffect, useState } from 'react'
import { useRouter } from 'next/router'
import { THEMES, initDarkMode, saveDarkModeToCookies } from '@/themes/theme'
Expand Down Expand Up @@ -49,6 +49,7 @@ export function GlobalContextProvider(props) {
*/
function changeLang(lang) {
if (lang) {
saveLangToCookies(lang)
updateLang(lang)
updateLocale(generateLocaleDict(lang))
}
Expand Down

0 comments on commit 4479f36

Please sign in to comment.