From 355b044e9f717ef6424243e8ad71de9c104c68bb Mon Sep 17 00:00:00 2001 From: radishzzz Date: Sat, 15 Mar 2025 12:26:49 +0000 Subject: [PATCH] chore: change i18n example article and update i18n configuration --- pnpm-lock.yaml | 16 +- src/components/MainHeader.astro | 14 +- src/components/MobileHeader.astro | 10 +- .../{PostTime.astro => PostDate.astro} | 4 +- src/components/PostList.astro | 12 +- src/config.ts | 4 +- .../posts/example/A Tale of Two Cities-en.md | 125 ------------- .../posts/example/A Tale of Two Cities-es.md | 125 ------------- .../posts/example/A Tale of Two Cities-ru.md | 125 ------------- src/content/posts/example/Jane Eyre-en.md | 90 ---------- src/content/posts/example/Jane Eyre-es.md | 90 ---------- src/content/posts/example/Jane Eyre-ru.md | 90 ---------- .../The Murders in the Rue Morgue-en.md | 48 ----- .../The Murders in the Rue Morgue-es.md | 48 ----- .../The Murders in the Rue Morgue-ru.md | 48 ----- src/content/posts/example/容忍与自由-en.md | 67 +++++++ src/content/posts/example/容忍与自由-es.md | 67 +++++++ src/content/posts/example/容忍与自由-ja.md | 3 +- src/content/posts/example/容忍与自由-ru.md | 67 +++++++ src/content/posts/example/容忍与自由-zh-tw.md | 2 +- src/content/posts/example/容忍与自由-zh.md | 2 +- src/content/posts/example/故乡-en.md | 166 ++++++++++++++++++ src/content/posts/example/故乡-es.md | 166 ++++++++++++++++++ src/content/posts/example/故乡-ja.md | 4 +- src/content/posts/example/故乡-ru.md | 166 ++++++++++++++++++ src/content/posts/example/故乡-zh-tw.md | 5 +- src/content/posts/example/故乡-zh.md | 5 +- src/content/posts/example/羅生門-en.md | 83 +++++++++ src/content/posts/example/羅生門-es.md | 83 +++++++++ src/content/posts/example/羅生門-ja.md | 3 +- src/content/posts/example/羅生門-ru.md | 83 +++++++++ src/content/posts/example/羅生門-zh-tw.md | 2 +- src/content/posts/example/羅生門-zh.md | 2 +- src/pages/[...posts_slug].astro | 33 ++-- src/pages/[...tags].astro | 2 +- src/pages/[...tags_tag].astro | 2 +- src/styles/heti.css | 16 +- src/types/index.d.ts | 1 + 38 files changed, 1021 insertions(+), 858 deletions(-) rename src/components/{PostTime.astro => PostDate.astro} (97%) delete mode 100644 src/content/posts/example/A Tale of Two Cities-en.md delete mode 100644 src/content/posts/example/A Tale of Two Cities-es.md delete mode 100644 src/content/posts/example/A Tale of Two Cities-ru.md delete mode 100644 src/content/posts/example/Jane Eyre-en.md delete mode 100644 src/content/posts/example/Jane Eyre-es.md delete mode 100644 src/content/posts/example/Jane Eyre-ru.md delete mode 100644 src/content/posts/example/The Murders in the Rue Morgue-en.md delete mode 100644 src/content/posts/example/The Murders in the Rue Morgue-es.md delete mode 100644 src/content/posts/example/The Murders in the Rue Morgue-ru.md create mode 100644 src/content/posts/example/容忍与自由-en.md create mode 100644 src/content/posts/example/容忍与自由-es.md create mode 100644 src/content/posts/example/容忍与自由-ru.md create mode 100644 src/content/posts/example/故乡-en.md create mode 100644 src/content/posts/example/故乡-es.md create mode 100644 src/content/posts/example/故乡-ru.md create mode 100644 src/content/posts/example/羅生門-en.md create mode 100644 src/content/posts/example/羅生門-es.md create mode 100644 src/content/posts/example/羅生門-ru.md diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index a6c421b..998cf03 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1690,8 +1690,8 @@ packages: duplexer@0.1.2: resolution: {integrity: sha512-jtD6YG370ZCIi/9GTaJKQxWTZD045+4R4hTk/x1UyoqadyJ9x9CgSi1RlVDQF8U2sxLLSnFkCaMihqljHIWgMg==} - electron-to-chromium@1.5.118: - resolution: {integrity: sha512-yNDUus0iultYyVoEFLnQeei7LOQkL8wg8GQpkPCRrOlJXlcCwa6eGKZkxQ9ciHsqZyYbj8Jd94X1CTPzGm+uIA==} + electron-to-chromium@1.5.119: + resolution: {integrity: sha512-Ku4NMzUjz3e3Vweh7PhApPrZSS4fyiCIbcIrG9eKrriYVLmbMepETR/v6SU7xPm98QTqMSYiCwfO89QNjXLkbQ==} emmet@2.4.11: resolution: {integrity: sha512-23QPJB3moh/U9sT4rQzGgeyyGIrcM+GH5uVYg2C6wZIxAIJq7Ng3QLT79tl8FUwDXhyq9SusfknOrofAKqvgyQ==} @@ -3823,8 +3823,8 @@ packages: resolution: {integrity: sha512-GQHQqAopRhwU8Kt1DDM8NjibDXHC8eoh1erhGAJPEyveY9qqVeXvVikNKrDz69sHowPMorbPUrH/mx8c50eiBQ==} engines: {node: '>=18'} - zod-to-json-schema@3.24.3: - resolution: {integrity: sha512-HIAfWdYIt1sssHfYZFCXp4rU1w2r8hVVXYIlmoa0r0gABLs5di3RCqPU5DDROogVz1pAdYBaz7HK5n9pSUNs3A==} + zod-to-json-schema@3.24.4: + resolution: {integrity: sha512-0uNlcvgabyrni9Ag8Vghj21drk7+7tp7VTwwR7KxxXXc/3pbXz2PHlDgj3cICahgF1kHm4dExBFj7BXrZJXzig==} peerDependencies: zod: ^3.24.1 @@ -5269,7 +5269,7 @@ snapshots: yargs-parser: 21.1.1 yocto-spinner: 0.2.1 zod: 3.24.2 - zod-to-json-schema: 3.24.3(zod@3.24.2) + zod-to-json-schema: 3.24.4(zod@3.24.2) zod-to-ts: 1.2.0(typescript@5.8.2)(zod@3.24.2) optionalDependencies: sharp: 0.33.5 @@ -5353,7 +5353,7 @@ snapshots: browserslist@4.24.4: dependencies: caniuse-lite: 1.0.30001704 - electron-to-chromium: 1.5.118 + electron-to-chromium: 1.5.119 node-releases: 2.0.19 update-browserslist-db: 1.1.3(browserslist@4.24.4) @@ -5612,7 +5612,7 @@ snapshots: duplexer@0.1.2: {} - electron-to-chromium@1.5.118: {} + electron-to-chromium@1.5.119: {} emmet@2.4.11: dependencies: @@ -8367,7 +8367,7 @@ snapshots: yoctocolors@2.1.1: {} - zod-to-json-schema@3.24.3(zod@3.24.2): + zod-to-json-schema@3.24.4(zod@3.24.2): dependencies: zod: 3.24.2 diff --git a/src/components/MainHeader.astro b/src/components/MainHeader.astro index 2520ea9..3a6abbc 100644 --- a/src/components/MainHeader.astro +++ b/src/components/MainHeader.astro @@ -6,13 +6,9 @@ import { getPageInfo } from '@/utils/page' const { currentLang, getLocalizedPath } = getPageInfo(Astro.url.pathname) const currentUI = ui[currentLang as keyof typeof ui] -const { title, subtitle } = themeConfig.site -const headerTitle = title || currentUI.title -const headerSubtitle = !subtitle - ? '' - : (subtitle === 'Revive the beauty of typography' - ? currentUI.subtitle - : subtitle) +const { title, subtitle, i18nTitle } = themeConfig.site +const headerTitle = i18nTitle ? currentUI.title : title +const headerSubtitle = i18nTitle ? currentUI.subtitle : subtitle const { titleSpace } = themeConfig.global const marginBottom = { @@ -23,7 +19,7 @@ const marginBottom = { ---
-

+

{headerSubtitle && ( -

+

{headerSubtitle}

)} diff --git a/src/components/MobileHeader.astro b/src/components/MobileHeader.astro index 6aa8e9f..485e467 100644 --- a/src/components/MobileHeader.astro +++ b/src/components/MobileHeader.astro @@ -6,13 +6,9 @@ import { getPageInfo } from '@/utils/page' const { currentLang, getLocalizedPath } = getPageInfo(Astro.url.pathname) const currentUI = ui[currentLang as keyof typeof ui] -const { title, subtitle } = themeConfig.site -const headerTitle = title || currentUI.title -const headerSubtitle = !subtitle - ? '' - : (subtitle === 'Revive the beauty of typography' - ? currentUI.subtitle - : subtitle) +const { title, subtitle, i18nTitle } = themeConfig.site +const headerTitle = i18nTitle ? currentUI.title : title +const headerSubtitle = i18nTitle ? currentUI.subtitle : subtitle const { titleSpace } = themeConfig.global const marginBottom = { diff --git a/src/components/PostTime.astro b/src/components/PostDate.astro similarity index 97% rename from src/components/PostTime.astro rename to src/components/PostDate.astro index 75d70de..35fc281 100644 --- a/src/components/PostTime.astro +++ b/src/components/PostDate.astro @@ -56,12 +56,12 @@ function formatDate(date: Date, format: 'YYYY-MM-DD' | 'MM-DD-YYYY' | 'DD-MM-YYY } --- - + - + {updatedDate && (