From 88e2928d1bf00e321ea5fc8bbff7eeac8f2d5487 Mon Sep 17 00:00:00 2001 From: Zakk Date: Wed, 30 Sep 2026 02:27:44 +1000 Subject: [PATCH] fix(i18n): keep chart part names as they read today Waffle and ShareBar parts nested ui.valuePair inside the chart's own pair, doubling the colon. Give a part its own ui.chartPart message that renders exactly as before. --- src/i18n/locales/en.json | 1 + src/i18n/locales/zh-CN.json | 1 + src/i18n/locales/zh-TW.json | 1 + src/ui/charts/description.test.ts | 8 ++++---- src/ui/charts/description.ts | 2 +- 5 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/i18n/locales/en.json b/src/i18n/locales/en.json index 5c595d5a..5f83308b 100644 --- a/src/i18n/locales/en.json +++ b/src/i18n/locales/en.json @@ -1784,6 +1784,7 @@ "ui.cache": "Cache", "ui.cancel": "Cancel", "ui.changeApplying": "Another change is being applied", + "ui.chartPart": "{label} {value}", "ui.clearFilters": "Clear filters", "ui.config": "Configuration", "ui.current": "Current", diff --git a/src/i18n/locales/zh-CN.json b/src/i18n/locales/zh-CN.json index f690ffb4..61e57d9c 100644 --- a/src/i18n/locales/zh-CN.json +++ b/src/i18n/locales/zh-CN.json @@ -1583,6 +1583,7 @@ "ui.cache": "缓存", "ui.cancel": "取消", "ui.changeApplying": "另一项修改正在应用", + "ui.chartPart": "{label} {value}", "ui.clearFilters": "清除筛选", "ui.config": "配置", "ui.current": "当前", diff --git a/src/i18n/locales/zh-TW.json b/src/i18n/locales/zh-TW.json index a3e312b5..eda562ae 100644 --- a/src/i18n/locales/zh-TW.json +++ b/src/i18n/locales/zh-TW.json @@ -1583,6 +1583,7 @@ "ui.cache": "快取", "ui.cancel": "取消", "ui.changeApplying": "另一項修改正在套用", + "ui.chartPart": "{label} {value}", "ui.clearFilters": "清除篩選", "ui.config": "組態", "ui.current": "目前", diff --git a/src/ui/charts/description.test.ts b/src/ui/charts/description.test.ts index 218c29f9..e06bc776 100644 --- a/src/ui/charts/description.test.ts +++ b/src/ui/charts/description.test.ts @@ -8,10 +8,10 @@ const shares = [ ]; it.each([ - ['en', 'Traffic: Proxy: 3, Direct: 1'], - ['zh-TW', 'Traffic\uFF1AProxy\uFF1A3\uFF0CDirect\uFF1A1'], - ['zh-CN', 'Traffic\uFF1AProxy\uFF1A3\uFF0CDirect\uFF1A1'] -] as Array<[Lang, string]>)('describes every share as a complete value pair in %s', (lang, name) => { + ['en', 'Traffic: Proxy 3, Direct 1'], + ['zh-TW', 'Traffic\uFF1AProxy 3\uFF0CDirect 1'], + ['zh-CN', 'Traffic\uFF1AProxy 3\uFF0CDirect 1'] +] as Array<[Lang, string]>)('describes every share as one message in %s', (lang, name) => { const t = (key: Parameters[1], params?: Parameters[2]) => translate(lang, key, params); expect(shareDescription('Traffic', shares, t)).toBe(name); }); diff --git a/src/ui/charts/description.ts b/src/ui/charts/description.ts index d532b172..db757e30 100644 --- a/src/ui/charts/description.ts +++ b/src/ui/charts/description.ts @@ -7,4 +7,4 @@ export const ChartDescription = createContext(undefined); export const useChartDescription = () => useContext(ChartDescription); export const shareDescription = (label: string, shares: Array<{label: string; text: string}>, t: Translator) => - t('ui.valuePair', {label, value: shares.map(share => t('ui.valuePair', {label: share.label, value: share.text})).join(t('ui.separator'))}); + t('ui.valuePair', {label, value: shares.map(share => t('ui.chartPart', {label: share.label, value: share.text})).join(t('ui.separator'))});