Files
workspace/code/g3soft-libs/packages/ui/src/locale/index.ts
T
2026-10-11 22:14:13 +08:00

335 lines
8.4 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**
* 语言包出口。
*
* 组件不得硬编码中文文案,一律从 locale 取,便于整站切换 / 定制。
* 新增文案时同步补 enUS,保持两个语言包结构一致。
*/
export interface Locale {
name: string
/** 空状态等通用文案。 */
empty: {
description: string
}
/** 跨组件通用文案。 */
common: {
/** 确认(Modal / 日期面板等) */
confirm: string
cancel: string
clear: string
close: string
loading: string
/** 选择类组件的占位文案 */
selectPlaceholder: string
/** 输入类组件的占位文案 */
inputPlaceholder: string
/** 搜索框占位文案 */
searchPlaceholder: string
/** 无匹配结果 */
noMatch: string
}
/** 分页文案,`{total}` / `{page}` 为占位符。 */
pagination: {
total: string
prev: string
next: string
page: string
pageSize: string
goto: string
}
/** 日期类组件文案,`{year}` / `{month}` 为占位符。 */
date: {
placeholder: string
startPlaceholder: string
endPlaceholder: string
today: string
now: string
year: string
month: string
weekdays: string[]
months: string[]
}
/**
* 表单校验文案,`{label}` / `{len}` / `{min}` / `{max}` 为占位符;
* label 为空时会连同其后空白一起移除。
*/
form: {
required: string
type: string
pattern: string
len: string
min: string
max: string
invalid: string
}
/** 验证码类组件文案。 */
captcha: {
/** 滑块验证:未通过时的提示 */
slide: string
/** 滑块验证:通过后的文案 */
verified: string
/** 滑块验证:手柄的可访问名称(读屏 / 键盘聚焦时播报) */
sliderLabel: string
}
/**
* 附件管理器文案,`{count}` / `{name}` / `{size}` 为占位符。
*/
attachment: {
allCategory: string
selectAll: string
selected: string
select: string
upload: string
download: string
remove: string
preview: string
pending: string
pendingCount: string
total: string
empty: string
emptyHint: string
limitAccept: string
limitSize: string
limitCount: string
dropHint: string
previewEmpty: string
prev: string
next: string
removeConfirm: string
removeConfirmSingle: string
invalidAccept: string
invalidMaxSize: string
invalidMaxCount: string
}
/** 结果 / 缺省页文案(403 / 404 / 500 / 离线 / 空状态)。 */
result: {
'403': { title: string; desc: string }
'404': { title: string; desc: string }
'500': { title: string; desc: string }
offline: { title: string; desc: string }
empty: { title: string; desc: string }
}
}
export const zhCN: Locale = {
name: 'zh-CN',
empty: { description: '暂无数据' },
common: {
confirm: '确定',
cancel: '取消',
clear: '清空',
close: '关闭',
loading: '加载中',
selectPlaceholder: '请选择',
inputPlaceholder: '请输入',
searchPlaceholder: '搜索',
noMatch: '无匹配数据',
},
pagination: {
total: '共 {total} 条',
prev: '上一页',
next: '下一页',
page: '页',
pageSize: '条/页',
goto: '前往',
},
date: {
placeholder: '请选择日期',
startPlaceholder: '开始日期',
endPlaceholder: '结束日期',
today: '今天',
now: '此刻',
year: '{year} 年',
month: '{month} 月',
// 与日历矩阵一致:周日开头
weekdays: ['日', '一', '二', '三', '四', '五', '六'],
months: [
'1 月',
'2 月',
'3 月',
'4 月',
'5 月',
'6 月',
'7 月',
'8 月',
'9 月',
'10 月',
'11 月',
'12 月',
],
},
form: {
required: '{label}不能为空',
type: '{label}格式不正确',
pattern: '{label}格式不正确',
len: '{label}长度必须为 {len}',
min: '{label}长度不能少于 {min}',
max: '{label}长度不能超过 {max}',
invalid: '{label}校验未通过',
},
captcha: {
slide: '按住滑块拖动',
verified: '验证通过',
sliderLabel: '滑动验证',
},
attachment: {
allCategory: '全部',
selectAll: '全选',
selected: '已选 {count} 项',
select: '选择',
upload: '上传',
download: '下载',
remove: '删除',
preview: '预览',
pending: '待上传',
pendingCount: '待上传 {count} 个',
total: '共 {count} 个文件',
empty: '暂无文件',
emptyHint: '拖拽文件到此处,或点击选择',
limitAccept: '支持格式:{accept}',
limitSize: '单个文件不超过 {size}',
limitCount: '最多 {count} 个待上传',
dropHint: '释放文件到此处',
previewEmpty: '选择文件查看预览',
prev: '上一个',
next: '下一个',
removeConfirm: '确定删除选中的 {count} 个文件?',
removeConfirmSingle: '确定删除「{name}」?',
invalidAccept: '「{name}」类型不支持',
invalidMaxSize: '「{name}」超过大小限制({size})',
invalidMaxCount: '待上传文件最多 {count} 个',
},
result: {
'403': {
title: '无权访问',
desc: '你没有访问该页面的权限,请联系管理员',
},
'404': {
title: '页面不存在',
desc: '你访问的页面不存在或已被移除',
},
'500': {
title: '页面出错了',
desc: '服务暂时不可用,请稍后重试',
},
offline: {
title: '网络已断开',
desc: '请检查网络连接后重试',
},
empty: {
title: '暂无数据',
desc: '',
},
},
}
export const enUS: Locale = {
name: 'en-US',
empty: { description: 'No data' },
common: {
confirm: 'OK',
cancel: 'Cancel',
clear: 'Clear',
close: 'Close',
loading: 'Loading',
selectPlaceholder: 'Please select',
inputPlaceholder: 'Please input',
searchPlaceholder: 'Search',
noMatch: 'No matching data',
},
pagination: {
total: 'Total {total}',
prev: 'Previous',
next: 'Next',
page: 'Page',
pageSize: '/ page',
goto: 'Go to',
},
date: {
placeholder: 'Select date',
startPlaceholder: 'Start date',
endPlaceholder: 'End date',
today: 'Today',
now: 'Now',
year: '{year}',
month: '{month}',
weekdays: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
months: [
'Jan',
'Feb',
'Mar',
'Apr',
'May',
'Jun',
'Jul',
'Aug',
'Sep',
'Oct',
'Nov',
'Dec',
],
},
form: {
required: '{label} is required',
type: '{label} format is invalid',
pattern: '{label} format is invalid',
len: '{label} length must be {len}',
min: '{label} length must be at least {min}',
max: '{label} length must be at most {max}',
invalid: '{label} failed validation',
},
captcha: {
slide: 'Slide to verify',
verified: 'Verified',
sliderLabel: 'Slide verification',
},
attachment: {
allCategory: 'All',
selectAll: 'Select all',
selected: '{count} selected',
select: 'Choose',
upload: 'Upload',
download: 'Download',
remove: 'Delete',
preview: 'Preview',
pending: 'Pending',
pendingCount: '{count} pending',
total: '{count} files',
empty: 'No files',
emptyHint: 'Drop files here, or click to choose',
limitAccept: 'Accepted: {accept}',
limitSize: 'Up to {size} per file',
limitCount: 'At most {count} pending',
dropHint: 'Drop files here',
previewEmpty: 'Select a file to preview',
prev: 'Previous',
next: 'Next',
removeConfirm: 'Delete the {count} selected files?',
removeConfirmSingle: 'Delete "{name}"?',
invalidAccept: '"{name}" is not an accepted file type',
invalidMaxSize: '"{name}" exceeds the size limit ({size})',
invalidMaxCount: 'At most {count} pending files',
},
result: {
'403': {
title: 'Access Denied',
desc: 'You do not have permission to view this page. Please contact an administrator.',
},
'404': {
title: 'Page Not Found',
desc: 'The page you visited does not exist or has been removed',
},
'500': {
title: 'Something Went Wrong',
desc: 'The service is temporarily unavailable. Please try again later.',
},
offline: {
title: 'You Are Offline',
desc: 'Please check your network connection and try again',
},
empty: {
title: 'No Data',
desc: '',
},
},
}