init
This commit is contained in:
29
src/language/index.ts
Normal file
29
src/language/index.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import { getCurrentInstance } from "vue";
|
||||
import { createI18n, useI18n as __useI18n__ } from "vue-i18n";
|
||||
import zh_CN from "./locales/zh_CN";
|
||||
import en_US from "./locales/en_US";
|
||||
|
||||
const i18n = createI18n({
|
||||
legacy: false,
|
||||
locale: "zh_CN",
|
||||
messages: {
|
||||
zh_CN: zh_CN,
|
||||
en_US: en_US,
|
||||
},
|
||||
});
|
||||
|
||||
export function useI18n() {
|
||||
let i18nInstance;
|
||||
const app = getCurrentInstance()?.appContext.app;
|
||||
|
||||
try {
|
||||
i18nInstance = __useI18n__();
|
||||
} catch (e) {
|
||||
app?.use(i18n);
|
||||
i18nInstance = __useI18n__();
|
||||
}
|
||||
|
||||
return i18nInstance;
|
||||
}
|
||||
|
||||
export default i18n;
|
||||
65
src/language/locales/en_US.ts
Normal file
65
src/language/locales/en_US.ts
Normal file
@@ -0,0 +1,65 @@
|
||||
export default {
|
||||
input: {
|
||||
placeholder: "please input",
|
||||
},
|
||||
page: {
|
||||
previous: "previous",
|
||||
next: "next",
|
||||
goTo: "Go to",
|
||||
confirm: "confirm",
|
||||
page: "page",
|
||||
item: "item",
|
||||
total: "total",
|
||||
},
|
||||
datePicker: {
|
||||
year: "",
|
||||
month: "month",
|
||||
sunday: "SU",
|
||||
monday: "MO",
|
||||
tuesday: "TU",
|
||||
wednesday: "WE",
|
||||
thursday: "TH",
|
||||
friday: "FR",
|
||||
saturday: "SA",
|
||||
january: "January",
|
||||
february: "February",
|
||||
march: "March",
|
||||
april: "April",
|
||||
may: "May",
|
||||
june: "June",
|
||||
july: "July",
|
||||
august: "August",
|
||||
september: "September",
|
||||
october: "October",
|
||||
november: "November",
|
||||
december: "December",
|
||||
selectDate: "select date",
|
||||
selectTime: "select time",
|
||||
selectYear: "select year",
|
||||
selectMonth: "select month",
|
||||
clear: "clear",
|
||||
confirm: "confirm",
|
||||
cancel: "cancel",
|
||||
now: "now",
|
||||
},
|
||||
empty: {
|
||||
description: "No data",
|
||||
},
|
||||
upload: {
|
||||
text: "Upload files",
|
||||
dragText: "Click Upload or drag the file here",
|
||||
defaultErrorMsg: "Upload failed",
|
||||
urlErrorMsg: "The upload address format is illegal",
|
||||
numberErrorMsg: "The number of files uploaded exceeds the specified number",
|
||||
cutInitErrorMsg: "Clipping plug-in initialization failed",
|
||||
uploadSuccess: "Upload succeeded",
|
||||
cannotSupportCutMsg:
|
||||
"The current version does not support single multiple file clipping. Try to set multiple to false, and get the returned file object through @ done",
|
||||
occurFileSizeErrorMsg:
|
||||
"File size warning,The maximum file size cannot exceed target KB",
|
||||
startUploadMsg: "Upload Start",
|
||||
confirmBtn: "confirm",
|
||||
cancelBtn: "cancel",
|
||||
title: "title",
|
||||
},
|
||||
};
|
||||
65
src/language/locales/zh_CN.ts
Normal file
65
src/language/locales/zh_CN.ts
Normal file
@@ -0,0 +1,65 @@
|
||||
export default {
|
||||
input: {
|
||||
placeholder: "请输入",
|
||||
},
|
||||
page: {
|
||||
previous: "上一页",
|
||||
next: "下一页",
|
||||
goTo: "到第",
|
||||
confirm: "确认",
|
||||
page: "页",
|
||||
item: "条",
|
||||
total: "共",
|
||||
},
|
||||
datePicker: {
|
||||
year: "年",
|
||||
month: "月",
|
||||
sunday: "日",
|
||||
monday: "一",
|
||||
tuesday: "二",
|
||||
wednesday: "三",
|
||||
thursday: "四",
|
||||
friday: "五",
|
||||
saturday: "六",
|
||||
january: "1月",
|
||||
february: "2月",
|
||||
march: "3月",
|
||||
april: "4月",
|
||||
may: "5月",
|
||||
june: "6月",
|
||||
july: "7月",
|
||||
august: "8月",
|
||||
september: "9月",
|
||||
october: "10月",
|
||||
november: "11月",
|
||||
december: "12月",
|
||||
selectDate: "选择日期",
|
||||
selectTime: "选择时间",
|
||||
selectYear: "选择年份",
|
||||
selectMonth: "选择月份",
|
||||
clear: "清空",
|
||||
confirm: "确认",
|
||||
cancel: "取消",
|
||||
now: "现在",
|
||||
},
|
||||
empty: {
|
||||
description: "无数据",
|
||||
},
|
||||
upload: {
|
||||
text: "上传文件",
|
||||
dragText: "点击上传,或将文件拖拽到此处",
|
||||
defaultErrorMsg: "上传失败",
|
||||
urlErrorMsg: "上传地址格式不合法",
|
||||
numberErrorMsg: "文件上传超过规定的个数",
|
||||
cutInitErrorMsg: "剪裁插件初始化失败",
|
||||
uploadSuccess: "上传成功",
|
||||
cannotSupportCutMsg:
|
||||
"当前版本暂不支持单次多文件剪裁,尝试设置 multiple 为 false, 通过 @done 获取返回文件对象",
|
||||
occurFileSizeErrorMsg:
|
||||
"文件大小超过限制,文件最大不可超过传入的指定size属性的KB数",
|
||||
startUploadMsg: "开始上传",
|
||||
confirmBtn: "确认",
|
||||
cancelBtn: "取消",
|
||||
title: "标题",
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user