Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[l10n] Add Catalan (Spain) (ca-ES) and improve Spanish (es-ES) locales #8498

Merged
merged 4 commits into from
Apr 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);