From 17a2d00f13ff1db4cc8236176b2a26c5212a2dbd Mon Sep 17 00:00:00 2001 From: Wenjun Xu <906626481@qq.com> Date: Fri, 1 Dec 2023 18:04:14 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E4=B8=AD=E8=8B=B1?= =?UTF-8?q?=E6=96=87=E6=A0=87=E7=82=B9=E7=AC=A6=E5=8F=B7=20(#2442)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: 修复中英文标点符号 * test: 单测修复 --- packages/s2-core/__tests__/unit/common/i18n/index-spec.ts | 6 ++++-- packages/s2-core/src/common/i18n/en_US.ts | 3 ++- packages/s2-core/src/common/i18n/zh_CN.ts | 3 ++- .../strategy-sheet/custom-tooltip/custom-data-tooltip.tsx | 3 ++- .../strategy-sheet/custom-tooltip/custom-row-tooltip.tsx | 3 ++- .../src/components/tooltip/components/description.tsx | 3 ++- .../src/components/tooltip/components/head-info.tsx | 3 ++- .../s2-react/src/components/tooltip/components/summary.tsx | 3 ++- packages/s2-shared/src/constant/i18n/en_US.ts | 2 +- packages/s2-shared/src/constant/i18n/zh_CN.ts | 2 +- 10 files changed, 20 insertions(+), 11 deletions(-) diff --git a/packages/s2-core/__tests__/unit/common/i18n/index-spec.ts b/packages/s2-core/__tests__/unit/common/i18n/index-spec.ts index 13535a9eb0..74cfae1c14 100644 --- a/packages/s2-core/__tests__/unit/common/i18n/index-spec.ts +++ b/packages/s2-core/__tests__/unit/common/i18n/index-spec.ts @@ -19,7 +19,7 @@ describe('I18n Test', () => { setLang('en_US'); expect(i18n('小计')).toEqual('Total'); expect(i18n('总计')).toEqual('Total'); - expect(i18n('总和')).toEqual('SUM'); + expect(i18n('总和')).toEqual('(SUM)'); expect(i18n('项')).toEqual('items'); expect(i18n('已选择')).toEqual('selected'); expect(i18n('序号')).toEqual('Index'); @@ -27,13 +27,14 @@ describe('I18n Test', () => { expect(i18n('数值')).toEqual('Measure'); expect(i18n('共计')).toEqual('Total'); expect(i18n('条')).toEqual(''); + expect(i18n(',')).toEqual(', '); }); test('should show Chinese text when set lang to zh', () => { setLang('zh_CN'); expect(i18n('小计')).toEqual('小计'); expect(i18n('总计')).toEqual('总计'); - expect(i18n('总和')).toEqual('总和'); + expect(i18n('总和')).toEqual('(总和)'); expect(i18n('项')).toEqual('项'); expect(i18n('已选择')).toEqual('已选择'); expect(i18n('序号')).toEqual('序号'); @@ -41,5 +42,6 @@ describe('I18n Test', () => { expect(i18n('数值')).toEqual('数值'); expect(i18n('共计')).toEqual('共计'); expect(i18n('条')).toEqual('条'); + expect(i18n(',')).toEqual(','); }); }); diff --git a/packages/s2-core/src/common/i18n/en_US.ts b/packages/s2-core/src/common/i18n/en_US.ts index f067f4b7d9..acabe99a22 100644 --- a/packages/s2-core/src/common/i18n/en_US.ts +++ b/packages/s2-core/src/common/i18n/en_US.ts @@ -1,7 +1,7 @@ export const EN_US = { 小计: 'Total', 总计: 'Total', - 总和: 'SUM', + 总和: '(SUM)', 项: 'items', 已选择: 'selected', 序号: 'Index', @@ -16,4 +16,5 @@ export const EN_US = { 升序: 'ASC', 降序: 'DESC', 不排序: 'No order', + ',': ', ', }; diff --git a/packages/s2-core/src/common/i18n/zh_CN.ts b/packages/s2-core/src/common/i18n/zh_CN.ts index 6e677d4684..45913deb78 100644 --- a/packages/s2-core/src/common/i18n/zh_CN.ts +++ b/packages/s2-core/src/common/i18n/zh_CN.ts @@ -1,7 +1,7 @@ export const ZH_CN = { 小计: '小计', 总计: '总计', - 总和: '总和', + 总和: '(总和)', 项: '项', 已选择: '已选择', 序号: '序号', @@ -16,4 +16,5 @@ export const ZH_CN = { 降序: '降序', 组内降序: '组内降序', 不排序: '不排序', + ',': ',', }; diff --git a/packages/s2-react/src/components/sheets/strategy-sheet/custom-tooltip/custom-data-tooltip.tsx b/packages/s2-react/src/components/sheets/strategy-sheet/custom-tooltip/custom-data-tooltip.tsx index 80bce6d221..9b4938009c 100644 --- a/packages/s2-react/src/components/sheets/strategy-sheet/custom-tooltip/custom-data-tooltip.tsx +++ b/packages/s2-react/src/components/sheets/strategy-sheet/custom-tooltip/custom-data-tooltip.tsx @@ -112,7 +112,8 @@ export const StrategySheetDataTooltip: React.FC = ({ )} {rowDescription && (
- {i18n('说明')}: {rowDescription} + {i18n('说明')} + {rowDescription}
)} diff --git a/packages/s2-react/src/components/sheets/strategy-sheet/custom-tooltip/custom-row-tooltip.tsx b/packages/s2-react/src/components/sheets/strategy-sheet/custom-tooltip/custom-row-tooltip.tsx index d69b744226..fd6f6f3f79 100644 --- a/packages/s2-react/src/components/sheets/strategy-sheet/custom-tooltip/custom-row-tooltip.tsx +++ b/packages/s2-react/src/components/sheets/strategy-sheet/custom-tooltip/custom-row-tooltip.tsx @@ -22,7 +22,8 @@ export const StrategySheetRowTooltip: React.FC = ({
{rowName}
{description && (
- {i18n('说明')}: {description} + {i18n('说明')} + {description}
)} diff --git a/packages/s2-react/src/components/tooltip/components/description.tsx b/packages/s2-react/src/components/tooltip/components/description.tsx index e21f4fdce9..66c1ac4527 100644 --- a/packages/s2-react/src/components/tooltip/components/description.tsx +++ b/packages/s2-react/src/components/tooltip/components/description.tsx @@ -12,7 +12,8 @@ export const TooltipDescription: React.FC = ({ <> {description && (
- {i18n('说明')}:{description} + {i18n('说明')} + {description}
)} diff --git a/packages/s2-react/src/components/tooltip/components/head-info.tsx b/packages/s2-react/src/components/tooltip/components/head-info.tsx index 9048217a5c..37f0156682 100644 --- a/packages/s2-react/src/components/tooltip/components/head-info.tsx +++ b/packages/s2-react/src/components/tooltip/components/head-info.tsx @@ -3,6 +3,7 @@ import { type TooltipDetailListItem, type TooltipHeadInfo, TOOLTIP_PREFIX_CLS, + i18n, } from '@antv/s2'; export const TooltipHead: React.FC = (props) => { @@ -11,7 +12,7 @@ export const TooltipHead: React.FC = (props) => { return (
{cols.map((item: TooltipDetailListItem) => item.value)?.join('/')} - {cols.length > 0 && rows.length > 0 && ','} + {cols.length > 0 && rows.length > 0 && i18n(',')} {rows.map((item: TooltipDetailListItem) => item.value)?.join('/')}
); diff --git a/packages/s2-react/src/components/tooltip/components/summary.tsx b/packages/s2-react/src/components/tooltip/components/summary.tsx index a0e4a839fa..e41275d68f 100644 --- a/packages/s2-react/src/components/tooltip/components/summary.tsx +++ b/packages/s2-react/src/components/tooltip/components/summary.tsx @@ -33,7 +33,8 @@ export const TooltipSummary: React.FC = React.memo( > {name ? ( - {name} ({i18n('总和')}) + {name} + {i18n('总和')} ) : ( diff --git a/packages/s2-shared/src/constant/i18n/en_US.ts b/packages/s2-shared/src/constant/i18n/en_US.ts index 5137f8ca23..91e3386c9d 100644 --- a/packages/s2-shared/src/constant/i18n/en_US.ts +++ b/packages/s2-shared/src/constant/i18n/en_US.ts @@ -30,7 +30,7 @@ export const EN_US: Record = { '按以下规则进行排序(优先级由低到高)': 'Order according to the following rules (from low to high priority)', 按: 'By', - 说明: 'Description', + 说明: 'Description: ', // export 复制原始数据: 'Copy raw data', diff --git a/packages/s2-shared/src/constant/i18n/zh_CN.ts b/packages/s2-shared/src/constant/i18n/zh_CN.ts index 4763cb138b..681ae4bd17 100644 --- a/packages/s2-shared/src/constant/i18n/zh_CN.ts +++ b/packages/s2-shared/src/constant/i18n/zh_CN.ts @@ -30,7 +30,7 @@ export const ZH_CN: Record = { '按以下规则进行排序(优先级由低到高)': '按以下规则进行排序(优先级由低到高)', 按: '按', - 说明: '说明', + 说明: '说明:', // export 复制原始数据: '复制原始数据',