aboutsummaryrefslogtreecommitdiffstats
path: root/apps/web/lib/i18n/provider.tsx
diff options
context:
space:
mode:
authorMohamed Bassem <me@mbassem.com>2024-11-17 00:33:28 +0000
committerGitHub <noreply@github.com>2024-11-17 00:33:28 +0000
commit4354ee7ba1c6ac9a9567944ae6169b1664e0ea8a (patch)
treee27c9070930514d77582bae00b3350274116179c /apps/web/lib/i18n/provider.tsx
parent9f2c7be23769bb0f4102736a683710b1a1939661 (diff)
downloadkarakeep-4354ee7ba1c6ac9a9567944ae6169b1664e0ea8a.tar.zst
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
Diffstat (limited to 'apps/web/lib/i18n/provider.tsx')
-rw-r--r--apps/web/lib/i18n/provider.tsx18
1 files changed, 18 insertions, 0 deletions
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;