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/i18n/provider.tsx | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
 create mode 100644 apps/web/lib/i18n/provider.tsx

(limited to 'apps/web/lib/i18n/provider.tsx')

diff --git a/apps/web/lib/i18n/provider.tsx b/apps/web/lib/i18n/provider.tsx
new file mode 100644
index 00000000..303e24bf
--- /dev/null
+++ b/apps/web/lib/i18n/provider.tsx
@@ -0,0 +1,18 @@
+import { i18n } from "@/lib/i18n/client";
+import { I18nextProvider } from "react-i18next";
+
+const CustomI18nextProvider = ({
+  lang,
+  children,
+}: {
+  lang: string;
+  children: React.ReactNode;
+}) => {
+  if (i18n.language !== lang) {
+    i18n.changeLanguage(lang);
+  }
+
+  return <I18nextProvider i18n={i18n}>{children}</I18nextProvider>;
+};
+
+export default CustomI18nextProvider;
-- 
cgit v1.2.3-70-g09d2

