1

是否可以在 FullCalendar 版本 5 中定义自定义日期名称、短日期名称、月份名称等?我相信大多数本地化现在都是使用 javascript 的Intl对象本地完成的。Intl但我需要定义在对象中找不到的拉丁名称。是否可以使用自定义语言环境文件或通过传入属性初始化日历来完成?从我的测试来看,两者都不起作用,但也许我做的不对?

let calendar = new FullCalendar.Calendar(calendarEl, {
  dayMaxEvents: true,
  events: $events,
  locale: 'la',
  dayNames: ['Dies Solis','Dies Lunae','Dies Martis','Dies Mercurii','Dies Iovis','Dies Veneris','Dies Saturni'],
  dayNamesShort: ['Sol','Lun','Mart','Merc','Iov','Ven','Sat']
});

和语言环境文件la.js

FullCalendar.globalLocales.push(function () {
  'use strict';

  var la = {
    code: "la",
    week: {
      dow: 1, // Monday is the first day of the week.
      doy: 4  // The week that contains Jan 4th is the first week of the year.
    },
    buttonText: {
      prev: "Prior",
      next: "Prox",
      today: "Hodie",
      month: "Mensis",
      week: "Hebdomada",
      day: "Dies",
      list: "Agenda"
    },
    weekText: "Hb",
    allDayText: "Tota die",
    moreLinkText: function(n) {
      return "+alii " + n;
    },
    noEventsText: "Rei gestae non sunt"
  };

  return la;

}());

(我通过脚本标签加载:)<script src='../lib/locales/la.js'></script>

有些东西是从语言环境文件中提取的,例如我看到hodie而不是today。我已经尝试在语言环境文件中定义dayNamesdayNamesShort,但似乎也不起作用。

4

0 回答 0