Skip to content

Commit

Permalink
fix: 修复中英文标点符号 (#2442)
Browse files Browse the repository at this point in the history
* fix: 修复中英文标点符号

* test: 单测修复
  • Loading branch information
wjgogogo authored Dec 1, 2023
1 parent 3439da8 commit 17a2d00
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 11 deletions.
6 changes: 4 additions & 2 deletions packages/s2-core/__tests__/unit/common/i18n/index-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,27 +19,29 @@ 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');
expect(i18n('度量')).toEqual('Measure');
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('序号');
expect(i18n('度量')).toEqual('度量');
expect(i18n('数值')).toEqual('数值');
expect(i18n('共计')).toEqual('共计');
expect(i18n('条')).toEqual('条');
expect(i18n(',')).toEqual(',');
});
});
3 changes: 2 additions & 1 deletion packages/s2-core/src/common/i18n/en_US.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export const EN_US = {
小计: 'Total',
总计: 'Total',
总和: 'SUM',
总和: '(SUM)',
: 'items',
已选择: 'selected',
序号: 'Index',
Expand All @@ -16,4 +16,5 @@ export const EN_US = {
升序: 'ASC',
降序: 'DESC',
不排序: 'No order',
',': ', ',
};
3 changes: 2 additions & 1 deletion packages/s2-core/src/common/i18n/zh_CN.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export const ZH_CN = {
小计: '小计',
总计: '总计',
总和: '总和',
总和: '(总和)',
: '项',
已选择: '已选择',
序号: '序号',
Expand All @@ -16,4 +16,5 @@ export const ZH_CN = {
降序: '降序',
组内降序: '组内降序',
不排序: '不排序',
',': ',',
};
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ export const StrategySheetDataTooltip: React.FC<CustomTooltipProps> = ({
)}
{rowDescription && (
<div className={tooltipCls('description')}>
{i18n('说明')}: {rowDescription}
{i18n('说明')}
{rowDescription}
</div>
)}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ export const StrategySheetRowTooltip: React.FC<CustomTooltipProps> = ({
<div className={tooltipCls('value')}>{rowName}</div>
{description && (
<div className={tooltipCls('description')}>
{i18n('说明')}: {description}
{i18n('说明')}
{description}
</div>
)}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ export const TooltipDescription: React.FC<TooltipDescriptionProps> = ({
<>
{description && (
<div className={`${TOOLTIP_PREFIX_CLS}-description`}>
{i18n('说明')}{description}
{i18n('说明')}
{description}
</div>
)}
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
type TooltipDetailListItem,
type TooltipHeadInfo,
TOOLTIP_PREFIX_CLS,
i18n,
} from '@antv/s2';

export const TooltipHead: React.FC<TooltipHeadInfo> = (props) => {
Expand All @@ -11,7 +12,7 @@ export const TooltipHead: React.FC<TooltipHeadInfo> = (props) => {
return (
<div className={`${TOOLTIP_PREFIX_CLS}-head-info-list`}>
{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('/')}
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ export const TooltipSummary: React.FC<TooltipSummaryProps> = React.memo(
>
{name ? (
<span className={`${TOOLTIP_PREFIX_CLS}-summary-key`}>
{name}{i18n('总和')})
{name}
{i18n('总和')}
</span>
) : (
<span className={`${TOOLTIP_PREFIX_CLS}-summary-key`}>
Expand Down
2 changes: 1 addition & 1 deletion packages/s2-shared/src/constant/i18n/en_US.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const EN_US: Record<string, string> = {
'按以下规则进行排序(优先级由低到高)':
'Order according to the following rules (from low to high priority)',
: 'By',
说明: 'Description',
说明: 'Description: ',

// export
复制原始数据: 'Copy raw data',
Expand Down
2 changes: 1 addition & 1 deletion packages/s2-shared/src/constant/i18n/zh_CN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const ZH_CN: Record<string, string> = {
'按以下规则进行排序(优先级由低到高)':
'按以下规则进行排序(优先级由低到高)',
: '按',
说明: '说明',
说明: '说明',

// export
复制原始数据: '复制原始数据',
Expand Down

1 comment on commit 17a2d00

@vercel
Copy link

@vercel vercel bot commented on 17a2d00 Dec 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.