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/components/dashboard/admin/AdminActions.tsx | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

(limited to 'apps/web/components/dashboard/admin/AdminActions.tsx')

diff --git a/apps/web/components/dashboard/admin/AdminActions.tsx b/apps/web/components/dashboard/admin/AdminActions.tsx
index a97552f8..3b95045c 100644
--- a/apps/web/components/dashboard/admin/AdminActions.tsx
+++ b/apps/web/components/dashboard/admin/AdminActions.tsx
@@ -2,9 +2,11 @@
 
 import { ActionButton } from "@/components/ui/action-button";
 import { toast } from "@/components/ui/use-toast";
+import { useTranslation } from "@/lib/i18n/client";
 import { api } from "@/lib/trpc";
 
 export default function AdminActions() {
+  const { t } = useTranslation();
   const { mutate: recrawlLinks, isPending: isRecrawlPending } =
     api.admin.recrawlLinks.useMutation({
       onSuccess: () => {
@@ -69,7 +71,7 @@ export default function AdminActions() {
 
   return (
     <div>
-      <div className="mb-2 mt-8 text-xl font-medium">Actions</div>
+      <div className="mb-2 mt-8 text-xl font-medium">{t("common.actions")}</div>
       <div className="flex flex-col gap-2 sm:w-1/2">
         <ActionButton
           variant="destructive"
@@ -78,7 +80,7 @@ export default function AdminActions() {
             recrawlLinks({ crawlStatus: "failure", runInference: true })
           }
         >
-          Recrawl Failed Links Only
+          {t("admin.actions.recrawl_failed_links_only")}
         </ActionButton>
         <ActionButton
           variant="destructive"
@@ -87,7 +89,7 @@ export default function AdminActions() {
             recrawlLinks({ crawlStatus: "all", runInference: true })
           }
         >
-          Recrawl All Links
+          {t("admin.actions.recrawl_all_links")}
         </ActionButton>
         <ActionButton
           variant="destructive"
@@ -96,7 +98,8 @@ export default function AdminActions() {
             recrawlLinks({ crawlStatus: "all", runInference: false })
           }
         >
-          Recrawl All Links (Without Inference)
+          {t("admin.actions.recrawl_all_links")} (
+          {t("admin.actions.without_inference")})
         </ActionButton>
         <ActionButton
           variant="destructive"
@@ -105,28 +108,28 @@ export default function AdminActions() {
             reRunInferenceOnAllBookmarks({ taggingStatus: "failure" })
           }
         >
-          Regenerate AI Tags for Failed Bookmarks Only
+          {t("admin.actions.regenerate_ai_tags_for_failed_bookmarks_only")}
         </ActionButton>
         <ActionButton
           variant="destructive"
           loading={isInferencePending}
           onClick={() => reRunInferenceOnAllBookmarks({ taggingStatus: "all" })}
         >
-          Regenerate AI Tags for All Bookmarks
+          {t("admin.actions.regenerate_ai_tags_for_all_bookmarks")}
         </ActionButton>
         <ActionButton
           variant="destructive"
           loading={isReindexPending}
           onClick={() => reindexBookmarks()}
         >
-          Reindex All Bookmarks
+          {t("admin.actions.reindex_all_bookmarks")}
         </ActionButton>
         <ActionButton
           variant="destructive"
           loading={isTidyAssetsPending}
           onClick={() => tidyAssets()}
         >
-          Compact Assets
+          {t("admin.actions.compact_assets")}
         </ActionButton>
       </div>
     </div>
-- 
cgit v1.2.3-70-g09d2

