Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 修复中英文标点符号 #2442

Merged
merged 2 commits into from
Dec 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading