From 21932b298d1ed06ee85430799f2053bbd0882d25 Mon Sep 17 00:00:00 2001 From: Rishabh Chakrabarti Date: Sun, 4 Aug 2024 05:10:05 +0530 Subject: [PATCH 1/6] Added selectable locale fix Added i18n options --- i18n/en_US.json | 4 +++- i18n/zh_CN.json | 6 +++++- src/components/Calendar.vue | 2 +- src/components/Settings.vue | 28 ++++++++++++++++++++++++++++ src/i18n/en_US.json | 4 +++- src/utils/utils.ts | 3 ++- 6 files changed, 42 insertions(+), 5 deletions(-) diff --git a/i18n/en_US.json b/i18n/en_US.json index 938a228..7887767 100644 --- a/i18n/en_US.json +++ b/i18n/en_US.json @@ -62,5 +62,7 @@ "firstDayOfWeek": "First day of week", "gregorianCalendar": "Gregorian calendar", "lunarCalendar": "Lunar calendar", - "showLunarCalendar": "Show chinese lunar calendar" + "showLunarCalendar": "Show chinese lunar calendar", + "selectLocale": "Select your locale", + "localeOptions":["en-US","zh-CN"] } \ No newline at end of file diff --git a/i18n/zh_CN.json b/i18n/zh_CN.json index a261216..94c8fcd 100644 --- a/i18n/zh_CN.json +++ b/i18n/zh_CN.json @@ -62,5 +62,9 @@ "firstDayOfWeek": "一周开始", "gregorianCalendar": "公历", "lunarCalendar": "农历", - "showLunarCalendar": "显示农历" + "showLunarCalendar": "显示农历", + "localeOptions": [ + "zh-CN", + "en-US" + ] } diff --git a/src/components/Calendar.vue b/src/components/Calendar.vue index d35c00d..70b2cde 100644 --- a/src/components/Calendar.vue +++ b/src/components/Calendar.vue @@ -73,7 +73,7 @@ plugins: [dayGridPlugin, interactionPlugin, timeGridPlugin, listPlugin, rrulePlugin], initialView: 'dayGridMonth', // 默认为哪个视图(月: dayGridMonth,周:timeGridWeek,日:timeGridDay) firstDay: 1, // 设置一周中显示的第一天是哪天,周日是 0,周一是 1, 类推 - locale: 'zh-cn', // 切换语言,当前为中文 + locale: globalData.userLocale, // 切换语言,当前为中文 eventColor: '#3BB2E3', // 全部日历日程背景色 initialDate: moment().format('YYYY-MM-DD'), // 自定义设置背景颜色时,一定要初始化日期时间 //aspectRatio: 1.65, // 设置日历单元格宽度与高度的比例 diff --git a/src/components/Settings.vue b/src/components/Settings.vue index ed3f8c4..94c6a47 100644 --- a/src/components/Settings.vue +++ b/src/components/Settings.vue @@ -43,6 +43,19 @@ + +
{{ selectLocaleText }}
+
+ + + + + + + +