Skip to content

A full-featured download manager.

fix(i18n): translate complete download status headings (#2218)

Dr_rOot6b8cb5179c37
diff --git a/src/renderer/routes/downloads/status-title-menu.test.tsx b/src/renderer/routes/downloads/status-title-menu.test.tsx
index ad218e5e..522bfff6 100644
--- a/src/renderer/routes/downloads/status-title-menu.test.tsx
+++ b/src/renderer/routes/downloads/status-title-menu.test.tsx
@@ -1,8 +1,9 @@
import '@testing-library/jest-dom/vitest'
import '@renderer/lib/i18n'
+import { applyRendererLocale } from '@renderer/lib/i18n'
import { render, screen } from '@testing-library/react'
import userEvent from '@testing-library/user-event'
-import { beforeAll, describe, expect, it, vi } from 'vitest'
+import { beforeAll, beforeEach, describe, expect, it, vi } from 'vitest'
import { StatusTitleMenu } from './status-title-menu'
beforeAll(() => {
@@ -16,6 +17,32 @@ beforeAll(() => {
const counts = { all: 12, active: 4, completed: 7, error: 1 }
describe('StatusTitleMenu', () => {
+ beforeEach(async () => {
+ await applyRendererLocale('en-US')
+ })
+
+ it.each([
+ ['es', 'all', 'Todas las descargas'],
+ ['es', 'active', 'Descargas activas'],
+ ['es', 'completed', 'Descargas completadas'],
+ ['es', 'error', 'Descargas fallidas'],
+ ['fr', 'all', 'Tous les téléchargements'],
+ ['de', 'active', 'Aktive Downloads'],
+ ['zh-CN', 'all', '全部下载'],
+ ['zh-TW', 'all', '全部下載'],
+ ] as const)(
+ 'renders a complete %s heading for %s without joining standalone labels',
+ async (locale, tab, heading) => {
+ await applyRendererLocale(locale)
+ render(
+ <StatusTitleMenu tab={tab} onTabChange={vi.fn()} counts={counts} />
+ )
+
+ expect(screen.getByRole('heading', { name: heading })).toBeVisible()
+ expect(screen.getByRole('button', { name: heading })).toBeVisible()
+ }
+ )
+
it('renders the current status in the heading', () => {
render(
<StatusTitleMenu tab="active" onTabChange={vi.fn()} counts={counts} />
diff --git a/src/renderer/routes/downloads/status-title-menu.tsx b/src/renderer/routes/downloads/status-title-menu.tsx
index 2c8f9273..9f68eb13 100644
--- a/src/renderer/routes/downloads/status-title-menu.tsx
+++ b/src/renderer/routes/downloads/status-title-menu.tsx
@@ -25,8 +25,7 @@ export function StatusTitleMenu({
visibleCount = counts[tab],
}: StatusTitleMenuProps) {
const { t } = useTranslation()
- const statusLabel = t(`panel.downloads.tab.${tab}`)
- const title = `${statusLabel} ${t('panel.downloads.title')}`
+ const title = t(`panel.downloads.heading.${tab}`)
return (
<div className="flex min-w-0 items-center gap-2">
diff --git a/src/shared/locales/de.json b/src/shared/locales/de.json
index 1ec19fc7..ff4e4b1d 100644
--- a/src/shared/locales/de.json
+++ b/src/shared/locales/de.json
@@ -567,6 +567,12 @@
},
"downloads": {
"title": "Downloads",
+ "heading": {
+ "all": "Alle Downloads",
+ "active": "Aktive Downloads",
+ "completed": "Abgeschlossene Downloads",
+ "error": "Fehlgeschlagene Downloads"
+ },
"status": {
"queued": "In Warteschlange",
"fetchingMetadata": "Wird abgerufen",
diff --git a/src/shared/locales/en-US.json b/src/shared/locales/en-US.json
index 2f6cd7d4..e8115f37 100644
--- a/src/shared/locales/en-US.json
+++ b/src/shared/locales/en-US.json
@@ -567,6 +567,12 @@
},
"downloads": {
"title": "Downloads",
+ "heading": {
+ "all": "All Downloads",
+ "active": "Active Downloads",
+ "completed": "Completed Downloads",
+ "error": "Failed Downloads"
+ },
"status": {
"queued": "Queued",
"fetchingMetadata": "Fetching",
diff --git a/src/shared/locales/es.json b/src/shared/locales/es.json
index cff7eb2e..01b585da 100644
--- a/src/shared/locales/es.json
+++ b/src/shared/locales/es.json
@@ -570,6 +570,12 @@
},
"downloads": {
"title": "Descargas",
+ "heading": {
+ "all": "Todas las descargas",
+ "active": "Descargas activas",
+ "completed": "Descargas completadas",
+ "error": "Descargas fallidas"
+ },
"status": {
"queued": "En cola",
"fetchingMetadata": "Obteniendo",
diff --git a/src/shared/locales/fr.json b/src/shared/locales/fr.json
index 2179d439..21d41005 100644
--- a/src/shared/locales/fr.json
+++ b/src/shared/locales/fr.json
@@ -1176,6 +1176,12 @@
"relativeDateTime": "{{date}}, {{time}}"
},
"title": "Téléchargements",
+ "heading": {
+ "all": "Tous les téléchargements",
+ "active": "Téléchargements actifs",
+ "completed": "Téléchargements terminés",
+ "error": "Téléchargements en échec"
+ },
"titleCount": "Affichés : {{shown}} · Total : {{total}}",
"type": {
"bt": "BitTorrent",
diff --git a/src/shared/locales/zh-CN.json b/src/shared/locales/zh-CN.json
index bf2602c6..0ca6b480 100644
--- a/src/shared/locales/zh-CN.json
+++ b/src/shared/locales/zh-CN.json
@@ -564,6 +564,12 @@
},
"downloads": {
"title": "下载",
+ "heading": {
+ "all": "全部下载",
+ "active": "进行中的下载",
+ "completed": "已完成的下载",
+ "error": "失败的下载"
+ },
"status": {
"queued": "排队中",
"fetchingMetadata": "获取信息中",
diff --git a/src/shared/locales/zh-TW.json b/src/shared/locales/zh-TW.json
index 1cadcada..1a67266d 100644
--- a/src/shared/locales/zh-TW.json
+++ b/src/shared/locales/zh-TW.json
@@ -564,6 +564,12 @@
},
"downloads": {
"title": "下載",
+ "heading": {
+ "all": "全部下載",
+ "active": "進行中的下載",
+ "completed": "已完成的下載",
+ "error": "失敗的下載"
+ },
"status": {
"queued": "排隊中",
"fetchingMetadata": "取得中",