fix: 🐛 修復 i18n 無法套用語言變體

修復 i18n 無法正確使用語言變體,轉而使用最靠近的語系翻譯
This commit is contained in:
noeFly
2025-02-12 21:29:18 +08:00
parent 1c2ba4942f
commit 8df49a195d
4 changed files with 23 additions and 36 deletions

View File

@@ -8,12 +8,7 @@ import {
import { useUser } from '@clerk/nextjs'
import { useRouter } from 'next/router'
import { createContext, useContext, useEffect, useState } from 'react'
import {
generateLocaleDict,
initLocale,
redirectUserLang,
saveLangToLocalStorage
} from './lang'
import { generateLocaleDict, initLocale, redirectUserLang } from './lang'
/**
* 全局上下文
@@ -81,7 +76,6 @@ export function GlobalContextProvider(props) {
function changeLang(lang) {
if (lang) {
saveLangToLocalStorage(lang)
updateLang(lang)
updateLocale(generateLocaleDict(lang))
}