feat: setup i18next
All checks were successful
Deploy to VPS (dist) / deploy (push) Successful in 1m27s

This commit is contained in:
Hewston Fox
2026-03-10 03:05:06 +02:00
parent ced418544b
commit fcb8dab8a0
19 changed files with 290 additions and 4 deletions

View File

@@ -17,6 +17,12 @@ export const Route = createRootRoute({
<hr />
<Outlet />
<TanStackDevtools
config={{
defaultOpen: false,
panelLocation: "bottom",
theme: "dark",
position: "middle-left",
}}
plugins={[
{
name: "TanStack Query",

View File

@@ -1,10 +1,25 @@
import { createFileRoute } from "@tanstack/react-router";
import { useTranslation } from "react-i18next";
import { useEffect, useState } from "react";
import { languages } from "../i18next";
export const Route = createFileRoute("/")({
component: () => {
const { t, i18n } = useTranslation();
const [langIdx, setLangIdx] = useState(0);
useEffect(() => {
i18n.changeLanguage(languages[langIdx].key);
}, [langIdx, i18n]);
return (
<div className="p-2">
<h3>Welcome Home!</h3>
<h3>
{t("hello")}
<button onClick={() => setLangIdx((langIdx + 1) % languages.length)}>
{i18n.language}
</button>
</h3>
</div>
);
},