mirror of
https://github.com/certd/certd.git
synced 2026-05-16 13:17:29 +08:00
perf: 优化中英文翻译与切换
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
import { ref } from "vue";
|
||||
import "dayjs/locale/zh-cn";
|
||||
import "dayjs/locale/en";
|
||||
import zhCN from "ant-design-vue/es/locale/zh_CN";
|
||||
import enUS from "ant-design-vue/es/locale/en_US";
|
||||
import dayjs from "dayjs";
|
||||
export const antdvLocale = ref(zhCN);
|
||||
|
||||
export async function setAntdvLocale(value: string) {
|
||||
console.log("locale changed:", value);
|
||||
if (value.startsWith("zh")) {
|
||||
dayjs.locale("zh-cn");
|
||||
antdvLocale.value = zhCN;
|
||||
} else {
|
||||
dayjs.locale("en");
|
||||
antdvLocale.value = enUS;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user