From 79bfe9ae6f1502645d2b71a31318a0b185d347b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A1n=20Bustos=20Paz?= Date: Tue, 4 Apr 2023 14:05:46 +0200 Subject: [PATCH] [l10n] Add Catalan (Spain) (ca-ES) and improve Spanish (es-ES) locales (#8498) Co-authored-by: Adrian Bustos Paz Co-authored-by: alexandre --- docs/data/date-pickers/localization/data.json | 10 ++- packages/x-date-pickers/src/locales/caES.ts | 81 +++++++++++++++++++ packages/x-date-pickers/src/locales/esES.ts | 26 +++--- 3 files changed, 103 insertions(+), 14 deletions(-) create mode 100644 packages/x-date-pickers/src/locales/caES.ts diff --git a/docs/data/date-pickers/localization/data.json b/docs/data/date-pickers/localization/data.json index 1a1eb681e165b..4daa160149fce 100644 --- a/docs/data/date-pickers/localization/data.json +++ b/docs/data/date-pickers/localization/data.json @@ -7,6 +7,14 @@ "totalKeysCount": 35, "githubLink": "https://github.com/mui/mui-x/blob/master/packages/x-date-pickers/src/locales/beBY.ts" }, + { + "languageTag": "ca-ES", + "importName": "caES", + "localeName": "Catalan", + "missingKeysCount": 0, + "totalKeysCount": 35, + "githubLink": "https://github.com/mui/mui-x/blob/master/packages/x-date-pickers/src/locales/caES.ts" + }, { "languageTag": "zh-CN", "importName": "zhCN", @@ -163,7 +171,7 @@ "languageTag": "es-ES", "importName": "esES", "localeName": "Spanish", - "missingKeysCount": 12, + "missingKeysCount": 0, "totalKeysCount": 35, "githubLink": "https://github.com/mui/mui-x/blob/master/packages/x-date-pickers/src/locales/esES.ts" }, diff --git a/packages/x-date-pickers/src/locales/caES.ts b/packages/x-date-pickers/src/locales/caES.ts new file mode 100644 index 0000000000000..921767ba3f8d4 --- /dev/null +++ b/packages/x-date-pickers/src/locales/caES.ts @@ -0,0 +1,81 @@ +import { PickersLocaleText } from './utils/pickersLocaleTextApi'; +import { getPickersLocalization } from './utils/getPickersLocalization'; + +const views = { + hours: 'les hores', + minutes: 'els minuts', + seconds: 'els segons', +}; + +const caESPickers: Partial> = { + // Calendar navigation + previousMonth: 'Últim mes', + nextMonth: 'Pròxim mes', + + // View navigation + openPreviousView: "obrir l'última vista", + openNextView: 'obrir la següent vista', + calendarViewSwitchingButtonAriaLabel: (view) => + view === 'year' + ? "la vista de l'any està oberta, canvie a la vista de calendari" + : "la vista de calendari està oberta, canvie a la vista de l'any", + + // DateRange placeholders + start: 'Començar', + end: 'Terminar', + + // Action bar + cancelButtonLabel: 'Cancel·lar', + clearButtonLabel: 'Netejar', + okButtonLabel: 'OK', + todayButtonLabel: 'Hui', + + // Toolbar titles + datePickerToolbarTitle: 'Seleccionar data', + dateTimePickerToolbarTitle: 'Seleccionar data i hora', + timePickerToolbarTitle: 'Seleccionar hora', + dateRangePickerToolbarTitle: 'Seleccionar rang de dates', + + // Clock labels + clockLabelText: (view, time, adapter) => + `Seleccione ${views[view]}. ${ + time === null + ? 'Sense temps seleccionat' + : `El temps seleccionat és ${adapter.format(time, 'fullTime')}` + }`, + hoursClockNumberText: (hours) => `${hours} hores`, + minutesClockNumberText: (minutes) => `${minutes} minuts`, + secondsClockNumberText: (seconds) => `${seconds} segons`, + + // Calendar labels + calendarWeekNumberHeaderLabel: 'Número de setmana', + calendarWeekNumberHeaderText: '#', + calendarWeekNumberAriaLabelText: (weekNumber) => `Setmana ${weekNumber}`, + calendarWeekNumberText: (weekNumber) => `${weekNumber}`, + + // Open picker labels + openDatePickerDialogue: (value, utils) => + value !== null && utils.isValid(value) + ? `Tria la data, la data triada és ${utils.format(value, 'fullDate')}` + : 'Tria la data', + openTimePickerDialogue: (value, utils) => + value !== null && utils.isValid(value) + ? `Tria l'hora, l'hora triada és ${utils.format(value, 'fullTime')}` + : "Tria l'hora", + + // Table labels + timeTableLabel: 'tria la data', + dateTableLabel: "tria l'hora", + + // 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', +}; + +export const caES = getPickersLocalization(caESPickers); diff --git a/packages/x-date-pickers/src/locales/esES.ts b/packages/x-date-pickers/src/locales/esES.ts index f7f120cddf369..fd28744db22bc 100644 --- a/packages/x-date-pickers/src/locales/esES.ts +++ b/packages/x-date-pickers/src/locales/esES.ts @@ -32,7 +32,7 @@ const esESPickers: Partial> = { // Toolbar titles datePickerToolbarTitle: 'Seleccionar fecha', - dateTimePickerToolbarTitle: 'Seleccionar fecha & hora', + dateTimePickerToolbarTitle: 'Seleccionar fecha y hora', timePickerToolbarTitle: 'Seleccionar hora', dateRangePickerToolbarTitle: 'Seleccionar rango de fecha', @@ -48,10 +48,10 @@ const esESPickers: Partial> = { secondsClockNumberText: (seconds) => `${seconds} segundos`, // Calendar labels - // calendarWeekNumberHeaderLabel: 'Week number', - // calendarWeekNumberHeaderText: '#', - // calendarWeekNumberAriaLabelText: weekNumber => `Week ${weekNumber}`, - // calendarWeekNumberText: weekNumber => `${weekNumber}`, + calendarWeekNumberHeaderLabel: 'Número de semana', + calendarWeekNumberHeaderText: '#', + calendarWeekNumberAriaLabelText: (weekNumber) => `Semana ${weekNumber}`, + calendarWeekNumberText: (weekNumber) => `${weekNumber}`, // Open picker labels openDatePickerDialogue: (value, utils) => @@ -68,14 +68,14 @@ const esESPickers: Partial> = { dateTableLabel: 'elige la hora', // 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', + 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', }; export const esES = getPickersLocalization(esESPickers);