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

@@ -1,6 +1,6 @@
import { idToUuid } from 'notion-utils'
import { checkStrIsNotionId, getLastPartOfUrl, isBrowser } from '../utils'
import { loadLangFromLocalStorage } from '@/lib/lang'
import { getCurrentLang } from '@/lib/lang'
/**
* 处理页面内连接跳转:
@@ -21,7 +21,7 @@ export const convertInnerUrl = allPages => {
const { origin, pathname } = window.location;
const currentURL = origin + pathname
const currentPathLang = pathname.split('/').filter(Boolean)[0]
const lang = loadLangFromLocalStorage().split(/[-_]/)[0]
const lang = getCurrentLang
const langPrefix = lang === currentPathLang ? '/' + lang : ''
for (const anchorTag of allAnchorTags) {
// url替换成slug