How to internationalize the Timeline component of primefaces?

Asked

Viewed 646 times

1

I’m using the Timeline component of the primefaces.

Timeline Primefaces

Although using the "locale" property it is not rendering in English.

<p:timeline id="timeline" value="#{timelineView.timelineModel}" height="auto"
                            var="evento"
                            showNavigation="true"
                            minHeight="30"
                            editable="false" varGroup="group"
                            groupMinHeight="30"
                            selectable="true"
                            groupsChangeable="false"
                            widgetVar="timelineWdgt"
                            timeChangeable="true"
                            axisOnTop="true"
                            animate="false"
                            animateZoom="false"
                            showCurrentTime="true"
                            stackEvents="false"
                            start="#{timelineView.timeLineDataMenos1Hora}"
                            end="#{timelineView.timeLineDataMais7horas}"
                            min="#{timelineView.timeLineDataMinima}"
                            max="#{timelineView.timeLineDataMaxima}"
                            locale="pt_BR"
                            zoomMin="6000000"
                            zoomMax="31536000000"
                            groupsOnRight="false">

1 answer

2

I managed to internationalize the component by creating a locales.js file in the path:

...src main webapp Resources js locales.js

PrimeFaces.locales['pt_BR'] = {
closeText: 'Fechar',
prevText: 'Anterior',
nextText: 'Próximo',
currentText: 'Começo',
monthNames: ['Janeiro','Fevereiro','Março','Abril','Maio','Junho','Julho','Agosto','Setembro','Outubro','Novembro','Dezembro'],
monthNamesShort: ['Jan','Fev','Mar','Abr','Mai','Jun', 'Jul','Ago','Set','Out','Nov','Dez'],
dayNames: ['Domingo','Segunda','Terça','Quarta','Quinta','Sexta','Sábado'],
dayNamesShort: ['Dom','Seg','Ter','Qua','Qui','Sex','Sáb'],
dayNamesMin: ['D','S','T','Q','Q','S','S'],
weekHeader: 'Semana',
firstDay: 0,
isRTL: false,
showMonthAfterYear: false,
yearSuffix: '',
timeOnlyTitle: 'Só Horas',
timeText: 'Tempo',
hourText: 'Hora',
minuteText: 'Minuto',
secondText: 'Segundo',
ampm: false,
month: 'Mês',
week: 'Semana',
day: 'Dia',
allDayText : 'Todo o Dia',

'MONTHS': ["Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"],
'MONTHS_SHORT': ["Jan", "Fev", "Mar", "Abr", "Mai", "Jun", "Jul", "Ago", "Set", "Out", "Nov", "Dez"],
'DAYS': ["Domingo", "Segunda-feira", "Terça-feira", "Quarta-feira", "Quinta-feira", "Sexta-feira", "Sábado"],
'DAYS_SHORT': ["Dom", "Seg", "Ter", "Qua", "Qui", "Sex", "Sáb"],
'ZOOM_IN': "Aumentar zoom",
'ZOOM_OUT': "Diminuir zoom",
'MOVE_LEFT': "Mover esquerda",
'MOVE_RIGHT': "Mover direita",
'NEW': "Novo",
'CREATE_NEW_EVENT': "Criar novo evento" };

Browser other questions tagged

You are not signed in. Login or sign up in order to post.