Skip to content

Commit

Permalink
[I10n] Improve Chinese (zh-CN) locale (#12245)
Browse files Browse the repository at this point in the history
Signed-off-by: headiron <[email protected]>
  • Loading branch information
headironc authored and web-flow committed Feb 28, 2024
1 parent cc1f0ef commit 1306d3b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
6 changes: 3 additions & 3 deletions docs/data/date-pickers/localization/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@
"languageTag": "zh-CN",
"importName": "zhCN",
"localeName": "Chinese (Simplified)",
"missingKeysCount": 1,
"totalKeysCount": 37,
"githubLink": "https://github.com/mui/mui-x/blob/master/packages/x-date-pickers/src/locales/zhCN.ts"
"missingKeysCount": 0,
"totalKeysCount": 50,
"githubLink": "https://github.com/mui/mui-x/blob/next/packages/x-date-pickers/src/locales/zhCN.ts"
},
{
"languageTag": "cs-CZ",
Expand Down
21 changes: 19 additions & 2 deletions packages/x-date-pickers/src/locales/zhCN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const views: Record<TimeViewWithMeridiem, string> = {
hours: '小时',
minutes: '分钟',
seconds: '秒',
meridiem: '子午线',
meridiem: '十二小时制',
};

const zhCNPickers: Partial<PickersLocaleText<any>> = {
Expand All @@ -23,6 +23,10 @@ const zhCNPickers: Partial<PickersLocaleText<any>> = {
// DateRange placeholders
start: '开始',
end: '结束',
startDate: '开始日期',
startTime: '开始时间',
endDate: '结束日期',
endTime: '结束时间',

// Action bar
cancelButtonLabel: '取消',
Expand Down Expand Up @@ -63,7 +67,7 @@ const zhCNPickers: Partial<PickersLocaleText<any>> = {
value !== null && utils.isValid(value)
? `选择时间,已选择${utils.format(value, 'fullTime')}`
: '选择时间',
// fieldClearLabel: 'Clear value',
fieldClearLabel: '清除',

// Table labels
timeTableLabel: '选择时间',
Expand All @@ -78,6 +82,19 @@ const zhCNPickers: Partial<PickersLocaleText<any>> = {
fieldMinutesPlaceholder: () => 'mm',
fieldSecondsPlaceholder: () => 'ss',
fieldMeridiemPlaceholder: () => 'aa',

// View names
year: '年份',
month: '月份',
day: '日期',
weekDay: '星期',
hours: '时',
minutes: '分',
seconds: '秒',
meridiem: '十二小时制',

// Common
empty: '空',
};

export const zhCN = getPickersLocalization(zhCNPickers);

0 comments on commit 1306d3b

Please sign in to comment.