From ab9bb91f52484971e2b4138c5031b25a3d92be06 Mon Sep 17 00:00:00 2001 From: radishzzz Date: Mon, 26 May 2025 00:25:46 +0100 Subject: [PATCH] chore: fix waline language switching exceptions, remove unused global variables, update theme guide --- src/components/Comments/Waline.astro | 44 +++++++++---------- src/content/posts/guides/Theme Guide-es.md | 2 +- src/content/posts/guides/Theme Guide-ja.md | 2 +- src/content/posts/guides/Theme Guide-ru.md | 2 +- src/content/posts/guides/Theme Guide-zh-tw.md | 2 +- src/content/posts/guides/Theme Guide-zh.md | 2 +- src/i18n/config.ts | 14 +++--- src/pages/[...posts_slug].astro | 2 +- src/styles/global.css | 5 --- 9 files changed, 33 insertions(+), 42 deletions(-) diff --git a/src/components/Comments/Waline.astro b/src/components/Comments/Waline.astro index 1fd6b72..cf2ce7c 100644 --- a/src/components/Comments/Waline.astro +++ b/src/components/Comments/Waline.astro @@ -2,18 +2,6 @@ import { defaultLocale, themeConfig } from '@/config' import { walineLocaleMap } from '@/i18n/config' -// Get the language code of Waline -function getWalineLang(currentPath: string, defaultLocale: string): string { - // Extract language code from path - const pathLang = Object.keys(walineLocaleMap).find(code => - currentPath.startsWith(`/${code}/`), - ) - // Return found path language or default language - const lang = pathLang || defaultLocale - return walineLocaleMap[lang as keyof typeof walineLocaleMap] -} - -const walineLang = getWalineLang(Astro.url.pathname, defaultLocale) const { waline: { serverURL = '', emoji = [], search = false, imageUploader = false } = {} } = themeConfig.comment ?? {} --- @@ -27,23 +15,31 @@ const { waline: { serverURL = '', emoji = [], search = false, imageUploader = fa