From f96680fcc965b3de5186801370fc20981d17cf84 Mon Sep 17 00:00:00 2001 From: Mohamed Bassem Date: Sun, 6 Jul 2025 16:14:14 +0000 Subject: fix: Fix i18n in the new stats page --- apps/web/app/settings/layout.tsx | 2 +- apps/web/app/settings/stats/page.tsx | 94 +++++++++++++++++---------- apps/web/lib/i18n/locales/en/translation.json | 49 +++++++++++++- 3 files changed, 108 insertions(+), 37 deletions(-) diff --git a/apps/web/app/settings/layout.tsx b/apps/web/app/settings/layout.tsx index 4ff3719f..217e02ba 100644 --- a/apps/web/app/settings/layout.tsx +++ b/apps/web/app/settings/layout.tsx @@ -36,7 +36,7 @@ const settingsSidebarItems = ( path: "/settings/info", }, { - name: "Usage Statistics", + name: t("settings.stats.usage_statistics"), icon: , path: "/settings/stats", }, diff --git a/apps/web/app/settings/stats/page.tsx b/apps/web/app/settings/stats/page.tsx index 15608a34..ab4fb22c 100644 --- a/apps/web/app/settings/stats/page.tsx +++ b/apps/web/app/settings/stats/page.tsx @@ -5,6 +5,7 @@ import { Badge } from "@/components/ui/badge"; import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; import { Progress } from "@/components/ui/progress"; import { Skeleton } from "@/components/ui/skeleton"; +import { useTranslation } from "@/lib/i18n/client"; import { api } from "@/lib/trpc"; import { Archive, @@ -107,6 +108,7 @@ function StatCard({ } export default function StatsPage() { + const { t } = useTranslation(); const { data: stats, isLoading } = api.users.stats.useQuery(); const maxHourlyActivity = useMemo(() => { @@ -131,9 +133,11 @@ export default function StatsPage() { return (
-

Usage Statistics

+

+ {t("settings.stats.usage_statistics")} +

- Insights into your bookmarking habits and collection + {t("settings.stats.insights_description")}

@@ -157,7 +161,9 @@ export default function StatsPage() { if (!stats) { return (
-

Failed to load statistics

+

+ {t("settings.stats.failed_to_load")} +

); } @@ -165,7 +171,9 @@ export default function StatsPage() { return (
-

Usage Statistics

+

+ {t("settings.stats.usage_statistics")} +

Insights into your bookmarking habits and collection

@@ -174,52 +182,52 @@ export default function StatsPage() { {/* Overview Stats */}
} - description="All saved items" + description={t("settings.stats.overview.all_saved_items")} /> } - description="Starred bookmarks" + description={t("settings.stats.overview.starred_bookmarks")} /> } - description="Archived items" + description={t("settings.stats.overview.archived_items")} /> } - description="Unique tags created" + description={t("settings.stats.overview.unique_tags_created")} /> } - description="Bookmark collections" + description={t("settings.stats.overview.bookmark_collections")} /> } - description="Text highlights" + description={t("settings.stats.overview.text_highlights")} /> } - description="Total asset storage" + description={t("settings.stats.overview.total_asset_storage")} /> } - description="Bookmarks added" + description={t("settings.stats.overview.bookmarks_added")} />
@@ -229,7 +237,7 @@ export default function StatsPage() { - Bookmark Types + {t("settings.stats.bookmark_types.title")} @@ -237,7 +245,9 @@ export default function StatsPage() {
- Links + + {t("settings.stats.bookmark_types.links")} +
{stats.bookmarksByType.link} @@ -256,7 +266,9 @@ export default function StatsPage() {
- Text Notes + + {t("settings.stats.bookmark_types.text_notes")} +
{stats.bookmarksByType.text} @@ -275,7 +287,9 @@ export default function StatsPage() {
- Assets + + {t("settings.stats.bookmark_types.assets")} +
{stats.bookmarksByType.asset} @@ -298,7 +312,7 @@ export default function StatsPage() { - Recent Activity + {t("settings.stats.recent_activity.title")} @@ -307,19 +321,25 @@ export default function StatsPage() {
{stats.bookmarkingActivity.thisWeek}
-
This Week
+
+ {t("settings.stats.recent_activity.this_week")} +
{stats.bookmarkingActivity.thisMonth}
-
This Month
+
+ {t("settings.stats.recent_activity.this_month")} +
{stats.bookmarkingActivity.thisYear}
-
This Year
+
+ {t("settings.stats.recent_activity.this_year")} +
@@ -330,7 +350,7 @@ export default function StatsPage() { - Top Domains + {t("settings.stats.top_domains.title")} @@ -364,7 +384,9 @@ export default function StatsPage() { )}
) : ( -

No domains found

+

+ {t("settings.stats.top_domains.no_domains_found")} +

)}
@@ -374,7 +396,7 @@ export default function StatsPage() { - Most Used Tags + {t("settings.stats.most_used_tags.title")} @@ -405,7 +427,9 @@ export default function StatsPage() { )}
) : ( -

No tags found

+

+ {t("settings.stats.most_used_tags.no_tags_found")} +

)} @@ -418,7 +442,7 @@ export default function StatsPage() { - Activity by Hour + {t("settings.stats.activity_patterns.activity_by_hour")} @@ -437,7 +461,7 @@ export default function StatsPage() { - Activity by Day + {t("settings.stats.activity_patterns.activity_by_day")} @@ -458,7 +482,7 @@ export default function StatsPage() { - Storage Breakdown + {t("settings.stats.storage_breakdown.title")} diff --git a/apps/web/lib/i18n/locales/en/translation.json b/apps/web/lib/i18n/locales/en/translation.json index 727a7538..33f4952c 100644 --- a/apps/web/lib/i18n/locales/en/translation.json +++ b/apps/web/lib/i18n/locales/en/translation.json @@ -116,7 +116,54 @@ } }, "stats": { - "usage_statistics": "Usage Statistics" + "usage_statistics": "Usage Statistics", + "insights_description": "Insights into your bookmarking habits and collection", + "failed_to_load": "Failed to load statistics", + "overview": { + "total_bookmarks": "Total Bookmarks", + "all_saved_items": "All saved items", + "favorites": "Favorites", + "starred_bookmarks": "Starred bookmarks", + "archived": "Archived", + "archived_items": "Archived items", + "tags": "Tags", + "unique_tags_created": "Unique tags created", + "lists": "Lists", + "bookmark_collections": "Bookmark collections", + "highlights": "Highlights", + "text_highlights": "Text highlights", + "storage_used": "Storage Used", + "total_asset_storage": "Total asset storage", + "this_month": "This Month", + "bookmarks_added": "Bookmarks added" + }, + "bookmark_types": { + "title": "Bookmark Types", + "links": "Links", + "text_notes": "Text Notes", + "assets": "Assets" + }, + "recent_activity": { + "title": "Recent Activity", + "this_week": "This Week", + "this_month": "This Month", + "this_year": "This Year" + }, + "top_domains": { + "title": "Top Domains", + "no_domains_found": "No domains found" + }, + "most_used_tags": { + "title": "Most Used Tags", + "no_tags_found": "No tags found" + }, + "activity_patterns": { + "activity_by_hour": "Activity by Hour", + "activity_by_day": "Activity by Day" + }, + "storage_breakdown": { + "title": "Storage Breakdown" + } }, "ai": { "ai_settings": "AI Settings", -- cgit v1.2.3-70-g09d2