diff --git a/src/components/header.astro b/src/components/header.astro index 28d7468..ebfe266 100644 --- a/src/components/header.astro +++ b/src/components/header.astro @@ -3,10 +3,10 @@ import { HeaderMenu } from "./header-menu"; import { Image } from "astro:assets"; import logo from "@/assets/logo.png"; import { ThemeToggle } from "./theme-toggle"; -import { TranslateFunction } from "../utils/language"; +import { createTranslation, TranslateFunction } from "../utils/language"; import { LanguageSelect } from "./language-select"; -const t = Astro.props.t as TranslateFunction; +const t = (Astro.props.t as TranslateFunction) ?? createTranslation("zh-tw"); const url = new URL(Astro.url); @@ -29,7 +29,12 @@ const code = t("code"); {t("global.header.title")}
- + diff --git a/src/components/language-select.tsx b/src/components/language-select.tsx index 579a966..d60e92c 100644 --- a/src/components/language-select.tsx +++ b/src/components/language-select.tsx @@ -11,12 +11,14 @@ import type { FC } from "react"; export const LanguageSelect: FC<{ code: string; path: string; -}> = ({ code, path }) => { + disabled?: boolean; +}> = ({ code, path, disabled }) => { if (path.endsWith("/")) path = path.slice(0, -1); return (