Skip to content

Commit f903318

Browse files
author
smallstone
committed
Add i18n translations and update tsconfig.json
1 parent 00ec7ed commit f903318

6 files changed

Lines changed: 31 additions & 41 deletions

File tree

src/views/i18n/en.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"Delete message": "Delete message"
3+
}

src/views/i18n/index.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,21 @@
11
import i18n from "i18next";
22
import { initReactI18next } from "react-i18next";
33

4+
import enTranslations from "./en.json";
5+
import zhTranslations from "./zh.json";
6+
console.log("enTranslations: ", enTranslations);
7+
console.log("zhTranslations 233: ", zhTranslations);
8+
49
i18n.use(initReactI18next).init({
510
resources: {
611
en: {
712
translation: {
8-
"Delete message": "Delete message",
13+
...enTranslations,
914
},
1015
},
1116
zh: {
1217
translation: {
13-
"Delete message": "删除消息",
18+
...zhTranslations,
1419
},
1520
},
1621
},

src/views/i18n/zh.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"Delete message": "11删除消息"
3+
}

tsconfig.json

Lines changed: 18 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,19 @@
11
{
2-
"compilerOptions": {
3-
"module": "commonjs",
4-
"target": "ES2020",
5-
"lib": [
6-
"ES2020",
7-
"es6",
8-
"dom"
9-
],
10-
"outDir": "./dist",
11-
"sourceMap": true,
12-
"rootDir": "src",
13-
"strict": true,
14-
"jsx": "react",
15-
"esModuleInterop": true,
16-
"noImplicitAny": false,
17-
"paths": {
18-
"@/*": [
19-
"./src/*"
20-
]
21-
}
22-
},
23-
"exclude": [
24-
"test"
25-
]
26-
}
2+
"compilerOptions": {
3+
"resolveJsonModule": true,
4+
"esModuleInterop": true,
5+
"module": "commonjs",
6+
"target": "ES2020",
7+
"lib": ["ES2020", "es6", "dom"],
8+
"outDir": "./dist",
9+
"sourceMap": true,
10+
"rootDir": "src",
11+
"strict": true,
12+
"jsx": "react",
13+
"noImplicitAny": false,
14+
"paths": {
15+
"@/*": ["./src/*"]
16+
}
17+
},
18+
"exclude": ["test"]
19+
}

tsconfig.test.json

Lines changed: 0 additions & 9 deletions
This file was deleted.

webpack.config.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,6 @@ const webviewConfig = {
7272
],
7373
include: /views/,
7474
},
75-
{
76-
test: /\.json$/i,
77-
use: "json-loader",
78-
type: "asset/source",
79-
},
8075
{
8176
test: /\.(png|jpg|jpeg|gif|svg)$/, // 匹配文件类型
8277
use: [

0 commit comments

Comments
 (0)