From c4c8fe23a9999f29685d58729b01334965130120 Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Mon, 27 Oct 2025 16:29:44 +0200 Subject: [PATCH 01/10] fix(website): pages not prerendered --- apps/website/src/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/website/src/index.tsx b/apps/website/src/index.tsx index 8cbea3d0e..92455792a 100644 --- a/apps/website/src/index.tsx +++ b/apps/website/src/index.tsx @@ -69,7 +69,7 @@ export function LocaleProvider({ children }) { return ( - {loaded && children} + {children} ); } From 86aaa97809b90f72ffabadad79cdd103f653fae1 Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Mon, 27 Oct 2025 16:30:03 +0200 Subject: [PATCH 02/10] fix(website): language-specific pages not properly determined --- apps/website/src/i18n.spec.ts | 1 + apps/website/src/i18n.ts | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/apps/website/src/i18n.spec.ts b/apps/website/src/i18n.spec.ts index eab06ba5a..fcc8d790a 100644 --- a/apps/website/src/i18n.spec.ts +++ b/apps/website/src/i18n.spec.ts @@ -19,6 +19,7 @@ describe("swapLocale", () => { expect(swapLocaleInUrl("/ro/get-started", "ro")).toStrictEqual("/ro/get-started"); expect(swapLocaleInUrl("/en/get-started", "ro")).toStrictEqual("/ro/get-started"); expect(swapLocaleInUrl("/ro/", "en")).toStrictEqual("/en/"); + expect(swapLocaleInUrl("/ro", "en")).toStrictEqual("/en"); }); }); diff --git a/apps/website/src/i18n.ts b/apps/website/src/i18n.ts index 435245217..10608e571 100644 --- a/apps/website/src/i18n.ts +++ b/apps/website/src/i18n.ts @@ -35,7 +35,13 @@ export function mapLocale(locale: string) { export function swapLocaleInUrl(url: string, newLocale: string) { const components = url.split("/"); if (components.length === 2) { - return `/${newLocale}${url}`; + const potentialLocale = components[1]; + const correspondingLocale = LOCALES.find(l => l.id === potentialLocale); + if (correspondingLocale) { + return `/${newLocale}`; + } else { + return `/${newLocale}${url}`; + } } else { components[1] = newLocale; return components.join("/"); From dbfa94a9ee45a7fef43cd97c90df35f85d7bad34 Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Mon, 27 Oct 2025 16:35:26 +0200 Subject: [PATCH 03/10] fix(website): missing suspense --- apps/website/src/components/Header.tsx | 5 +++- apps/website/src/index.tsx | 37 ++++++++++++++------------ apps/website/src/pages/Home/index.tsx | 5 +++- 3 files changed, 28 insertions(+), 19 deletions(-) diff --git a/apps/website/src/components/Header.tsx b/apps/website/src/components/Header.tsx index 352e52fba..ce28ffd49 100644 --- a/apps/website/src/components/Header.tsx +++ b/apps/website/src/components/Header.tsx @@ -11,6 +11,7 @@ import menuIcon from "../assets/boxicons/bx-menu.svg?raw"; import { LocaleContext } from ".."; import { useTranslation } from "react-i18next"; import { swapLocaleInUrl } from "../i18n"; +import { Suspense } from "preact/compat"; interface HeaderLink { url: string; @@ -78,7 +79,9 @@ export function Header(props: {repoStargazersCount: number}) { /> - + Loading...}> + + diff --git a/apps/website/src/index.tsx b/apps/website/src/index.tsx index 92455792a..1aafe8367 100644 --- a/apps/website/src/index.tsx +++ b/apps/website/src/index.tsx @@ -13,30 +13,33 @@ import { default as i18next, changeLanguage } from 'i18next'; import { extractLocaleFromUrl, LOCALES, mapLocale } from './i18n'; import HttpApi from 'i18next-http-backend'; import { initReactI18next } from "react-i18next"; +import { Suspense } from 'preact/compat'; export const LocaleContext = createContext('en'); export function App(props: {repoStargazersCount: number}) { return ( - - -
-
- - - - + + + Loading...}> +
+
+ + + + - - - + + + - - -
-
- - + + +
+
+ + + ); } diff --git a/apps/website/src/pages/Home/index.tsx b/apps/website/src/pages/Home/index.tsx index b26d43621..02b97bbdc 100644 --- a/apps/website/src/pages/Home/index.tsx +++ b/apps/website/src/pages/Home/index.tsx @@ -33,6 +33,7 @@ import presentationIcon from "../../assets/boxicons/bx-slideshow.svg?raw"; import { getPlatform } from '../../download-helper.js'; import { useEffect, useState } from 'preact/hooks'; import { Trans, useTranslation } from 'react-i18next'; +import { Suspense } from 'preact/compat'; export function Home() { usePageTitle(""); @@ -79,7 +80,9 @@ function HeroSection() {

{t("hero_section.subtitle")}

- + Loading...
}> + +
diff --git a/apps/website/src/index.tsx b/apps/website/src/index.tsx index 1aafe8367..92455792a 100644 --- a/apps/website/src/index.tsx +++ b/apps/website/src/index.tsx @@ -13,33 +13,30 @@ import { default as i18next, changeLanguage } from 'i18next'; import { extractLocaleFromUrl, LOCALES, mapLocale } from './i18n'; import HttpApi from 'i18next-http-backend'; import { initReactI18next } from "react-i18next"; -import { Suspense } from 'preact/compat'; export const LocaleContext = createContext('en'); export function App(props: {repoStargazersCount: number}) { return ( - - - Loading...}> -
-
- - - - + + +
+
+ + + + - - - + + + - - -
-
- - - + + +
+