From e28d118bf4dcffc7c93cfd6831964b9e7d93cc9b Mon Sep 17 00:00:00 2001 From: mrjvs Date: Wed, 6 Dec 2023 22:08:53 +0100 Subject: [PATCH] Fix translation bug --- src/pages/parts/home/HeroPart.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/pages/parts/home/HeroPart.tsx b/src/pages/parts/home/HeroPart.tsx index 871a2095..e40a1aa0 100644 --- a/src/pages/parts/home/HeroPart.tsx +++ b/src/pages/parts/home/HeroPart.tsx @@ -1,4 +1,5 @@ import { useCallback, useRef, useState } from "react"; +import { useTranslation } from "react-i18next"; import Sticky from "react-sticky-el"; import { SearchBarInput } from "@/components/form/SearchBar"; @@ -15,7 +16,8 @@ export interface HeroPartProps { } export function HeroPart({ setIsSticky, searchParams }: HeroPartProps) { - const { t } = useRandomTranslation(); + const { t: randomT } = useRandomTranslation(); + const { t } = useTranslation(); const [search, setSearch, setSearchUnFocus] = searchParams; const [, setShowBg] = useState(false); const bannerSize = useBannerSize(); @@ -32,7 +34,7 @@ export function HeroPart({ setIsSticky, searchParams }: HeroPartProps) { if (hour < 12) time = "morning"; else if (hour < 19) time = "day"; - const title = t(`home.titles.${time}`); + const title = randomT(`home.titles.${time}`); const inputRef = useRef(null); useSlashFocus(inputRef); @@ -56,7 +58,7 @@ export function HeroPart({ setIsSticky, searchParams }: HeroPartProps) { onChange={setSearch} value={search} onUnFocus={setSearchUnFocus} - placeholder={t("home.search.placeholder")} + placeholder={t("home.search.placeholder") ?? ""} />