| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- //var langOptionHash = {}; // initialized in defaults.js
- fc.langs = langOptionHash; // expose
- // Initialize jQuery UI Datepicker translations while using some of the translations
- // for our own purposes. Will set this as the default language for datepicker.
- // Called from a translation file.
- fc.datepickerLang = function(langCode, datepickerLangCode, options) {
- var langOptions = langOptionHash[langCode];
- // initialize FullCalendar's lang hash for this language
- if (!langOptions) {
- langOptions = langOptionHash[langCode] = {};
- }
- // merge certain Datepicker options into FullCalendar's options
- mergeOptions(langOptions, {
- isRTL: options.isRTL,
- weekNumberTitle: options.weekHeader,
- titleFormat: {
- month: options.showMonthAfterYear ?
- 'YYYY[' + options.yearSuffix + '] MMMM' :
- 'MMMM YYYY[' + options.yearSuffix + ']'
- },
- defaultButtonText: {
- // the translations sometimes wrongly contain HTML entities
- prev: stripHTMLEntities(options.prevText),
- next: stripHTMLEntities(options.nextText),
- today: stripHTMLEntities(options.currentText)
- }
- });
- // is jQuery UI Datepicker is on the page?
- if ($.datepicker) {
- // Register the language data.
- // FullCalendar and MomentJS use language codes like "pt-br" but Datepicker
- // does it like "pt-BR" or if it doesn't have the language, maybe just "pt".
- // Make an alias so the language can be referenced either way.
- $.datepicker.regional[datepickerLangCode] =
- $.datepicker.regional[langCode] = // alias
- options;
- // Alias 'en' to the default language data. Do this every time.
- $.datepicker.regional.en = $.datepicker.regional[''];
- // Set as Datepicker's global defaults.
- $.datepicker.setDefaults(options);
- }
- };
- // Sets FullCalendar-specific translations. Also sets the language as the global default.
- // Called from a translation file.
- fc.lang = function(langCode, options) {
- var langOptions;
- if (options) {
- langOptions = langOptionHash[langCode];
- // initialize the hash for this language
- if (!langOptions) {
- langOptions = langOptionHash[langCode] = {};
- }
- mergeOptions(langOptions, options || {});
- }
- // set it as the default language for FullCalendar
- defaults.lang = langCode;
- };
|