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

@@ -15,7 +15,7 @@ const themes = scanSubdirectories(path.resolve(__dirname, 'themes'))
const locales = (function () {
// 根据BLOG_NOTION_PAGE_ID 检查支持多少种语言数据.
// 支持如下格式配置多个语言的页面id xxx,zh:xxx,en:xxx
const langs = [BLOG.LANG.slice(0, 2)]
const langs = [BLOG.LANG]
if (BLOG.NOTION_PAGE_ID.indexOf(',') > 0) {
const siteIds = BLOG.NOTION_PAGE_ID.split(',')
for (let index = 0; index < siteIds.length; index++) {
@@ -84,15 +84,19 @@ const nextConfig = {
eslint: {
ignoreDuringBuilds: true
},
output: process.env.EXPORT ? 'export' : process.env.NEXT_BUILD_STANDALONE === 'true' ? 'standalone' : undefined,
output: process.env.EXPORT
? 'export'
: process.env.NEXT_BUILD_STANDALONE === 'true'
? 'standalone'
: undefined,
staticPageGenerationTimeout: 120,
// 多语言, 在export时禁用
i18n: process.env.EXPORT
? undefined
: {
defaultLocale: BLOG.LANG.slice(0, 2),
defaultLocale: BLOG.LANG,
// 支持的所有多语言,按需填写即可
locales
locales: locales
},
images: {
// 图片压缩