Skip to content

Commit

Permalink
[l10n] Add Norwegian Nynorsk (nn-NO) locale (mui#13946)
Browse files Browse the repository at this point in the history
  • Loading branch information
AnderzL7 authored and thomasmoon committed Sep 6, 2024
1 parent 3bbd303 commit 5f3bcca
Show file tree
Hide file tree
Showing 3 changed files with 109 additions and 0 deletions.
8 changes: 8 additions & 0 deletions docs/data/date-pickers/localization/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions packages/x-date-pickers/src/locales/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
100 changes: 100 additions & 0 deletions packages/x-date-pickers/src/locales/nnNO.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
import { PickersLocaleText } from './utils/pickersLocaleTextApi';
import { getPickersLocalization } from './utils/getPickersLocalization';
import { TimeViewWithMeridiem } from '../internals/models';

const timeViews: Record<TimeViewWithMeridiem, string> = {
hours: 'timar',
minutes: 'minuttar',
seconds: 'sekundar',
meridiem: 'meridiem',
};

const nnNOPickers: Partial<PickersLocaleText<any>> = {
// 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);

0 comments on commit 5f3bcca

Please sign in to comment.