From e4f806ed14e2628e9854a674fdf6a84403b0167c Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Sat, 25 Oct 2025 19:13:28 +0300 Subject: [PATCH] feat(website/i18n): get translation to actually render --- apps/website/src/components/Card.tsx | 4 +- .../website/src/components/DownloadButton.tsx | 5 +- apps/website/src/components/Footer.tsx | 7 +- apps/website/src/download-helper.ts | 273 +++++++++--------- apps/website/src/i18n.ts | 2 - apps/website/src/index.tsx | 6 + .../src/pages/GetStarted/get-started.tsx | 11 +- apps/website/src/pages/Home/index.tsx | 12 +- .../website/src/pages/SupportUs/SupportUs.tsx | 4 +- apps/website/src/pages/_404.tsx | 3 +- 10 files changed, 178 insertions(+), 149 deletions(-) diff --git a/apps/website/src/components/Card.tsx b/apps/website/src/components/Card.tsx index 593a9025b..721cf4241 100644 --- a/apps/website/src/components/Card.tsx +++ b/apps/website/src/components/Card.tsx @@ -1,7 +1,7 @@ import { ComponentChildren, HTMLAttributes } from "preact"; import { Link } from "./Button.js"; import Icon from "./Icon.js"; -import { t } from "../i18n.js"; +import { useTranslation } from "react-i18next"; interface CardProps extends Omit, "title"> { title: ComponentChildren; @@ -13,6 +13,8 @@ interface CardProps extends Omit, "title"> { } export default function Card({ title, children, imageUrl, iconSvg, className, moreInfoUrl, ...restProps }: CardProps) { + const { t } = useTranslation(); + return (
{imageUrl && } diff --git a/apps/website/src/components/DownloadButton.tsx b/apps/website/src/components/DownloadButton.tsx index 75fbeff18..c860a312e 100644 --- a/apps/website/src/components/DownloadButton.tsx +++ b/apps/website/src/components/DownloadButton.tsx @@ -4,16 +4,17 @@ import Button from "./Button.js"; import downloadIcon from "../assets/boxicons/bx-arrow-in-down-square-half.svg?raw"; import packageJson from "../../../../package.json" with { type: "json" }; import { useEffect, useState } from "preact/hooks"; -import { t } from "../i18n.js"; +import { useTranslation } from "react-i18next"; interface DownloadButtonProps { big?: boolean; } export default function DownloadButton({ big }: DownloadButtonProps) { + const { t } = useTranslation(); const [ recommendedDownload, setRecommendedDownload ] = useState(); useEffect(() => { - getRecommendedDownload()?.then(setRecommendedDownload); + getRecommendedDownload(t)?.then(setRecommendedDownload); }, []); return (recommendedDownload && diff --git a/apps/website/src/components/Footer.tsx b/apps/website/src/components/Footer.tsx index 8948ca779..0c1cb4b6c 100644 --- a/apps/website/src/components/Footer.tsx +++ b/apps/website/src/components/Footer.tsx @@ -5,9 +5,12 @@ import githubDiscussionsIcon from "../assets/boxicons/bx-discussion.svg?raw"; import matrixIcon from "../assets/boxicons/bx-message-dots.svg?raw"; import redditIcon from "../assets/boxicons/bx-reddit.svg?raw"; import { Link } from "./Button.js"; -import { LOCALES, t } from "../i18n"; +import { LOCALES } from "../i18n"; +import { useTranslation } from "react-i18next"; export default function Footer() { + const { t } = useTranslation(); + return (