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/userLocalSettings/bookmarksLayout.tsx | 7 +++++++
 1 file changed, 7 insertions(+)

(limited to 'apps/web/lib/userLocalSettings/bookmarksLayout.tsx')

diff --git a/apps/web/lib/userLocalSettings/bookmarksLayout.tsx b/apps/web/lib/userLocalSettings/bookmarksLayout.tsx
index 424046b9..a122c6e7 100644
--- a/apps/web/lib/userLocalSettings/bookmarksLayout.tsx
+++ b/apps/web/lib/userLocalSettings/bookmarksLayout.tsx
@@ -2,6 +2,7 @@
 
 import type { z } from "zod";
 import { createContext, useContext } from "react";
+import { fallbackLng } from "@/lib/i18n/settings";
 
 import type { BookmarksLayoutTypes, zUserLocalSettings } from "./types";
 
@@ -11,6 +12,7 @@ export const UserLocalSettingsCtx = createContext<
   z.infer<typeof zUserLocalSettings>
 >({
   bookmarkGridLayout: defaultLayout,
+  lang: fallbackLng,
 });
 
 function useUserLocalSettings() {
@@ -22,6 +24,11 @@ export function useBookmarkLayout() {
   return settings.bookmarkGridLayout;
 }
 
+export function useInterfaceLang() {
+  const settings = useUserLocalSettings();
+  return settings.lang;
+}
+
 export function bookmarkLayoutSwitch<T>(
   layout: BookmarksLayoutTypes,
   data: Record<BookmarksLayoutTypes, T>,
-- 
cgit v1.2.3-70-g09d2

