From 4354ee7ba1c6ac9a9567944ae6169b1664e0ea8a Mon Sep 17 00:00:00 2001
From: Mohamed Bassem <me@mbassem.com>
Date: Sun, 17 Nov 2024 00:33:28 +0000
Subject: feature: Add i18n support. Fixes #57 (#635)

* feature(web): Add basic scaffolding for i18n

* refactor: Switch most of the app's strings to use i18n strings

* fix: Remove unused i18next-resources-for-ts command

* Add user setting

* More translations

* Drop the german translation for now
---
 apps/web/lib/providers.tsx | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

(limited to 'apps/web/lib/providers.tsx')

diff --git a/apps/web/lib/providers.tsx b/apps/web/lib/providers.tsx
index b4066808..e1223382 100644
--- a/apps/web/lib/providers.tsx
+++ b/apps/web/lib/providers.tsx
@@ -14,6 +14,7 @@ import superjson from "superjson";
 import type { ClientConfig } from "@hoarder/shared/config";
 
 import { ClientConfigCtx } from "./clientConfig";
+import CustomI18nextProvider from "./i18n/provider";
 import { api } from "./trpc";
 
 function makeQueryClient() {
@@ -81,14 +82,18 @@ export default function Providers({
         <SessionProvider session={session}>
           <api.Provider client={trpcClient} queryClient={queryClient}>
             <QueryClientProvider client={queryClient}>
-              <ThemeProvider
-                attribute="class"
-                defaultTheme="system"
-                enableSystem
-                disableTransitionOnChange
-              >
-                <TooltipProvider delayDuration={0}>{children}</TooltipProvider>
-              </ThemeProvider>
+              <CustomI18nextProvider lang={userLocalSettings.lang}>
+                <ThemeProvider
+                  attribute="class"
+                  defaultTheme="system"
+                  enableSystem
+                  disableTransitionOnChange
+                >
+                  <TooltipProvider delayDuration={0}>
+                    {children}
+                  </TooltipProvider>
+                </ThemeProvider>
+              </CustomI18nextProvider>
             </QueryClientProvider>
           </api.Provider>
         </SessionProvider>
-- 
cgit v1.2.3-70-g09d2

