Add i18n translations and update tsconfig.json

This commit is contained in:
smallstone 2023-12-20 18:25:32 +08:00
parent 23ecbf6cba
commit 790152b8c3
6 changed files with 31 additions and 41 deletions

3
src/views/i18n/en.json Normal file
View File

@ -0,0 +1,3 @@
{
"Delete message": "Delete message"
}

View File

@ -1,16 +1,21 @@
import i18n from "i18next";
import { initReactI18next } from "react-i18next";
import enTranslations from "./en.json";
import zhTranslations from "./zh.json";
console.log("enTranslations: ", enTranslations);
console.log("zhTranslations 233: ", zhTranslations);
i18n.use(initReactI18next).init({
resources: {
en: {
translation: {
"Delete message": "Delete message",
...enTranslations,
},
},
zh: {
translation: {
"Delete message": "删除消息",
...zhTranslations,
},
},
},

3
src/views/i18n/zh.json Normal file
View File

@ -0,0 +1,3 @@
{
"Delete message": "11删除消息"
}

View File

@ -1,26 +1,19 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "ES2020",
"lib": [
"ES2020",
"es6",
"dom"
],
"outDir": "./dist",
"sourceMap": true,
"rootDir": "src",
"strict": true,
"jsx": "react",
"esModuleInterop": true,
"noImplicitAny": false,
"paths": {
"@/*": [
"./src/*"
]
}
},
"exclude": [
"test"
]
}
"compilerOptions": {
"resolveJsonModule": true,
"esModuleInterop": true,
"module": "commonjs",
"target": "ES2020",
"lib": ["ES2020", "es6", "dom"],
"outDir": "./dist",
"sourceMap": true,
"rootDir": "src",
"strict": true,
"jsx": "react",
"noImplicitAny": false,
"paths": {
"@/*": ["./src/*"]
}
},
"exclude": ["test"]
}

View File

@ -1,9 +0,0 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"rootDir": ".",
"outDir": "out-test",
"skipLibCheck": true
},
"include": ["src/**/*.ts", "test/**/*.ts"]
}

View File

@ -72,11 +72,6 @@ const webviewConfig = {
],
include: /views/,
},
{
test: /\.json$/i,
use: "json-loader",
type: "asset/source",
},
{
test: /\.(png|jpg|jpeg|gif|svg)$/, // 匹配文件类型
use: [