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
---
 .../components/dashboard/bookmarks/ManageListsModal.tsx  | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

(limited to 'apps/web/components/dashboard/bookmarks/ManageListsModal.tsx')

diff --git a/apps/web/components/dashboard/bookmarks/ManageListsModal.tsx b/apps/web/components/dashboard/bookmarks/ManageListsModal.tsx
index c1a75a43..dfbd6d45 100644
--- a/apps/web/components/dashboard/bookmarks/ManageListsModal.tsx
+++ b/apps/web/components/dashboard/bookmarks/ManageListsModal.tsx
@@ -18,6 +18,7 @@ import {
 } from "@/components/ui/form";
 import LoadingSpinner from "@/components/ui/spinner";
 import { toast } from "@/components/ui/use-toast";
+import { useTranslation } from "@/lib/i18n/client";
 import { api } from "@/lib/trpc";
 import { zodResolver } from "@hookform/resolvers/zod";
 import { Archive, X } from "lucide-react";
@@ -42,6 +43,7 @@ export default function ManageListsModal({
   open: boolean;
   setOpen: (open: boolean) => void;
 }) {
+  const { t } = useTranslation();
   const formSchema = z.object({
     listId: z.string({
       required_error: "Please select a list",
@@ -73,7 +75,7 @@ export default function ManageListsModal({
     useAddBookmarkToList({
       onSuccess: () => {
         toast({
-          description: "List has been updated!",
+          description: t("toasts.lists.updated"),
         });
         form.resetField("listId");
       },
@@ -86,7 +88,7 @@ export default function ManageListsModal({
         } else {
           toast({
             variant: "destructive",
-            title: "Something went wrong",
+            title: t("common.something_went_wrong"),
           });
         }
       },
@@ -96,7 +98,7 @@ export default function ManageListsModal({
     useRemoveBookmarkFromList({
       onSuccess: () => {
         toast({
-          description: "List has been updated!",
+          description: t("toasts.lists.updated"),
         });
         form.resetField("listId");
       },
@@ -109,7 +111,7 @@ export default function ManageListsModal({
         } else {
           toast({
             variant: "destructive",
-            title: "Something went wrong",
+            title: t("common.something_went_wrong"),
           });
         }
       },
@@ -188,7 +190,7 @@ export default function ManageListsModal({
             <DialogFooter className="sm:justify-end">
               <DialogClose asChild>
                 <Button type="button" variant="secondary">
-                  Close
+                  {t("actions.close")}
                 </Button>
               </DialogClose>
               <ArchiveBookmarkButton
@@ -196,14 +198,14 @@ export default function ManageListsModal({
                 bookmarkId={bookmarkId}
                 onDone={() => setOpen(false)}
               >
-                <Archive className="mr-2 size-4" /> Archive
+                <Archive className="mr-2 size-4" /> {t("actions.archive")}
               </ArchiveBookmarkButton>
               <ActionButton
                 type="submit"
                 loading={isAddingToListPending}
                 disabled={isAddingToListPending}
               >
-                Add
+                {t("actions.add")}
               </ActionButton>
             </DialogFooter>
           </form>
-- 
cgit v1.2.3-70-g09d2

