Hi!
I'm trying to configure my schedule component to use the portuguese language, but I get an error whenever I use locale="pt"
The image below shows the result of using locale="pt". The component static texts aren't translate and the component itself stops working properly.
Error:
I've been reading the docs, but everything I tried didn't work. I also tried to downgrade the component but it didn't work either.
Hi Gabriel,
We have prepared a sample to globalize the Schedule with the pt culture by following the steps provided below and it works as expected at our end. Refer to the sample from the below link.
Sample: https://stackblitz.com/edit/ej2-angular-schedule-pt-locale-sample-20-3-59?file=app.component.ts
We require the below files to localize the Schedule.
1. You can get the above files by Installing the CLDR-Data package by using the below command.
>> npm install cldr-data –save
Once the installation is completed you can find the files required to localize the Schedule for each culture from the directory as shown below.
You can get ca-gregorian.json, numbers.json, and timeZoneNames.json files from the directory as shown below.
You can get the numberingSystems.json file from the directory as shown below. This file is common for all cultures.
2. Import the required CLDR data files(ca-gregorian.json, numberingSystems.json, numbers.json, and timeZoneNames.json) and load them using the loadCldr method. You can find the culture files in our shared sample as shown in the below snip. These files are copied from the CLDR-Data package installed in step 1.
[app.component.ts]
import { loadCldr, L10n } from '@syncfusion/ej2-base';
import * as numberingSystems from './cldr-data/supplemental/numberingSystems.json'; import * as ptGregorian from './cldr-data/main/pt/ca-gregorian.json'; import * as ptNumbers from './cldr-data/main/pt/numbers.json'; import * as ptTimeZoneNames from './cldr-data/main/pt/timeZoneNames.json';
loadCldr(numberingSystems, ptGregorian, ptNumbers, ptTimeZoneNames); |
3. Load the locale words as shown below using the load method of L10n. You can find the localized word for the different cultures from the below repository.
ej2-local: https://github.com/syncfusion/ej2-locale
[app.component.ts]
import { loadCldr, L10n } from "@syncfusion/ej2-base";
L10n.load({ pt: { schedule: { day: "Dia", week: "Semana", workWeek: "Semana de trabalho", month: "Mês", agenda: "Agenda", weekAgenda: "Agenda da semana", workWeekAgenda: "Agenda da Semana de Trabalho", monthAgenda: "Agenda do mês", today: "Hoje", noEvents: "Sem eventos", emptyContainer: "Não há eventos agendados para este dia.", allDay: "Dia todo", start: "Começar", end: "Fim", more: "Mais", close: "Fechar", cancel: "Cancelar", noTitle: "(Sem título)", delete: "Excluir", deleteEvent: "Este evento", deleteMultipleEvent: "Excluir vários eventos", selectedItems: "Itens selecionados", deleteSeries: "Série inteira", edit: "Editar", editSeries: "Série inteira", editEvent: "Este evento", createEvent: "Crio", subject: "Sujeito", addTitle: "Adicionar título", moreDetails: "Mais detalhes", save: "Salve ", editContent: "Como você gostaria de alterar o compromisso na série?", deleteContent: "Tem certeza de que deseja excluir este evento?", deleteMultipleContent: "Tem certeza de que deseja excluir os eventos selecionados?", newEvent: "Novo evento", title: "Título", location: "Localização", description: "Descrição", timezone: "Fuso horário", startTimezone: "Iniciar fuso horário", endTimezone: "Fuso horário final", repeat: "Repetir", saveButton: "Salve ", cancelButton: "Cancelar", deleteButton: "Excluir", recurrence: "Recorrência", wrongPattern: "O padrão de recorrência não é válido.", seriesChangeAlert: "Deseja cancelar as alterações feitas em instâncias específicas desta série e associá-las à série inteira novamente?", createError: "A duração do evento deve ser menor que a frequência com que ele ocorre. Diminua a duração ou altere o padrão de recorrência no editor de eventos de recorrência.", sameDayAlert: "Duas ocorrências do mesmo evento não podem ocorrer no mesmo dia.", editRecurrence: "Editar recorrência", repeats: "Repete", alert: "Alerta", startEndError: "A data final selecionada ocorre antes da data de início.", invalidDateError: "O valor da data inserida é inválido.", blockAlert: "Os eventos não podem ser agendados dentro do intervalo de tempo bloqueado.", ok: "Está bem", yes: "sim", no: "Não", occurrence: "Ocorrência", series: "Series", previous: "Anterior", next: "Próximo", timelineDay: "Dia da linha do tempo", timelineWeek: "Semana da Linha do Tempo", timelineWorkWeek: "Semana de trabalho da linha do tempo", timelineMonth: "Mês da linha do tempo", timelineYear: "Ano da Linha do Tempo", editFollowingEvent: "Eventos seguintes", deleteTitle: "Excluir evento", editTitle: "Editar evento", beginFrom: "Começar de", endAt: "Termina em" }, recurrenceeditor: { none: "Nenhum", daily: "Diariamente", weekly: "Semanal", monthly: "Por mês", month: "Mês", yearly: "Anual", never: "Nunca", until: "Até", count: "Contagem", first: "Primeiro", second: "Segundo", third: "Terceiro", fourth: "Quarto", last: "Último", repeat: "Repetir", repeatEvery: "Repita cada", on: "Repetir em", end: "Fim", onDay: "Dia", days: "Dias)", weeks: "Semana (s)", months: "Mês (es)", years: "Anos)", every: "cada", summaryTimes: "tempo (s)", summaryOn: "em", summaryUntil: "até", summaryRepeat: "Repete", summaryDay: "dias)", summaryWeek: "semana (s)", summaryMonth: "mês (es)", summaryYear: "anos)", monthWeek: "Mês Semana", monthPosition: "Posição do mês", monthExpander: "Expansor do mês", yearExpander: "Expansor do ano", repeatInterval: "Intervalo de repetição" }, calendar: { today: "Hoje" } } }); |
4. Set the locale property to the Schedule.
[app.component.html]
<ejs-schedule #schedule [eventSettings]="eventSettings" locale="pt"></ejs-schedule> |
Regards,
Ravikumar Venkatesan