【问题标题】:How do i get full translation on fullCalendar in Vue.js如何在 Vue.js 中获得 fullCalendar 的完整翻译
【发布时间】:2020-02-12 15:22:58
【问题描述】:

我的 Vue 应用程序中有 Fullcalendar 并将语言设置为“da” 但它并不能翻译所有内容。

角落里的“今天”按钮没有翻译,其他的都翻译了。

我已尝试导入语言环境文件。 all 和 "da"。

import daLocale from '@fullcalendar/core/locales/da'
import allLocales from '@fullcalendar/core/locales-all'

我也尝试将“allLocales”直接放在<fullCalender> 标签上

    <FullCalendar
       class="demo-app-calendar"
       ref="fullCalendar"
       defaultView="dayGridMonth"
       :plugins="calendarPlugins"
       :events="calendarEvents"
       locale="da"
       :locales="allLocales"
     />

我已经尝试在&lt;head&gt; 中设置 CDN

<script src='fullcalendar/core/locales-all.js'></script>
<script src='fullcalendar/core/locales/da.js'></script>

我已经阅读了文档中的所有内容,并且在有关语言环境的文档中,它没有显示如何在 Vue.js DOCS

为了获得完整的翻译,我应该做任何其他设置吗?

【问题讨论】:

  • 这里是稍微修改的官方演示,codesandbox.io/s/fullcalendar-vue-i9el9。它表明locale="da" :locales="allLocales" 按预期工作。如果你尝试
  • 您不需要导入特定的语言环境所有语言环境。

标签: vue.js fullcalendar locale fullcalendar-4


【解决方案1】:

这是我的答案。

import FullCalendar from "@fullcalendar/vue";
import esLocale from "@fullcalendar/core/locales/es";

... ...

data() {
  return {
    calendarOptions: {
      plugins: [dayGridPlugin, interactionPlugin],
      initialView: "dayGridMonth",
      locale: esLocale,
      headerToolbar: {
        left: "title",
        right: "today dayGridWeek dayGridMonth",
      },
    },
  };
}

... ...

<FullCalendar
  ref="fullcalendar"
  :options="calendarOptions"
/>

【讨论】:

    【解决方案2】:
    <template>
       <full-calendar :events="events" :config="config" />
    </template>
    <script>
    import 'fullcalendar/dist/locale/da'
      data() {
        return {
          events: [],
          config: {
            locale: 'da'
          }
        }
      }
    </script> 
    

    https://www.npmjs.com/package/vue-full-calendar#locale

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-12-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多