如何在7中使用fullcalendar中的区域设置
我需要在第7版中更改日历的语言。我还没有找到很多关于这方面的文档。主要的事情是改变日历上出现的日期的语言 !--开始代码段:js hide:false控制台:true babel:false-->如何在7中使用fullcalendar中的区域设置,fullcalendar,angular7,Fullcalendar,Angular7,我需要在第7版中更改日历的语言。我还没有找到很多关于这方面的文档。主要的事情是改变日历上出现的日期的语言 !--开始代码段:js hide:false控制台:true babel:false--> 从'@angular/core'导入{Component,OnInit,ViewChild}; 从“ng fullcalendar”导入{CalendarComponent}; 从“fullcalendar”导入{Options}; @组成部分({ 选择器:“应用程序日历”, templateUrl:
从'@angular/core'导入{Component,OnInit,ViewChild};
从“ng fullcalendar”导入{CalendarComponent};
从“fullcalendar”导入{Options};
@组成部分({
选择器:“应用程序日历”,
templateUrl:“./calendario.component.html”,
样式URL:['./calendario.component.css']
})
导出类CalendarioComponent实现OnInit{
//日历
日历选项:选项;
显示事件:任何;
@ViewChild(CalendarComponent)ucCalendar:CalendarComponent;
构造函数(){}
恩戈尼尼特(){
此日历选项={
是的,
eventLimit:false,
标题:{
左:'',
中心:'标题',
右图:“月”
},
事件:[]
};
}
}
我尝试在calendarOptions中添加属性locale='es',但不起作用,
将此添加到我的angular json中,但我不知道如何实现它
“脚本”:[
“node_modules/fullcalendar/dist/locale/es.js”
]
您可以使用FullCalendar组件设置区域设置代码来完成此操作
@ViewChild('calendar') calendarComponent: FullCalendarComponent;
在ngOnInit中,就像这样:
this.calendarComponent.locales = [ { code: 'pt-br' } ];
我希望这对你有用。谢谢Gabriel,我用这种方法成功了 首先确保你有你的愿望语言的进口
import esLocale from '@fullcalendar/core/locales/es';
import frLocale from '@fullcalendar/core/locales/fr';
在html文件的完整日历选择器中,应为区域设置和区域设置选项指定值
<full-calendar
defaultView="dayGridMonth"
[locales]="locales"
locale="es"
[weekends]="false"
[plugins]="calendarPlugins"></full-calendar>
我建议一个简单的解决方案“在这种情况下,我想把语言改成法语”
您可能会发现使用fullCalendar现成的
locales = [esLocale, frLocale];