diff --git a/docs/data/date-pickers/localization/data.json b/docs/data/date-pickers/localization/data.json index 6874c9a28d40a..ff28faa14da27 100644 --- a/docs/data/date-pickers/localization/data.json +++ b/docs/data/date-pickers/localization/data.json @@ -47,6 +47,14 @@ "totalKeysCount": 50, "githubLink": "https://github.com/mui/mui-x/blob/master/packages/x-date-pickers/src/locales/zhCN.ts" }, + { + "languageTag": "zh-TW", + "importName": "zhTW", + "localeName": "Chinese (Taiwan)", + "missingKeysCount": 0, + "totalKeysCount": 50, + "githubLink": "https://github.com/mui/mui-x/blob/master/packages/x-date-pickers/src/locales/zhTW.ts" + }, { "languageTag": "hr-HR", "importName": "hrHR", diff --git a/packages/x-date-pickers/src/locales/index.ts b/packages/x-date-pickers/src/locales/index.ts index 9ea2122168861..48832165f8c62 100644 --- a/packages/x-date-pickers/src/locales/index.ts +++ b/packages/x-date-pickers/src/locales/index.ts @@ -36,4 +36,5 @@ export * from './urPK'; export * from './viVN'; export * from './zhCN'; export * from './zhHK'; +export * from './zhTW'; export * from './utils/pickersLocaleTextApi'; diff --git a/packages/x-date-pickers/src/locales/zhTW.ts b/packages/x-date-pickers/src/locales/zhTW.ts new file mode 100644 index 0000000000000..2c85c8c0bd518 --- /dev/null +++ b/packages/x-date-pickers/src/locales/zhTW.ts @@ -0,0 +1,94 @@ +import { PickersLocaleText } from './utils/pickersLocaleTextApi'; +import { getPickersLocalization } from './utils/getPickersLocalization'; +import { TimeViewWithMeridiem } from '../internals/models'; + +const views: Record = { + hours: '小時', + minutes: '分鐘', + seconds: '秒', + meridiem: '十二小時制', +}; + +const zhTWPickers: Partial = { + // Calendar navigation + previousMonth: '上個月', + nextMonth: '下個月', + + // View navigation + openPreviousView: '前一個視圖', + openNextView: '下一個視圖', + calendarViewSwitchingButtonAriaLabel: (view) => + view === 'year' ? '年視圖已打開,切換為日曆視圖' : '日曆視圖已打開,切換為年視圖', + + // DateRange labels + start: '開始', + end: '結束', + startDate: '開始日期', + startTime: '開始時間', + endDate: '結束日期', + endTime: '結束時間', + + // Action bar + cancelButtonLabel: '取消', + clearButtonLabel: '清除', + okButtonLabel: '確認', + todayButtonLabel: '今天', + + // Toolbar titles + datePickerToolbarTitle: '選擇日期', + dateTimePickerToolbarTitle: '選擇日期和時間', + timePickerToolbarTitle: '選擇時間', + dateRangePickerToolbarTitle: '選擇時間範圍', + + // Clock labels + clockLabelText: (view, formattedTime) => + `選擇 ${views[view]}. ${!formattedTime ? '未選擇時間' : `已選擇${formattedTime}`}`, + hoursClockNumberText: (hours) => `${hours}小時`, + minutesClockNumberText: (minutes) => `${minutes}分鐘`, + secondsClockNumberText: (seconds) => `${seconds}秒`, + + // Digital clock labels + selectViewText: (view) => `選擇 ${views[view]}`, + + // Calendar labels + calendarWeekNumberHeaderLabel: '週數', + calendarWeekNumberHeaderText: '#', + calendarWeekNumberAriaLabelText: (weekNumber) => `第${weekNumber}週`, + calendarWeekNumberText: (weekNumber) => `${weekNumber}`, + + // Open picker labels + openDatePickerDialogue: (formattedDate) => + formattedDate ? `選擇日期,已選擇${formattedDate}` : '選擇日期', + openTimePickerDialogue: (formattedTime) => + formattedTime ? `選擇時間,已選擇${formattedTime}` : '選擇時間', + fieldClearLabel: '清除', + + // Table labels + timeTableLabel: '選擇時間', + dateTableLabel: '選擇日期', + + // Field section placeholders + fieldYearPlaceholder: (params) => 'Y'.repeat(params.digitAmount), + fieldMonthPlaceholder: (params) => (params.contentType === 'letter' ? 'MMMM' : 'MM'), + fieldDayPlaceholder: () => 'DD', + fieldWeekDayPlaceholder: (params) => (params.contentType === 'letter' ? 'EEEE' : 'EE'), + fieldHoursPlaceholder: () => 'hh', + fieldMinutesPlaceholder: () => 'mm', + fieldSecondsPlaceholder: () => 'ss', + fieldMeridiemPlaceholder: () => 'aa', + + // View names + year: '年份', + month: '月份', + day: '日期', + weekDay: '星期', + hours: '時', + minutes: '分', + seconds: '秒', + meridiem: '十二小時制', + + // Common + empty: '空', +}; + +export const zhTW = getPickersLocalization(zhTWPickers);