Skip to content

Commit

Permalink
[core] Prettify the l10n issue (mui#4928)
Browse files Browse the repository at this point in the history
Co-authored-by: Matheus Wichman <matheushw@outlook.com>
  • Loading branch information
alexfauquette and m4theushw committed Aug 26, 2022
1 parent 8df2da0 commit ffcaa4f
Show file tree
Hide file tree
Showing 5 changed files with 230 additions and 75 deletions.
27 changes: 25 additions & 2 deletions packages/x-date-pickers/src/locales/deDE.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,40 @@
import { PickersLocaleText } from './utils/pickersLocaleTextApi';
import { getPickersLocalization } from './utils/getPickersLocalization';
// import { CalendarPickerView } from '../internals/models';

const deDEPickers: Partial<PickersLocaleText<any>> = {
// Calendar navigation
previousMonth: 'Letzter Monat',
nextMonth: 'Nächster Monat',

// View navigation
openPreviousView: 'Letzte Ansicht öffnen',
openNextView: 'Nächste Ansicht öffnen',
// calendarViewSwitchingButtonAriaLabel: (view: CalendarPickerView) => view === 'year' ? 'year view is open, switch to calendar view' : 'calendar view is open, switch to year view',

// DateRange placeholders
start: 'Beginn',
end: 'Ende',

// Action bar
cancelButtonLabel: 'Abbrechen',
clearButtonLabel: 'Löschen',
okButtonLabel: 'OK',
todayButtonLabel: 'Heute',
start: 'Beginn',
end: 'Ende',

// Clock labels
// clockLabelText: (view, time, adapter) => `Select ${view}. ${time === null ? 'No time selected' : `Selected time is ${adapter.format(time, 'fullTime')}`}`,
// hoursClockNumberText: hours => `${hours} hours`,
// minutesClockNumberText: minutes => `${minutes} minutes`,
// secondsClockNumberText: seconds => `${seconds} seconds`,

// Open picker labels
// openDatePickerDialogue: (rawValue, utils) => rawValue && utils.isValid(utils.date(rawValue)) ? `Choose date, selected date is ${utils.format(utils.date(rawValue)!, 'fullDate')}` : 'Choose date',
// openTimePickerDialogue: (rawValue, utils) => rawValue && utils.isValid(utils.date(rawValue)) ? `Choose time, selected time is ${utils.format(utils.date(rawValue)!, 'fullTime')}` : 'Choose time',

// Table labels
// timeTableLabel: 'pick time',
// dateTableLabel: 'pick date',
};

export const deDE = getPickersLocalization(deDEPickers);
26 changes: 20 additions & 6 deletions packages/x-date-pickers/src/locales/enUS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,40 @@ import { getPickersLocalization } from './utils/getPickersLocalization';
import { CalendarPickerView } from '../internals/models';

// This object is not Partial<PickersLocaleText> because it is the default values

const enUSPickers: PickersLocaleText<any> = {
// Calendar navigation
previousMonth: 'Previous month',
nextMonth: 'Next month',

// View navigation
openPreviousView: 'open previous view',
openNextView: 'open next view',
cancelButtonLabel: 'Cancel',
clearButtonLabel: 'Clear',
okButtonLabel: 'OK',
todayButtonLabel: 'Today',
start: 'Start',
end: 'End',
calendarViewSwitchingButtonAriaLabel: (view: CalendarPickerView) =>
view === 'year'
? 'year view is open, switch to calendar view'
: 'calendar view is open, switch to year view',

// DateRange placeholders
start: 'Start',
end: 'End',

// Action bar
cancelButtonLabel: 'Cancel',
clearButtonLabel: 'Clear',
okButtonLabel: 'OK',
todayButtonLabel: 'Today',

// Clock labels
clockLabelText: (view, time, adapter) =>
`Select ${view}. ${
time === null ? 'No time selected' : `Selected time is ${adapter.format(time, 'fullTime')}`
}`,
hoursClockNumberText: (hours) => `${hours} hours`,
minutesClockNumberText: (minutes) => `${minutes} minutes`,
secondsClockNumberText: (seconds) => `${seconds} seconds`,

// Open picker labels
openDatePickerDialogue: (rawValue, utils) =>
rawValue && utils.isValid(utils.date(rawValue))
? `Choose date, selected date is ${utils.format(utils.date(rawValue)!, 'fullDate')}`
Expand All @@ -33,6 +45,8 @@ const enUSPickers: PickersLocaleText<any> = {
rawValue && utils.isValid(utils.date(rawValue))
? `Choose time, selected time is ${utils.format(utils.date(rawValue)!, 'fullTime')}`
: 'Choose time',

// Table labels
timeTableLabel: 'pick time',
dateTableLabel: 'pick date',
};
Expand Down
27 changes: 25 additions & 2 deletions packages/x-date-pickers/src/locales/frFR.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,40 @@
import { PickersLocaleText } from './utils/pickersLocaleTextApi';
import { getPickersLocalization } from './utils/getPickersLocalization';
// import { CalendarPickerView } from '../internals/models';

const frFRPickers: Partial<PickersLocaleText<any>> = {
// Calendar navigation
previousMonth: 'Mois précédent',
nextMonth: 'Mois suivant',

// View navigation
openPreviousView: 'Ouvrir la vue précédente',
openNextView: 'Ouvrir la vue suivante',
// calendarViewSwitchingButtonAriaLabel: (view: CalendarPickerView) => view === 'year' ? 'year view is open, switch to calendar view' : 'calendar view is open, switch to year view',

// DateRange placeholders
start: 'Début',
end: 'Fin',

// Action bar
cancelButtonLabel: 'Annuler',
clearButtonLabel: 'Vider',
okButtonLabel: 'OK',
todayButtonLabel: "Aujourd'hui",
start: 'Début',
end: 'Fin',

// Clock labels
// clockLabelText: (view, time, adapter) => `Select ${view}. ${time === null ? 'No time selected' : `Selected time is ${adapter.format(time, 'fullTime')}`}`,
// hoursClockNumberText: hours => `${hours} hours`,
// minutesClockNumberText: minutes => `${minutes} minutes`,
// secondsClockNumberText: seconds => `${seconds} seconds`,

// Open picker labels
// openDatePickerDialogue: (rawValue, utils) => rawValue && utils.isValid(utils.date(rawValue)) ? `Choose date, selected date is ${utils.format(utils.date(rawValue)!, 'fullDate')}` : 'Choose date',
// openTimePickerDialogue: (rawValue, utils) => rawValue && utils.isValid(utils.date(rawValue)) ? `Choose time, selected time is ${utils.format(utils.date(rawValue)!, 'fullTime')}` : 'Choose time',

// Table labels
// timeTableLabel: 'pick time',
// dateTableLabel: 'pick date',
};

export const frFR = getPickersLocalization(frFRPickers);
27 changes: 25 additions & 2 deletions packages/x-date-pickers/src/locales/trTR.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,41 @@
import { PickersLocaleText } from './utils/pickersLocaleTextApi';
import { getPickersLocalization } from './utils/getPickersLocalization';
// import { CalendarPickerView } from '../internals/models';

// This object is not Partial<PickersLocaleText> because it is the default values
const trTRPickers: Partial<PickersLocaleText<any>> = {
// Calendar navigation
previousMonth: 'Önceki ay',
nextMonth: 'Sonraki ay',

// View navigation
openPreviousView: 'sonraki görünüm',
openNextView: 'önceki görünüm',
// calendarViewSwitchingButtonAriaLabel: (view: CalendarPickerView) => view === 'year' ? 'year view is open, switch to calendar view' : 'calendar view is open, switch to year view',

// DateRange placeholders
start: 'Başlangıç',
end: 'Bitiş',

// Action bar
cancelButtonLabel: 'iptal',
clearButtonLabel: 'Temizle',
okButtonLabel: 'Tamam',
todayButtonLabel: 'Bugün',
start: 'Başlangıç',
end: 'Bitiş',

// Clock labels
// clockLabelText: (view, time, adapter) => `Select ${view}. ${time === null ? 'No time selected' : `Selected time is ${adapter.format(time, 'fullTime')}`}`,
// hoursClockNumberText: hours => `${hours} hours`,
// minutesClockNumberText: minutes => `${minutes} minutes`,
// secondsClockNumberText: seconds => `${seconds} seconds`,

// Open picker labels
// openDatePickerDialogue: (rawValue, utils) => rawValue && utils.isValid(utils.date(rawValue)) ? `Choose date, selected date is ${utils.format(utils.date(rawValue)!, 'fullDate')}` : 'Choose date',
// openTimePickerDialogue: (rawValue, utils) => rawValue && utils.isValid(utils.date(rawValue)) ? `Choose time, selected time is ${utils.format(utils.date(rawValue)!, 'fullTime')}` : 'Choose time',

// Table labels
// timeTableLabel: 'pick time',
// dateTableLabel: 'pick date',
};

export const trTR = getPickersLocalization(trTRPickers);
Loading

0 comments on commit ffcaa4f

Please sign in to comment.