Skip to content

Commit f2de089

Browse files
committed
i18n 初始化
1 parent b2299c3 commit f2de089

File tree

5 files changed

+118
-7
lines changed

5 files changed

+118
-7
lines changed

package-lock.json

Lines changed: 72 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
"prettier": "^3.4.2",
1919
"utf8": "^3.0.0",
2020
"vue": "^3.5.13",
21-
"vue-draggable-plus": "^0.6.0"
21+
"vue-draggable-plus": "^0.6.0",
22+
"vue-i18n": "^10.0.7"
2223
},
2324
"devDependencies": {
2425
"@types/base-64": "^1.0.2",

src/consts.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ export const getFnType = (fnType: string = "linear") =>
9090
export const graphTypeArr = [
9191
{ value: "interval", label: "默认" },
9292
{ value: "polyline", label: "多段线" },
93-
// { value: "text", label: "文本" },
9493
{ value: "scatter", label: "散点" },
9594
] as const satisfies ValueLabel[];
9695

src/i18n.ts

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import { createI18n } from "vue-i18n";
2+
export default createI18n({
3+
locale: "zh-CN",
4+
messages: {
5+
"zh-CN": {
6+
buttons: {
7+
add: "添加",
8+
import: "导入",
9+
raw: "原始数据",
10+
},
11+
options: {
12+
default: "默认",
13+
polyline: "多段线",
14+
scatter: "散点",
15+
linear: "一般",
16+
implicit: "隐函数",
17+
parametric: "参数方程",
18+
polar: "极坐标",
19+
},
20+
titles: {
21+
fn: "函数",
22+
range: "范围",
23+
color: "颜色",
24+
colorPlaceholder: "RGB / HEX / 颜色名称",
25+
nSamples: "采样数",
26+
nSamplesPlaceholder: "默认值为宽度",
27+
closed: "闭合并填充",
28+
vector: "向量",
29+
vectorValue: "向量大小",
30+
vectorOffset: "起点坐标",
31+
},
32+
},
33+
"en-US": {},
34+
},
35+
});

src/main.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1-
import { createApp } from 'vue'
2-
import './style.css'
3-
import App from './App.vue'
1+
import { createApp } from "vue";
42

5-
createApp(App).mount('#app')
3+
import i18n from "./i18n";
4+
import "./style.css";
5+
import App from "./App.vue";
6+
7+
const app = createApp(App);
8+
9+
app.use(i18n);
10+
app.mount("#app");

0 commit comments

Comments
 (0)