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/sidebar/Sidebar.tsx | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

(limited to 'apps/web/components/dashboard/sidebar/Sidebar.tsx')

diff --git a/apps/web/components/dashboard/sidebar/Sidebar.tsx b/apps/web/components/dashboard/sidebar/Sidebar.tsx
index 8021ad36..8891d9bc 100644
--- a/apps/web/components/dashboard/sidebar/Sidebar.tsx
+++ b/apps/web/components/dashboard/sidebar/Sidebar.tsx
@@ -1,6 +1,7 @@
 import { redirect } from "next/navigation";
 import SidebarItem from "@/components/shared/sidebar/SidebarItem";
 import { Separator } from "@/components/ui/separator";
+import { useTranslation } from "@/lib/i18n/server";
 import { api } from "@/server/api/client";
 import { getServerAuthSession } from "@/server/auth";
 import { Archive, Home, Search, Tag } from "lucide-react";
@@ -10,6 +11,7 @@ import serverConfig from "@hoarder/shared/config";
 import AllLists from "./AllLists";
 
 export default async function Sidebar() {
+  const { t } = await useTranslation();
   const session = await getServerAuthSession();
   if (!session) {
     redirect("/");
@@ -20,7 +22,7 @@ export default async function Sidebar() {
   const searchItem = serverConfig.meilisearch
     ? [
         {
-          name: "Search",
+          name: t("common.search"),
           icon: <Search size={18} />,
           path: "/dashboard/search",
         },
@@ -33,18 +35,18 @@ export default async function Sidebar() {
     path: string;
   }[] = [
     {
-      name: "Home",
+      name: t("common.home"),
       icon: <Home size={18} />,
       path: "/dashboard/bookmarks",
     },
     ...searchItem,
     {
-      name: "Tags",
+      name: t("common.tags"),
       icon: <Tag size={18} />,
       path: "/dashboard/tags",
     },
     {
-      name: "Archive",
+      name: t("common.archive"),
       icon: <Archive size={18} />,
       path: "/dashboard/archive",
     },
-- 
cgit v1.2.3-70-g09d2

