diff --git a/bun.lockb b/bun.lockb index b14d5a4..c49525a 100644 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/web/app/i18n.ts b/web/app/i18n.ts new file mode 100644 index 0000000..9bf3e0f --- /dev/null +++ b/web/app/i18n.ts @@ -0,0 +1,23 @@ +import i18n from "i18next"; +import { initReactI18next } from "react-i18next"; + +const resources = { + en: { + translation: { + index: { + title: "classified.ink", + description: "Truly secure and private note-taking for everyone.", + }, + }, + }, +}; + +await i18n.use(initReactI18next).init({ + fallbackLng: "en", + resources, + interpolation: { + escapeValue: false, + }, +}); + +export default i18n; diff --git a/web/app/index.tsx b/web/app/index.tsx index 08094bf..456ce2a 100644 --- a/web/app/index.tsx +++ b/web/app/index.tsx @@ -5,6 +5,8 @@ import { createRouter, RouterProvider } from "@tanstack/react-router"; import { routeTree } from "@/app/pages.gen.ts"; import "@/app/globals.css"; import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; +import { I18nextProvider } from "react-i18next"; +import i18n from "@/app/i18n.ts"; const router = createRouter({ routeTree }); @@ -14,7 +16,9 @@ ReactDOM.createRoot(document.getElementById("root")!).render( - + + + , diff --git a/web/package.json b/web/package.json index 6747f82..dea14a0 100644 --- a/web/package.json +++ b/web/package.json @@ -16,10 +16,10 @@ "@tanstack/router-cli": "^1.37.0", "class-variance-authority": "^0.7.0", "clsx": "^2.1.1", - "i18next": "^23.11.5", "lucide-react": "^0.396.0", "react": "^18.3.1", "react-dom": "^18.3.1", + "react-i18next": "^14.1.2", "tailwind-merge": "^2.3.0", "tailwindcss-animate": "^1.0.7", "zustand": "^4.5.2" diff --git a/web/pages/index.tsx b/web/pages/index.tsx index ae95094..b4fcc68 100644 --- a/web/pages/index.tsx +++ b/web/pages/index.tsx @@ -3,6 +3,7 @@ import { Route as RootRoute } from "@/pages/__root"; import { Suspense, useEffect, useState } from "react"; import { api } from "@/app/utils.ts"; import { toast } from "@/components/ui/use-toast.ts"; +import { useTranslation } from "react-i18next"; export const Route = createRoute({ getParentRoute: () => RootRoute, @@ -11,13 +12,13 @@ export const Route = createRoute({ }); function Component() { + const { t } = useTranslation(); + return (
-

classified.ink

-

- Truly secure and private note-taking for everyone. -

+

{t("index.title")}

+

{t("index.description")}

}>