如何在 Vue.js 的完整日历上获得完整的翻译



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

角落里的"今天"按钮没有翻译,但其他一切都是。

我尝试导入区域设置文件。所有和"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"
/>

我尝试将 CDN 设置为<head>

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

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

我应该做任何其他设置才能获得完整的翻译吗?

这是我的答案。

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"
/>
<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

最新更新