feat: add localized home routes
This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
import { Heart } from "lucide-react";
|
||||
import { Link } from "react-router-dom";
|
||||
import { useI18n } from "../../i18n";
|
||||
import { homePathForLang } from "../../languageRoutes";
|
||||
import { Reveal } from "../../motion";
|
||||
import { useSetPageTitle } from "../../components/PageTitleContext";
|
||||
|
||||
export default function Favorites() {
|
||||
const { t } = useI18n();
|
||||
const { lang, t } = useI18n();
|
||||
// Show "我的收藏" in the global header, consistent with the other pages.
|
||||
useSetPageTitle(t("favorites"));
|
||||
|
||||
@@ -32,7 +33,7 @@ export default function Favorites() {
|
||||
</p>
|
||||
|
||||
<Link
|
||||
to="/"
|
||||
to={homePathForLang(lang)}
|
||||
className="mt-4 inline-flex h-11 items-center justify-center rounded-full border border-ark-gold/60 bg-ark-gold/10 px-6 text-sm font-medium text-ark-gold transition hover:bg-ark-gold/20 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ark-gold/80 focus-visible:ring-offset-2 focus-visible:ring-offset-ark-bg"
|
||||
>
|
||||
{t("backToHome")}
|
||||
|
||||
13
src/pages/LocalizedHome/index.tsx
Normal file
13
src/pages/LocalizedHome/index.tsx
Normal file
@@ -0,0 +1,13 @@
|
||||
import { useEffect } from "react";
|
||||
import { type Lang, useI18n } from "../../i18n";
|
||||
import { Home } from "../Home";
|
||||
|
||||
export function LocalizedHomePage({ targetLang }: { targetLang: Lang }) {
|
||||
const { setLang } = useI18n();
|
||||
|
||||
useEffect(() => {
|
||||
setLang(targetLang);
|
||||
}, [setLang, targetLang]);
|
||||
|
||||
return <Home />;
|
||||
}
|
||||
Reference in New Issue
Block a user