Skip to content

Self-hosted personal gallery application with online photo management and albums, supporting Live/Motion Photos, EXIF parsing, geolocation recognition, and an explore map.

feat(dashboard): add i18n support for dashboard overview page

Timothy Yin3ff5b41aa236
diff --git a/app/components/dashboard/Indicator.vue b/app/components/dashboard/Indicator.vue
index 2bcc26ac..fb976e6d 100644
--- a/app/components/dashboard/Indicator.vue
+++ b/app/components/dashboard/Indicator.vue
@@ -77,17 +77,17 @@ const currentScheme = computed(() => colorSchemes[props.color])
currentScheme.text,
]"
>
- <div class="flex-1 flex items-center justify-between">
- <div>
+ <div class="flex-1 flex items-center justify-between gap-4 overflow-hidden">
+ <div class="flex-1 overflow-hidden">
<p
v-if="title"
- class="text-sm opacity-90 font-medium"
+ class="text-sm opacity-90 font-medium max-w-48 truncate"
>
{{ title }}
</p>
<p
v-if="value"
- class="text-lg font-bold"
+ class="text-lg font-bold max-w-1/2 truncate"
>
{{ value }}
</p>
diff --git a/app/pages/dashboard/index.vue b/app/pages/dashboard/index.vue
index 4a923bf1..f7c76f3e 100644
--- a/app/pages/dashboard/index.vue
+++ b/app/pages/dashboard/index.vue
@@ -128,34 +128,36 @@ const yearOptions = computed(() => {
<template>
<div class="flex flex-col gap-6 h-full p-4">
<div class="flex items-center justify-between">
- <h1 class="text-2xl font-bold">仪表板概览</h1>
+ <h1 class="text-2xl font-bold">
+ {{ $t('dashboard.overview.title') }}
+ </h1>
</div>
<div class="grid grid-cols-2 lg:grid-cols-4 gap-4">
<DashboardIndicator
- title="照片总数"
+ :title="$t('dashboard.overview.indicator.totalPhotos')"
icon="tabler:photo"
color="blue"
:value="dashboardStats?.photos?.total || 0"
/>
<DashboardIndicator
- title="本月新增"
+ :title="$t('dashboard.overview.indicator.thisMonth')"
icon="tabler:photo-plus"
color="green"
:value="dashboardStats?.photos?.thisMonth || 0"
/>
<DashboardIndicator
- title="队列状态"
+ :title="$t('dashboard.overview.indicator.queueStatus.title')"
icon="tabler:loader"
color="purple"
:value="
(dashboardStats?.workerPool?.activeWorkers || 0) > 0
- ? '处理中'
- : '空闲'
+ ? $t('dashboard.overview.indicator.queueStatus.processing')
+ : $t('dashboard.overview.indicator.queueStatus.pending')
"
/>
<DashboardIndicator
- title="存储使用"
+ :title="$t('dashboard.overview.indicator.storageUsage')"
icon="tabler:database"
color="blue"
:value="formatBytes(dashboardStats?.storage?.totalSize || 0)"
@@ -165,12 +167,16 @@ const yearOptions = computed(() => {
<!-- 运行信息 -->
<UCard>
<template #header>
- <h2 class="text-lg font-semibold pb-1.5">运行信息</h2>
+ <h2 class="text-lg font-semibold pb-1.5">
+ {{ $t('dashboard.overview.section.runtimeInfo.title') }}
+ </h2>
</template>
<div class="grid grid-cols-2 md:grid-cols-4 gap-4">
<div>
- <p class="text-sm text-neutral-500 dark:text-neutral-400">运行版本</p>
+ <p class="text-sm text-neutral-500 dark:text-neutral-400">
+ {{ $t('dashboard.overview.section.runtimeInfo.version') }}
+ </p>
<NuxtLink
class="text-lg font-bold hover:text-primary"
target="_blank"
@@ -181,7 +187,9 @@ const yearOptions = computed(() => {
</NuxtLink>
</div>
<div>
- <p class="text-sm text-neutral-500 dark:text-neutral-400">运行时间</p>
+ <p class="text-sm text-neutral-500 dark:text-neutral-400">
+ {{ $t('dashboard.overview.section.runtimeInfo.uptime') }}
+ </p>
<p class="text-lg font-bold">
{{
dashboardStats?.uptime
@@ -191,7 +199,9 @@ const yearOptions = computed(() => {
</p>
</div>
<div>
- <p class="text-sm text-neutral-500 dark:text-neutral-400">运行环境</p>
+ <p class="text-sm text-neutral-500 dark:text-neutral-400">
+ {{ $t('dashboard.overview.section.runtimeInfo.environment') }}
+ </p>
<UBadge
:color="dashboardStats?.runningOn === 'docker' ? 'info' : 'success'"
variant="soft"
@@ -200,9 +210,11 @@ const yearOptions = computed(() => {
</UBadge>
</div>
<div>
- <p class="text-sm text-neutral-500 dark:text-neutral-400">最后更新</p>
+ <p class="text-sm text-neutral-500 dark:text-neutral-400">
+ {{ $t('dashboard.overview.section.runtimeInfo.lastUpdate') }}
+ </p>
<p class="text-lg font-bold">
- {{ new Date().toLocaleDateString('zh-CN') }}
+ {{ dayjs().format('LLL') }}
</p>
</div>
</div>
@@ -296,7 +308,9 @@ const yearOptions = computed(() => {
<!-- 内存使用 -->
<UCard>
<template #header>
- <h3 class="font-semibold pb-1.5">内存使用率</h3>
+ <h3 class="font-semibold pb-1.5">
+ {{ $t('dashboard.overview.section.memory.title') }}
+ </h3>
</template>
<div class="space-y-2">
@@ -326,7 +340,7 @@ const yearOptions = computed(() => {
{{
dashboardStats?.memory
? `${Math.round((dashboardStats.memory.used / 1024 / 1024 / 1024) * 100) / 100}GB / ${Math.round((dashboardStats.memory.total / 1024 / 1024 / 1024) * 100) / 100}GB`
- : '系统内存'
+ : 'memory info not available'
}}
</div>
<span>
@@ -347,36 +361,48 @@ const yearOptions = computed(() => {
<!-- 队列详情 -->
<UCard>
<template #header>
- <h3 class="font-semibold pb-1.5">处理队列</h3>
+ <h3 class="font-semibold pb-1.5">
+ {{ $t('dashboard.overview.section.queue.title') }}
+ </h3>
</template>
<div class="space-y-1">
<div class="flex justify-between items-center text-sm">
- <span>活跃 Workers</span>
+ <span>
+ {{ $t('dashboard.overview.section.queue.activeWorkers') }}
+ </span>
<UBadge variant="soft">
{{ dashboardStats?.workerPool?.activeWorkers || 0 }}
</UBadge>
</div>
<div class="flex justify-between items-center text-sm">
- <span>总 Workers</span>
+ <span>
+ {{ $t('dashboard.overview.section.queue.totalWorkers') }}
+ </span>
<UBadge variant="soft">
{{ dashboardStats?.workerPool?.totalWorkers || 0 }}
</UBadge>
</div>
<div class="flex justify-between items-center text-sm">
- <span>已处理</span>
+ <span>
+ {{ $t('dashboard.overview.section.queue.totalProcessed') }}
+ </span>
<UBadge variant="soft">
{{ dashboardStats?.workerPool?.totalProcessed || 0 }}
</UBadge>
</div>
<div class="flex justify-between items-center text-sm">
- <span>出错数</span>
+ <span>
+ {{ $t('dashboard.overview.section.queue.totalFailed') }}
+ </span>
<UBadge variant="soft">
{{ dashboardStats?.workerPool?.totalErrors || 0 }}
</UBadge>
</div>
<div class="flex justify-between items-center text-sm">
- <span>成功率</span>
+ <span>
+ {{ $t('dashboard.overview.section.queue.avgSuccessRate') }}
+ </span>
<UBadge
:color="
(dashboardStats?.workerPool?.averageSuccessRate || 0) > 90
diff --git a/i18n/locales/en.json b/i18n/locales/en.json
index 562a88b1..59d411ea 100644
--- a/i18n/locales/en.json
+++ b/i18n/locales/en.json
@@ -303,5 +303,40 @@
"noData": "{0} has no photos"
}
}
+ },
+ "dashboard": {
+ "overview": {
+ "title": "Overview",
+ "indicator": {
+ "totalPhotos": "Total Photos",
+ "thisMonth": "New This Month",
+ "queueStatus": {
+ "title": "Queue Status",
+ "processing": "Processing",
+ "pending": "Idle"
+ },
+ "storageUsage": "Storage Usage"
+ },
+ "section": {
+ "runtimeInfo": {
+ "title": "Runtime Information",
+ "version": "Version",
+ "uptime": "Uptime",
+ "environment": "Environment",
+ "lastUpdate": "Last Updated"
+ },
+ "memory": {
+ "title": "Memory Usage"
+ },
+ "queue": {
+ "title": "Queue Status",
+ "activeWorkers": "Active Workers",
+ "totalWorkers": "Total Workers",
+ "totalProcessed": "Processed",
+ "totalFailed": "Failure count",
+ "avgSuccessRate": "Success rate"
+ }
+ }
+ }
}
}
diff --git a/i18n/locales/ja.json b/i18n/locales/ja.json
index 5a8dbf11..475dc35e 100644
--- a/i18n/locales/ja.json
+++ b/i18n/locales/ja.json
@@ -298,5 +298,40 @@
"noData": "{0}は写真がありません"
}
}
+ },
+ "dashboard": {
+ "overview": {
+ "title": "概要",
+ "indicator": {
+ "totalPhotos": "写真の総数",
+ "thisMonth": "今月は新しく",
+ "queueStatus": {
+ "title": "キューステータス",
+ "processing": "処理",
+ "pending": "アイドル"
+ },
+ "storageUsage": "ストレージの使用"
+ },
+ "section": {
+ "runtimeInfo": {
+ "title": "操作情報",
+ "version": "ランニングバージョン",
+ "uptime": "実行時間",
+ "environment": "ランニング環境",
+ "lastUpdate": "最後に更新されました"
+ },
+ "memory": {
+ "title": "メモリの使用"
+ },
+ "queue": {
+ "title": "キューステータス",
+ "activeWorkers": "アクティブワーカー",
+ "totalWorkers": "総 Workers",
+ "totalProcessed": "処理",
+ "totalFailed": "障害カウント",
+ "avgSuccessRate": "成功率"
+ }
+ }
+ }
}
}
diff --git a/i18n/locales/zh-Hans.json b/i18n/locales/zh-Hans.json
index 4b02e19f..1141caa8 100644
--- a/i18n/locales/zh-Hans.json
+++ b/i18n/locales/zh-Hans.json
@@ -303,5 +303,40 @@
"noData": "{0}没有照片"
}
}
+ },
+ "dashboard": {
+ "overview": {
+ "title": "仪表板概览",
+ "indicator": {
+ "totalPhotos": "照片总数",
+ "thisMonth": "本月新增",
+ "queueStatus": {
+ "title": "队列状态",
+ "processing": "处理中",
+ "pending": "空闲"
+ },
+ "storageUsage": "存储使用"
+ },
+ "section": {
+ "runtimeInfo": {
+ "title": "运行信息",
+ "version": "运行版本",
+ "uptime": "运行时间",
+ "environment": "运行环境",
+ "lastUpdate": "最后更新"
+ },
+ "memory": {
+ "title": "内存使用率"
+ },
+ "queue": {
+ "title": "队列状态",
+ "activeWorkers": "活跃 Workers",
+ "totalWorkers": "总 Workers",
+ "totalProcessed": "已处理",
+ "totalFailed": "失败计数",
+ "avgSuccessRate": "成功率"
+ }
+ }
+ }
}
}
diff --git a/i18n/locales/zh-Hant-HK.json b/i18n/locales/zh-Hant-HK.json
index 9357e53f..c933486e 100644
--- a/i18n/locales/zh-Hant-HK.json
+++ b/i18n/locales/zh-Hant-HK.json
@@ -298,5 +298,40 @@
"noData": "{0}冇相"
}
}
+ },
+ "dashboard": {
+ "overview": {
+ "title": "儀表板概覽",
+ "indicator": {
+ "totalPhotos": "照片總數",
+ "thisMonth": "本月新增",
+ "queueStatus": {
+ "title": "隊列狀態",
+ "processing": "處理中",
+ "pending": "空閒"
+ },
+ "storageUsage": "存儲使用"
+ },
+ "section": {
+ "runtimeInfo": {
+ "title": "運行信息",
+ "version": "運行版本",
+ "uptime": "運行時間",
+ "environment": "運行環境",
+ "lastUpdate": "最後更新"
+ },
+ "memory": {
+ "title": "內存使用率"
+ },
+ "queue": {
+ "title": "隊列狀態",
+ "activeWorkers": "活躍 Workers",
+ "totalWorkers": "總 Workers",
+ "totalProcessed": "已處理",
+ "totalFailed": "失敗計數",
+ "avgSuccessRate": "成功率"
+ }
+ }
+ }
}
}
diff --git a/i18n/locales/zh-Hant-TW.json b/i18n/locales/zh-Hant-TW.json
index 2b16eb0b..3fb50d78 100644
--- a/i18n/locales/zh-Hant-TW.json
+++ b/i18n/locales/zh-Hant-TW.json
@@ -298,5 +298,40 @@
"noData": "{0}沒有照片"
}
}
+ },
+ "dashboard": {
+ "overview": {
+ "title": "儀表板概覽",
+ "indicator": {
+ "totalPhotos": "照片總數",
+ "thisMonth": "本月新增",
+ "queueStatus": {
+ "title": "隊列狀態",
+ "processing": "處理中",
+ "pending": "空閒"
+ },
+ "storageUsage": "存儲使用"
+ },
+ "section": {
+ "runtimeInfo": {
+ "title": "運行信息",
+ "version": "運行版本",
+ "uptime": "運行時間",
+ "environment": "運行環境",
+ "lastUpdate": "最後更新"
+ },
+ "memory": {
+ "title": "內存使用率"
+ },
+ "queue": {
+ "title": "隊列狀態",
+ "activeWorkers": "活躍 Workers",
+ "totalWorkers": "總 Workers",
+ "totalProcessed": "已處理",
+ "totalFailed": "失敗計數",
+ "avgSuccessRate": "成功率"
+ }
+ }
+ }
}
}