I am using PrimeFaces Calendar component . But I want to display time and month in Turkish.I have written codes like this;
< p:calendar effect="slideDown" navigator="true" locale="tr"
yearRange="1975" pattern="dd/mm/yyyy HH:mm"/>
But it is displaying again in English.What is the problem?
Primefaces itself only provides english translations for localizable components like calendar. If you need other translations you have to include them manually into your JSF via JavaScript.
Add the following JavaScript to your JSF view:
<script type="text/javascript">
PrimeFaces.locales['tr'] = {
closeText: 'kapat',
prevText: 'geri',
nextText: 'ileri',
currentText: 'bugün',
monthNames: ['Ocak','Şubat','Mart','Nisan','Mayıs','Haziran','Temmuz','Ağustos','Eylül','Ekim','Kasım','Aralık'],
monthNamesShort: ['Oca','Şub','Mar','Nis','May','Haz', 'Tem','Ağu','Eyl','Eki','Kas','Ara'],
dayNames: ['Pazar','Pazartesi','Salı','Çarşamba','Perşembe','Cuma','Cumartesi'],
dayNamesShort: ['Pz','Pt','Sa','Ça','Pe','Cu','Ct'],
dayNamesMin: ['Pz','Pt','Sa','Ça','Pe','Cu','Ct'],
weekHeader: 'Hf',
firstDay: 1,
isRTL: false,
showMonthAfterYear: false,
yearSuffix: '',
timeOnlyTitle: 'Zaman Seçiniz',
timeText: 'Zaman',
hourText: 'Saat',
minuteText: 'Dakika',
secondText: 'Saniye',
ampm: false,
month: 'Ay',
week: 'Hafta',
day: 'Gün',
allDayText : 'Tüm Gün'
};
</script>
See also:
http://code.google.com/p/primefaces/wiki/PrimeFacesLocales
EDIT:
PrimeFaces moved to github, so here is the new URL (even though the old one is still available up to now):
https://github.com/primefaces/primefaces/wiki/Locales