Skip to content

Commit

Permalink
[l10n] Add Catalan (Spain) (ca-ES) and improve Spanish (es-ES) locales (
Browse files Browse the repository at this point in the history
#8498)

Co-authored-by: Adrian Bustos Paz <abuspaz2@uv.es>
Co-authored-by: alexandre <alex.fauquette@gmail.com>
  • Loading branch information
3 people authored Apr 4, 2023
1 parent 5f052a1 commit 7873522
Show file tree
Hide file tree
Showing 3 changed files with 103 additions and 14 deletions.
10 changes: 9 additions & 1 deletion docs/data/date-pickers/localization/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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"
},
Expand Down
81 changes: 81 additions & 0 deletions packages/x-date-pickers/src/locales/caES.ts
Original file line number Diff line number Diff line change
@@ -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<PickersLocaleText<any>> = {
// 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);
26 changes: 13 additions & 13 deletions packages/x-date-pickers/src/locales/esES.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const esESPickers: Partial<PickersLocaleText<any>> = {

// Toolbar titles
datePickerToolbarTitle: 'Seleccionar fecha',
dateTimePickerToolbarTitle: 'Seleccionar fecha & hora',
dateTimePickerToolbarTitle: 'Seleccionar fecha y hora',
timePickerToolbarTitle: 'Seleccionar hora',
dateRangePickerToolbarTitle: 'Seleccionar rango de fecha',

Expand All @@ -48,10 +48,10 @@ const esESPickers: Partial<PickersLocaleText<any>> = {
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) =>
Expand All @@ -68,14 +68,14 @@ const esESPickers: Partial<PickersLocaleText<any>> = {
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);

0 comments on commit 7873522

Please sign in to comment.