开发者

How can I localize FullCalendar in jQuery?

开发者 https://www.devze.com 2023-01-18 14:54 出处:网络
I\'m trying to convert FullCalendar to Spanish. 开发者_运维百科How can I change \"Next Week\", \"Today\", etc.?I ran into the same issue. The quickest way I found was to use the text/time customizati

I'm trying to convert FullCalendar to Spanish.

开发者_运维百科How can I change "Next Week", "Today", etc.?


I ran into the same issue. The quickest way I found was to use the text/time customization hooks provided by full calendar:

$('#calendar').fullCalendar({
    events: "/calendar",

    //localize the month names to Chinese simplified
    monthNames: ['一月', '二月', '三月', '四月', '五月', '六月', '七月',
    '八月', '九月', '十月', '十一月', '十二月']

    //...
})


FullCalendar provides localisation files - that is the correct way to do this. How to use them is documented here: http://fullcalendar.io/docs/text/lang/

UPDATE: Should now use locale- https://fullcalendar.io/docs/text/locale/


It seems like your best bet is to get the source code yourself from http://github.com/arshaw/fullcalendar/ and manually search through to find the strings you need to translate.

You can change things like month names and day names in /src/defaults.js


The easiest way is to search the source javascript code, almost at the very beginning of the production version of the script, around line 60 or so, there are all the names of months and days. Just change them to your language.

Note: For some reason in the minified version of the script is almost at the end.

0

精彩评论

暂无评论...
验证码 换一张
取 消