app-template/app/web/src/views/home.astro

24 lines
610 B
Plaintext

---
import { alternatePath, type Locale, t } from "@app/i18n";
import HomeBody from "~/components/pages/HomeBody";
import AppLayout from "~/layouts/AppLayout.astro";
export interface Props {
locale: Locale;
}
const { locale } = Astro.props;
const otherLocale: Locale = locale === "zh-CN" ? "en" : "zh-CN";
const switchHref = alternatePath(Astro.url.pathname, otherLocale);
---
<AppLayout
title={t(locale, "home.title")}
locale={locale}
active="home"
switchHref={switchHref}
switchLabel={t(otherLocale, `locale.${otherLocale}` as never)}
>
<HomeBody client:load locale={locale} />
</AppLayout>