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 Portuguese (pt-PT) locale #14722

Merged
merged 6 commits into from
Sep 27, 2024
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
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 @@ -191,6 +191,14 @@
"totalKeysCount": 50,
"githubLink": "https://github.com/mui/mui-x/blob/master/packages/x-date-pickers/src/locales/plPL.ts"
},
{
"languageTag": "pt-PT",
"importName": "ptPT",
"localeName": "Portuguese",
"missingKeysCount": 0,
"totalKeysCount": 50,
"githubLink": "https://github.com/mui/mui-x/blob/master/packages/x-date-pickers/src/locales/ptPT.ts"
},
{
"languageTag": "pt-BR",
"importName": "ptBR",
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 @@ -23,6 +23,7 @@ export * from './nlNL';
export * from './nnNO';
export * from './plPL';
export * from './ptBR';
export * from './ptPT';
export * from './roRO';
export * from './ruRU';
export * from './skSK';
Expand Down
100 changes: 100 additions & 0 deletions packages/x-date-pickers/src/locales/ptPT.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: 'horas',
minutes: 'minutos',
seconds: 'segundos',
meridiem: 'meridiano',
};

const ptPTPickers: Partial<PickersLocaleText<any>> = {
// Calendar navigation
previousMonth: 'Mês anterior',
nextMonth: 'Próximo mês',

// View navigation
openPreviousView: 'Abrir seleção anterior',
openNextView: 'Abrir próxima seleção',
calendarViewSwitchingButtonAriaLabel: (view) =>
view === 'year'
? 'A seleção do ano está aberta, altere para a seleção do calendário'
: 'A seleção do calendários está aberta, altere para a seleção do ano',

// DateRange labels
start: 'Início',
end: 'Fim',
startDate: 'Data de início',
startTime: 'Hora de início',
endDate: 'Data de fim',
endTime: 'Hora de fim',

// Action bar
cancelButtonLabel: 'Cancelar',
clearButtonLabel: 'Limpar',
okButtonLabel: 'OK',
todayButtonLabel: 'Hoje',

// Toolbar titles
datePickerToolbarTitle: 'Selecione a data',
dateTimePickerToolbarTitle: 'Selecione a data e a hora',
timePickerToolbarTitle: 'Selecione a hora',
dateRangePickerToolbarTitle: 'Selecione o intervalo de datas',

// Clock labels
clockLabelText: (view, time, utils, formattedTime) =>
`Selecione ${timeViews[view]}. ${!formattedTime && (time === null || !utils.isValid(time)) ? 'Hora não selecionada' : `Selecionado a hora ${formattedTime ?? utils.format(time, 'fullTime')}`}`,
hoursClockNumberText: (hours) => `${hours} horas`,
minutesClockNumberText: (minutes) => `${minutes} minutos`,
secondsClockNumberText: (seconds) => `${seconds} segundos`,

// Digital clock labels
selectViewText: (view) => `Selecione ${timeViews[view]}`,

// Calendar labels
calendarWeekNumberHeaderLabel: 'Número da semana',
calendarWeekNumberHeaderText: 'N.º',
calendarWeekNumberAriaLabelText: (weekNumber) => `Semana ${weekNumber}`,
calendarWeekNumberText: (weekNumber) => `${weekNumber}`,

// Open picker labels
openDatePickerDialogue: (value, utils, formattedDate) =>
formattedDate || (value !== null && utils.isValid(value))
? `Escolha uma data, a data selecionada é ${formattedDate ?? utils.format(value, 'fullDate')}`
: 'Escolha uma data',
openTimePickerDialogue: (value, utils, formattedTime) =>
formattedTime || (value !== null && utils.isValid(value))
? `Escolha uma hora, a hora selecionada é ${formattedTime ?? utils.format(value, 'fullTime')}`
: 'Escolha uma hora',
fieldClearLabel: 'Limpar valor',

// Table labels
timeTableLabel: 'escolha uma hora',
dateTableLabel: 'escolha uma data',

// Field section placeholders
fieldYearPlaceholder: (params) => 'A'.repeat(params.digitAmount),
fieldMonthPlaceholder: (params) => (params.contentType === 'letter' ? 'MMMM' : 'MM'),
fieldDayPlaceholder: () => 'DD',
fieldWeekDayPlaceholder: (params) => (params.contentType === 'letter' ? 'SSSS' : 'SS'),
fieldHoursPlaceholder: () => 'hh',
fieldMinutesPlaceholder: () => 'mm',
fieldSecondsPlaceholder: () => 'ss',
fieldMeridiemPlaceholder: () => 'aa',

// View names
year: 'Ano',
month: 'Mês',
day: 'Dia',
weekDay: 'Dia da Semana',
hours: 'Horas',
minutes: 'Minutos',
seconds: 'Segundos',
meridiem: 'Meridiano',

// Common
empty: 'Vazio',
};

export const ptPT = getPickersLocalization(ptPTPickers);