diff --git a/docs/data/date-pickers/localization/data.json b/docs/data/date-pickers/localization/data.json index e4f077b2a1f49..2adcf451219a4 100644 --- a/docs/data/date-pickers/localization/data.json +++ b/docs/data/date-pickers/localization/data.json @@ -1,4 +1,12 @@ [ + { + "languageTag": "eu", + "importName": "eu", + "localeName": "Basque", + "missingKeysCount": 0, + "totalKeysCount": 37, + "githubLink": "https://github.com/mui/mui-x/blob/master/packages/x-date-pickers/src/locales/eu.ts" + }, { "languageTag": "be-BY", "importName": "beBY", @@ -203,7 +211,7 @@ "languageTag": "es-ES", "importName": "esES", "localeName": "Spanish", - "missingKeysCount": 1, + "missingKeysCount": 0, "totalKeysCount": 37, "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/esES.ts b/packages/x-date-pickers/src/locales/esES.ts index e4cbf8c416438..c355724c62c79 100644 --- a/packages/x-date-pickers/src/locales/esES.ts +++ b/packages/x-date-pickers/src/locales/esES.ts @@ -42,8 +42,8 @@ const esESPickers: Partial> = { clockLabelText: (view, time, adapter) => `Seleccione ${views[view]}. ${ time === null - ? 'Sin tiempo seleccionado' - : `El tiempo seleccionado es ${adapter.format(time, 'fullTime')}` + ? 'No hay hora seleccionada' + : `La hora seleccionada es ${adapter.format(time, 'fullTime')}` }`, hoursClockNumberText: (hours) => `${hours} horas`, minutesClockNumberText: (minutes) => `${minutes} minutos`, @@ -61,17 +61,17 @@ const esESPickers: Partial> = { // Open picker labels openDatePickerDialogue: (value, utils) => value !== null && utils.isValid(value) - ? `Elige la fecha, la fecha elegida es ${utils.format(value, 'fullDate')}` - : 'Elige la fecha', + ? `Elige fecha, la fecha elegida es ${utils.format(value, 'fullDate')}` + : 'Elige fecha', openTimePickerDialogue: (value, utils) => value !== null && utils.isValid(value) - ? `Elige la hora, la hora elegido es ${utils.format(value, 'fullTime')}` - : 'Elige la hora', - // fieldClearLabel: 'Clear value', + ? `Elige hora, la hora elegida es ${utils.format(value, 'fullTime')}` + : 'Elige hora', + fieldClearLabel: 'Limpiar valor', // Table labels - timeTableLabel: 'elige la fecha', - dateTableLabel: 'elige la hora', + timeTableLabel: 'elige hora', + dateTableLabel: 'elige fecha', // Field section placeholders fieldYearPlaceholder: (params) => 'A'.repeat(params.digitAmount), diff --git a/packages/x-date-pickers/src/locales/eu.ts b/packages/x-date-pickers/src/locales/eu.ts new file mode 100644 index 0000000000000..d99e2febb7a18 --- /dev/null +++ b/packages/x-date-pickers/src/locales/eu.ts @@ -0,0 +1,87 @@ +import { PickersLocaleText } from './utils/pickersLocaleTextApi'; +import { getPickersLocalization } from './utils/getPickersLocalization'; +import { TimeViewWithMeridiem } from '../internals/models'; + +const views: Record = { + hours: 'orduak', + minutes: 'minutuak', + seconds: 'segunduak', + meridiem: 'meridianoa', +}; + +const euPickers: Partial> = { + // Calendar navigation + previousMonth: 'Azken hilabetea', + nextMonth: 'Hurrengo hilabetea', + + // View navigation + openPreviousView: 'azken bista ireki', + openNextView: 'hurrengo bista ireki', + calendarViewSwitchingButtonAriaLabel: (view) => + view === 'year' + ? 'urteko bista irekita dago, aldatu egutegi bistara' + : 'egutegi bista irekita dago, aldatu urteko bistara', + + // DateRange placeholders + start: 'Hasi', + end: 'Bukatu', + + // Action bar + cancelButtonLabel: 'Utxi', + clearButtonLabel: 'Garbitu', + okButtonLabel: 'OK', + todayButtonLabel: 'Gaur', + + // Toolbar titles + datePickerToolbarTitle: 'Data aukeratu', + dateTimePickerToolbarTitle: 'Data eta ordua aukeratu', + timePickerToolbarTitle: 'Ordua aukeratu', + dateRangePickerToolbarTitle: 'Data tartea aukeratu', + + // Clock labels + clockLabelText: (view, time, adapter) => + `Aukeratu ${views[view]}. ${ + time === null + ? 'Ez da ordurik aukertau' + : `Aukeratutako ordua ${adapter.format(time, 'fullTime')} da` + }`, + hoursClockNumberText: (hours) => `${hours} ordu`, + minutesClockNumberText: (minutes) => `${minutes} minutu`, + secondsClockNumberText: (seconds) => `${seconds} segundu`, + + // Digital clock labels + selectViewText: (view) => `Aukeratu ${views[view]}`, + + // Calendar labels + calendarWeekNumberHeaderLabel: 'Astea zenbakia', + calendarWeekNumberHeaderText: '#', + calendarWeekNumberAriaLabelText: (weekNumber) => `${weekNumber} astea`, + calendarWeekNumberText: (weekNumber) => `${weekNumber}`, + + // Open picker labels + openDatePickerDialogue: (value, utils) => + value !== null && utils.isValid(value) + ? `Data aukeratu, aukeratutako data ${utils.format(value, 'fullDate')} da` + : 'Data aukeratu', + openTimePickerDialogue: (value, utils) => + value !== null && utils.isValid(value) + ? `Ordua aukeratu, aukeratutako ordua ${utils.format(value, 'fullTime')} da` + : 'Ordua aukeratu', + fieldClearLabel: 'Balioa garbitu', + + // Table labels + timeTableLabel: 'ordua aukeratu', + dateTableLabel: 'data aukeratu', + + // 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 eu = getPickersLocalization(euPickers); diff --git a/packages/x-date-pickers/src/locales/index.ts b/packages/x-date-pickers/src/locales/index.ts index 610e3d41a476a..410f06361fae0 100644 --- a/packages/x-date-pickers/src/locales/index.ts +++ b/packages/x-date-pickers/src/locales/index.ts @@ -5,6 +5,7 @@ export * from './deDE'; export * from './elGR'; export * from './enUS'; export * from './esES'; +export * from './eu'; export * from './faIR'; export * from './fiFI'; export * from './frFR'; diff --git a/scripts/l10n.ts b/scripts/l10n.ts index 932119f26b745..25e9d2ceaee18 100644 --- a/scripts/l10n.ts +++ b/scripts/l10n.ts @@ -67,7 +67,7 @@ function plugin(existingTranslations: Translations): babel.PluginObj { } // Test if the variable name follows the pattern xxXXGrid or xxXXPickers - if (!/[a-z]{2}[A-Z]{2}(Grid|Pickers)/.test(node.id.name)) { + if (!/[a-z]{2}[A-Z]{2}|[a-z]{2}(Grid|Pickers)/.test(node.id.name)) { visitorPath.skip(); return; } @@ -164,7 +164,7 @@ function extractTranslations(translationsPath: string): [TranslationsByGroup, Tr function findLocales(localesDirectory: string, constantsPath: string) { const items = fse.readdirSync(localesDirectory); const locales: any[] = []; - const localeRegex = /^[a-z]{2}[A-Z]{2}/; + const localeRegex = /^[a-z]{2}[A-Z]{2}|^[a-z]{2}(?=.ts)/; items.forEach((item) => { const match = item.match(localeRegex); @@ -173,7 +173,10 @@ function findLocales(localesDirectory: string, constantsPath: string) { } const localePath = path.resolve(localesDirectory, item); - const code = match[0]; + if (fse.lstatSync(localePath).isDirectory()) { + return; + } + const code = match[0] || match[1]; if (constantsPath !== localePath) { // Ignore the locale used as a reference locales.push([localePath, code]); @@ -321,9 +324,10 @@ const generateDocReport = async ( return; } - const languageTag = `${importName.slice(0, 2).toLowerCase()}-${importName - .slice(2) - .toUpperCase()}`; + const languageTag = + importName.length > 2 + ? `${importName.slice(0, 2).toLowerCase()}-${importName.slice(2).toUpperCase()}` + : importName; const localeName = localeNames[languageTag]; if (localeName === undefined) { diff --git a/scripts/localeNames.js b/scripts/localeNames.js index f989f27b97c57..24ff47a663615 100644 --- a/scripts/localeNames.js +++ b/scripts/localeNames.js @@ -6,6 +6,7 @@ module.exports = { 'hy-AM': 'Armenian', 'az-AZ': 'Azerbaijani', 'bn-BD': 'Bangla', + eu: 'Basque', 'be-BY': 'Belarusian', 'bg-BG': 'Bulgarian', 'ca-ES': 'Catalan', diff --git a/scripts/x-date-pickers-pro.exports.json b/scripts/x-date-pickers-pro.exports.json index 42f2f6b4027ba..5002ac2590cdb 100644 --- a/scripts/x-date-pickers-pro.exports.json +++ b/scripts/x-date-pickers-pro.exports.json @@ -128,6 +128,7 @@ { "name": "elGR", "kind": "Variable" }, { "name": "enUS", "kind": "Variable" }, { "name": "esES", "kind": "Variable" }, + { "name": "eu", "kind": "Variable" }, { "name": "ExportedDateRangeCalendarProps", "kind": "Interface" }, { "name": "ExportedDigitalClockProps", "kind": "Interface" }, { "name": "ExportedMultiSectionDigitalClockSectionProps", "kind": "Interface" }, diff --git a/scripts/x-date-pickers.exports.json b/scripts/x-date-pickers.exports.json index 08052f41bf95f..9b3b709474868 100644 --- a/scripts/x-date-pickers.exports.json +++ b/scripts/x-date-pickers.exports.json @@ -98,6 +98,7 @@ { "name": "elGR", "kind": "Variable" }, { "name": "enUS", "kind": "Variable" }, { "name": "esES", "kind": "Variable" }, + { "name": "eu", "kind": "Variable" }, { "name": "ExportedDigitalClockProps", "kind": "Interface" }, { "name": "ExportedMultiSectionDigitalClockSectionProps", "kind": "Interface" }, { "name": "ExportedPickersCalendarHeaderProps", "kind": "TypeAlias" },