From 11bc0ffe69c1f4feff9dc8e792eb464039945083 Mon Sep 17 00:00:00 2001 From: Anders Lund <61545005+AnderzL7@users.noreply.github.com> Date: Tue, 23 Jul 2024 09:20:13 +0200 Subject: [PATCH] [l10n] Add Norwegian Nynorsk (nn-NO) locale (#13946) --- docs/data/date-pickers/localization/data.json | 8 ++ packages/x-date-pickers/src/locales/index.ts | 1 + packages/x-date-pickers/src/locales/nnNO.ts | 100 ++++++++++++++++++ 3 files changed, 109 insertions(+) create mode 100644 packages/x-date-pickers/src/locales/nnNO.ts diff --git a/docs/data/date-pickers/localization/data.json b/docs/data/date-pickers/localization/data.json index eda4bb64d8385..9e60d0001b7e5 100644 --- a/docs/data/date-pickers/localization/data.json +++ b/docs/data/date-pickers/localization/data.json @@ -167,6 +167,14 @@ "totalKeysCount": 50, "githubLink": "https://github.com/mui/mui-x/blob/master/packages/x-date-pickers/src/locales/nbNO.ts" }, + { + "languageTag": "nn-NO", + "importName": "nnNO", + "localeName": "Norwegian (Nynorsk)", + "missingKeysCount": 0, + "totalKeysCount": 50, + "githubLink": "https://github.com/mui/mui-x/blob/master/packages/x-date-pickers/src/locales/nnNO.ts" + }, { "languageTag": "fa-IR", "importName": "faIR", diff --git a/packages/x-date-pickers/src/locales/index.ts b/packages/x-date-pickers/src/locales/index.ts index c84168c4bd60a..6e7da2dcb09d2 100644 --- a/packages/x-date-pickers/src/locales/index.ts +++ b/packages/x-date-pickers/src/locales/index.ts @@ -20,6 +20,7 @@ export * from './kzKZ'; export * from './mk'; export * from './nbNO'; export * from './nlNL'; +export * from './nnNO'; export * from './plPL'; export * from './ptBR'; export * from './roRO'; diff --git a/packages/x-date-pickers/src/locales/nnNO.ts b/packages/x-date-pickers/src/locales/nnNO.ts new file mode 100644 index 0000000000000..8603b926a464f --- /dev/null +++ b/packages/x-date-pickers/src/locales/nnNO.ts @@ -0,0 +1,100 @@ +import { PickersLocaleText } from './utils/pickersLocaleTextApi'; +import { getPickersLocalization } from './utils/getPickersLocalization'; +import { TimeViewWithMeridiem } from '../internals/models'; + +const timeViews: Record = { + hours: 'timar', + minutes: 'minuttar', + seconds: 'sekundar', + meridiem: 'meridiem', +}; + +const nnNOPickers: Partial> = { + // Calendar navigation + previousMonth: 'Forrige månad', + nextMonth: 'Neste månad', + + // View navigation + openPreviousView: 'Opne forrige visning', + openNextView: 'Opne neste visning', + calendarViewSwitchingButtonAriaLabel: (view) => + view === 'year' + ? 'årsvisning er open, byt til kalendervisning' + : 'kalendervisning er open, byt til årsvisning', + + // DateRange labels + start: 'Start', + end: 'Slutt', + startDate: 'Startdato', + startTime: 'Starttid', + endDate: 'Sluttdato', + endTime: 'Slutttid', + + // Action bar + cancelButtonLabel: 'Avbryt', + clearButtonLabel: 'Fjern', + okButtonLabel: 'OK', + todayButtonLabel: 'I dag', + + // Toolbar titles + datePickerToolbarTitle: 'Vel dato', + dateTimePickerToolbarTitle: 'Vel dato & klokkeslett', + timePickerToolbarTitle: 'Vel klokkeslett', + dateRangePickerToolbarTitle: 'Vel datoperiode', + + // Clock labels + clockLabelText: (view, time, adapter) => + `Vel ${timeViews[view]}. ${time === null ? 'Ingen tid vald' : `Vald tid er ${adapter.format(time, 'fullTime')}`}`, + hoursClockNumberText: (hours) => `${hours} timar`, + minutesClockNumberText: (minutes) => `${minutes} minuttar`, + secondsClockNumberText: (seconds) => `${seconds} sekundar`, + + // Digital clock labels + selectViewText: (view) => `Vel ${timeViews[view]}`, + + // Calendar labels + calendarWeekNumberHeaderLabel: 'Vekenummer', + calendarWeekNumberHeaderText: '#', + calendarWeekNumberAriaLabelText: (weekNumber) => `Veke ${weekNumber}`, + calendarWeekNumberText: (weekNumber) => `${weekNumber}`, + + // Open picker labels + openDatePickerDialogue: (value, utils) => + value !== null && utils.isValid(value) + ? `Vel dato, vald dato er ${utils.format(value, 'fullDate')}` + : 'Vel dato', + openTimePickerDialogue: (value, utils) => + value !== null && utils.isValid(value) + ? `Vel tid, vald tid er ${utils.format(value, 'fullTime')}` + : 'Vel tid', + fieldClearLabel: 'Fjern verdi', + + // Table labels + timeTableLabel: 'vel tid', + dateTableLabel: 'vel dato', + + // Field section placeholders + fieldYearPlaceholder: (params) => 'Å'.repeat(params.digitAmount), + fieldMonthPlaceholder: (params) => (params.contentType === 'letter' ? 'MMMM' : 'MM'), + fieldDayPlaceholder: () => 'DD', + fieldWeekDayPlaceholder: (params) => (params.contentType === 'letter' ? 'EEEE' : 'EE'), + fieldHoursPlaceholder: () => 'tt', + fieldMinutesPlaceholder: () => 'mm', + fieldSecondsPlaceholder: () => 'ss', + fieldMeridiemPlaceholder: () => 'aa', + + // View names + year: 'År', + month: 'Månad', + day: 'Dag', + weekDay: 'Vekedag', + hours: 'Timar', + minutes: 'Minuttar', + seconds: 'Sekundar', + meridiem: 'Meridiem', + + // Common + empty: 'Tom', +}; + +export const nnNO = getPickersLocalization(nnNOPickers);