PrimeFaces语言环境不起作用 [英] PrimeFaces locale not working

查看:122
本文介绍了PrimeFaces语言环境不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用PrimeFaces日历组件.但是我想用土耳其语显示时间和月份.我编写了这样的代码;

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本身仅提供可本地化组件(例如

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.

将以下JavaScript添加到您的JSF视图:

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>  

另请参阅: http://code.google.com/p/primefaces/wiki/PrimeFacesLocales


PrimeFaces已移至github,所以这是新URL(即使旧的URL至今仍可用):
https://github.com/primefaces/primefaces/wiki/Locales

See also: http://code.google.com/p/primefaces/wiki/PrimeFacesLocales


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

这篇关于PrimeFaces语言环境不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆