Fix i18n: move init to root.tsx and downgrade to stable versions

Move initI18n() from entry.client.tsx to root.tsx in both Planner and
Journal so i18n is initialized before any component renders. Downgrade
react-i18next to 16.6.1 and i18next to 25.10.4 to avoid hydration
mismatch issues introduced in newer versions.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Ullrich Schäfer 2026-03-26 00:17:19 +01:00 committed by GitHub
parent 30ae68dd69
commit 3f7499ff06
7 changed files with 252 additions and 248 deletions

View file

@ -1,4 +1,3 @@
import { initI18n } from "@trails-cool/i18n";
import * as Sentry from "@sentry/react";
import { useEffect } from "react";
import { startTransition, StrictMode } from "react";
@ -28,8 +27,6 @@ Sentry.init({
enabled: import.meta.env.PROD && sentryEnvironment !== "ci",
});
initI18n();
startTransition(() => {
hydrateRoot(
document,

View file

@ -4,9 +4,12 @@ import type { LinksFunction } from "react-router";
import type { Route } from "./+types/root";
import * as Sentry from "@sentry/react";
import { useTranslation } from "react-i18next";
import { initI18n } from "@trails-cool/i18n";
import { getSessionUser } from "~/lib/auth.server";
import stylesheet from "@trails-cool/ui/styles.css?url";
initI18n();
export const links: LinksFunction = () => [{ rel: "stylesheet", href: stylesheet }];
export function Layout({ children }: { children: React.ReactNode }) {