我已经使用fullCalendar在Salesforce中实现了一个解决方案。当我使用其他语言环境时,标题上的按钮不会更改。有没有人遇到过同样的问题?我是否需要添加更多内容?正如我在locales文件夹中看到的那样,每个语言的buttonTexts确实存在。但是我无法找出为什么它们在标头中不翻译。
initialiseFullCalendar(eventView, startDate, endDate, counter) {
console.log("locale is: " + this.locale.data);
//const eventsData = this.myEvents.data;
let dataObj = {};
let events = [];
const ele = this.template.querySelector("div.fullcalendar");
//console.log("ele >>> " + ele);
var calendar = new FullCalendar.Calendar(ele, {
firstDay: 1, //set first day of the week Monday
header: {
left: "prev,next,today",
center: "title",
right: "dayGridMonth,timeGridWeek,timeGridDay"
},
locale: this.locale.data,
plugins: [
"interaction",
"resourceDayGrid",
"resourceTimeGrid",
"dayGrid",
"timeGrid",
"timeline",
"interactionPlugin",
"list"
],
events: {},
defaultView: "timeGridWeek",
datesRender: function (info) {
//Triggered when a new set of dates has been rendered.
eventView.value = info.view.type; //set the new event view to the eventView variable
startDate.value = info.view.activeStart.toISOString().slice(0, 10); //set the new start date formatted in (YYYY-MM-DD)
endDate.value = info.view.activeEnd.toISOString().slice(0, 10); //set the new end date formatted in (YYYY-MM-DD)
counter.value += 1; //Increment the counter by 1, in order to fire the event
getEventsForDateRange({
//Call Apex method getEventsForDateRange giving the new set of dates
fromDate: startDate.value,
endDate: endDate.value
})
.then((result) => {
//get the results of the events list that should be rendered
console.log(result);
var eventSources = calendar.getEventSources();
var len = eventSources.length;
//Erase all the existing events in the calendar
for (var i = 0; i < len; i++) {
eventSources[i].remove();
}
len = result.length;
dataObj = {};
events = [];
//Build again the list of the events that should be displayed
for (var i = 0; i < len; i++) {
dataObj.id = result[i].id;
dataObj.start = result[i].StartDateTime;
dataObj.end = result[i].EndDateTime;
dataObj.title = result[i].Subject;
events.push(dataObj);
dataObj = {};
}
calendar.addEventSource(events); //Render the new events to the Calendar!
})
.catch((error) => {
this.error = error;
console.log(error);
});
}
});
calendar.render();
}