Skip to content

Commit

Permalink
fix: [select] 新增国际化配置
Browse files Browse the repository at this point in the history
  • Loading branch information
haohao_peng authored and albyben committed Jul 31, 2024
1 parent 82d99ab commit 014a70c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
1 change: 0 additions & 1 deletion components/config-provider/compDefaultProps.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,6 @@ const compDefaultProps = {
mode: 'single',
defaultOpen: false,
showArrow: true,
placeholder: '请输入需要搜索的内容',
filterOption: true,
optionLabelProp: 'children',
optionFilterProp: 'label',
Expand Down
6 changes: 4 additions & 2 deletions components/locale/zh-CN.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ const locale = {
locale: 'zh-CN',
...DatePicker,
'global.selectholder': '请选择',
'global.placeholder': '请输入...',
'global.placeholder': '请输入需要搜索的内容',
'global.cancel': '取消',
'global.confirm': '确定',
'global.emptyText': '暂无数据',
'Button.text': '按钮',
'Progress.circleLoadingDesc': '正在加载中',
'Progress.loading': '正在加载中...',
Expand Down Expand Up @@ -78,6 +79,7 @@ const locale = {
'Table.confirmFilter': '确定',
'Select.selectAll': '全选',
'Select.seleted': '已选{size}项',
'Select.total': '共{total}项',
'Signature.clickToSign': '点击签名',
'Signature.pleaseWriteHere': '请在此处横向书写签名',
'Signature.okText': '确定',
Expand All @@ -91,7 +93,7 @@ const locale = {
'Upload.uploading': '文件上传中ing',
'Upload.fail': '上传失败',
'Upload.delete': '删除',
'Notification.title': '系统提示11',
'Notification.title': '系统提示',
}

export default locale
7 changes: 4 additions & 3 deletions components/select/select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const InternalSelect: React.ForwardRefRenderFunction<ISelectProps<SelectValue>>
labelInValue,
children,
options,
placeholder,
placeholder = locale.getLangMsg('global', 'placeholder'),
dropdownStyle = {},
style,
clearIcon,
Expand Down Expand Up @@ -541,7 +541,7 @@ const InternalSelect: React.ForwardRefRenderFunction<ISelectProps<SelectValue>>
[`${selectPrefixCls}-dropdown-empty`]: true,
})
const { notFoundContent } = selectProps
const emptyContent = notFoundContent || '暂无数据'
const emptyContent = notFoundContent || locale.getLangMsg('global', 'emptyText')
return filledOptions?.length === 0 && <div className={emptyListCls}>{emptyContent}</div>
}

Expand Down Expand Up @@ -716,6 +716,7 @@ const InternalSelect: React.ForwardRefRenderFunction<ISelectProps<SelectValue>>
[`${selectPrefixCls}-selection-item-${size}`]: size,
})
const TagStyle = { margin: '2px 8px 2px 0', maxWidth: '100%' }
const totalText = locale.getLangMsg('Select', 'total', { total: mulOptions.length })
return (
<div className={multipleCls} ref={selectionRef}>
{Array.isArray(mulOptions) ? (
Expand Down Expand Up @@ -751,7 +752,7 @@ const InternalSelect: React.ForwardRefRenderFunction<ISelectProps<SelectValue>>
handleMaxTagHolder()
) : (
<span className={itemCls}>
<span className={`${selectPrefixCls}-selection-item-content`}>{mulOptions.length}</span>
<span className={`${selectPrefixCls}-selection-item-content`}>{totalText}</span>
</span>
)
) : null}
Expand Down

0 comments on commit 014a70c

Please sign in to comment.