是否有一个已知的问题,全日历在Safari上以中文呈现(尽管有语言设置?)

Is there a known issue where Fullcalendar renders in Chinese on Safari (despite language settings?)

本文关键字:中文 设置 语言 有一个 问题 Safari 日历 是否      更新时间:2023-09-26

我一直在尝试使用Fullcalendar作为我的Rails 4应用程序的一部分来渲染日历。

它只以中文呈现(尽管在js文件和现场脚本中将语言设置为英文)。还有,只是汉字里的字母,数字都是罗马数字。

在Chrome和Firefox中,日历工作良好,并以英文呈现。我从来没有在任何浏览器上设置过默认的中文,所以我真的不明白。

我甚至创建了一个全新的应用程序,没有我的其他css或js,所以我可以确保他们没有奇怪的冲突。这个应用上运行的就是fullcalendar。js, jquery, jquery_ujs, gcal, fullcalendar。css, moment。css &turbolinks .

下面是我使用的两个Javascript调用,它们都只返回中文字母(但是罗马数字)。

<script> $(document).ready(function() {
// page is now ready, initialize the calendar...
$('#calendar').fullCalendar({
        events: '/events.json',
        lang: 'en',

})

});

<script>

jQuery(文档)时函数(){

/* initialize the external events
-----------------------------------------------------------------*/
jQuery('#external-events div.external-event').each(function() {
  // create an Event Object (http://arshaw.com/fullcalendar/docs/event_data/Event_Object/)
  // it doesn't need to have a start or end
  var eventObject = {
    title: $.trim($(this).text()) // use the element's text as the event title
  };
  
  // store the Event Object in the DOM element so we can get to it later
  jQuery(this).data('eventObject', eventObject);
  
  // make the event draggable using jQuery UI
  jQuery(this).draggable({
    zIndex: 999,
    revert: true,      // will cause the event to go back to its
    revertDuration: 0  //  original position after the drag
  });
  
});

/* initialize the calendar
-----------------------------------------------------------------*/
jQuery('#calendar').fullCalendar({
  header: {
    left: 'prev,next today',
    center: 'title',
    right: 'month,agendaWeek,agendaDay'
  },
  editable: true,
  droppable: true, // this allows things to be dropped onto the calendar !!!
  drop: function(date, allDay) { // this function is called when something is dropped
  
    // retrieve the dropped element's stored Event Object
    var originalEventObject = jQuery(this).data('eventObject');
    
    // we need to copy it, so that multiple events don't have a reference to the same object
    var copiedEventObject = $.extend({}, originalEventObject);
    
    // assign it the date that was reported
    copiedEventObject.start = date;
    copiedEventObject.allDay = allDay;
    
    // render the event on the calendar
    // the last `true` argument determines if the event "sticks" (http://arshaw.com/fullcalendar/docs/event_rendering/renderEvent/)
    jQuery('#calendar').fullCalendar('renderEvent', copiedEventObject, true);
    
    // is the "remove after drop" checkbox checked?
    if (jQuery('#drop-remove').is(':checked')) {
      // if so, remove the element from the "Draggable Events" list
      jQuery(this).remove();
    }
    
  }
});
    

});
我已经想了好几天了。我需要一些帮助。

哎呀。那么明显。我重启了Safari浏览器,一切正常。我担心这将发生在客户端,所以我希望这只是一个本地主机问题。