diff --git a/README.mkd b/README.mkd index 0549822..f5289c4 100644 --- a/README.mkd +++ b/README.mkd @@ -45,3 +45,11 @@ Here is an example of doing it within an element having an `id` of `calendar`: }); To see a full list of all available options, please consult the [FullCalendar documentation »](http://arshaw.com/fullcalendar/docs/) + +I18n +---- +To localize fullCalendar You can use i18n for jquery datepicker. + +$.fullCalendar.applyLocale($.datepicker.regional['ru']); + + diff --git a/src/I18n.js b/src/I18n.js new file mode 100644 index 0000000..45f5c8b --- /dev/null +++ b/src/I18n.js @@ -0,0 +1,18 @@ +var applyLocale = function(locale) { + setDefaults({ + isRTL: locale.isRTL, + firstDay: locale.firstDay, + monthNames: locale.monthNames, + monthNamesShort: locale.monthNamesShort, + dayNames: locale.dayNames, + dayNamesShort: locale.dayNamesShort, + buttonText: { + today: locale.currentText + } + }); + +} + +$.fullCalendar.applyLocale = function(locale) { + applyLocale(locale); +} diff --git a/src/_loader.js b/src/_loader.js index 449160f..7004ab6 100644 --- a/src/_loader.js +++ b/src/_loader.js @@ -44,6 +44,7 @@ js('Header.js'); js('EventManager.js'); js('date_util.js'); js('util.js'); +js('I18n.js'); js('basic/MonthView.js'); js('basic/BasicWeekView.js'); diff --git a/src/main.js b/src/main.js index 6b169bf..d10fa86 100644 --- a/src/main.js +++ b/src/main.js @@ -36,31 +36,34 @@ $.fn.fullCalendar = function(options) { eventSources.push(options.events); delete options.events; } - + options = $.extend(true, {}, defaults, (options.isRTL || options.isRTL===undefined && defaults.isRTL) ? rtlDefaults : {}, options ); - - + + this.each(function(i, _element) { var element = $(_element); var calendar = new Calendar(element, options, eventSources); element.data('fullCalendar', calendar); // TODO: look into memory leak implications calendar.render(); }); - - + + return this; - + }; // function for adding/overriding defaults -function setDefaults(d) { +var setDefaults = function(d) { $.extend(true, defaults, d); } +$.fullCalendar.setDefaults = function(d) { + setDefaults(d); +}