diff --git a/.prettierignore b/.prettierignore index 73219654..d0510d85 100755 --- a/.prettierignore +++ b/.prettierignore @@ -8,7 +8,6 @@ lerna-debug.log* data/ error -*.json # Diagnostic reports (https://nodejs.org/api/report.html) report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json diff --git a/src/app/i18n/index.ts b/src/app/i18n/index.ts index 000cc3fa..b982e618 100755 --- a/src/app/i18n/index.ts +++ b/src/app/i18n/index.ts @@ -2,8 +2,8 @@ import i18next from "i18next"; -import zh_cn from "./language/zh_cn"; -import en_us from "./language/en_us"; +import zh_cn from "./language/zh_cn.json"; +import en_us from "./language/en_us.json"; i18next.init({ lng: "en_us", diff --git a/src/app/i18n/language/en_us.json b/src/app/i18n/language/en_us.json new file mode 100644 index 00000000..764fc67e --- /dev/null +++ b/src/app/i18n/language/en_us.json @@ -0,0 +1,68 @@ +{ + "common": { + "title": "Title" + }, + + "app": { + "developInfo": "Unable to start, this project is used by MCSManager developers and cannot be run directly by ordinary users.\nPlease go to https://mcsmanager.com/ for the latest installation method.\nIf you want to run in development mode, please create a public , src/public directory and place the front-end static files and re-run.", + "panelStarted": "Control Panel has been started", + "reference": "Project Reference: https://github.com/mcsmanager", + "host": "Access address: http://localhost:{{port}}", + "portTip": "Open port {{port}} and daemon port for software public network access", + "exitTip": "To close this program please use Ctrl+C shortcut" + }, + "permission": { + "forbidden": "Insufficient permissions", + "forbiddenTokenError": "Token verification failed, access denied", + "xmlhttprequestError": "Cannot find request header x-requested-with: xmlhttprequest", + "apiError": "Incorrect key", + "forbiddenInstance": "[Forbidden] [Middleware] Incorrect parameters or illegal access to the instance", + "tooFast": "Too fast" + }, + "systemRemoteService": { + "nodeCount": "Number of remote nodes: {{n}}", + "loadDaemonTitle": "Attempting to read local daemon {{localKeyFilePath}}", + "autoCheckDaemon": "Detected local daemon, getting key and port automatically...", + "error": "The local daemon configuration file cannot be obtained automatically, please go to the panel to manually connect the daemon, go to https://docs.mcsmanager.com/ to learn more." + }, + "systemUser": { + "userCount": "Number of local users: {{n}}" + }, + "router": { + "user": { + "invalidUserName": "Invalid username format", + "invalidPassword": "Invalid password format", + "existsUserName": "Username has been occupied", + "deleteFailure": "Failed to complete user data deletion", + "passwordCheck": "The password is not standardized, it must have uppercase and lowercase letters, numbers, and the length is between 9 and 36" + }, + "instance": { + "createError": "Failed to create instance" + }, + "file": { + "off": "The administrator has restricted all users from using the file management function" + }, + "schedule": { + "invalidName": "Invalid scheduled task name" + }, + "login": { + "ban": "Too many authentications, your IP address has been locked for 10 minutes", + "nameOrPassError": "Incorrect account or password", + "init": "[Install Panel] Initializing panel admin account: {{userName}}", + "installed": "Panel is already installed and cannot be reinstalled, please backup and delete the data folder for a fresh install" + } + }, + "daemonInfo": { + "setLanguage": "set remote node language", + "connect": "The remote node {{v}} is connected", + "disconnect": "The remote node {{v}} has been disconnected", + "connectError": "Error connecting to remote node: {{v}}", + "authSuccess": "Authentication of the remote node {{v}} succeeded", + "authFailure": "Authentication failed on remote node {{v}}", + "authError": "Authentication error on remote node {{v}}", + "closed": "Actively disconnect the remote node {{v}}", + "resetConnect": "The user initiates a reconnection to a remote node that is already available, and is resetting the connection channel", + "replaceConnect": "The user initiates a repeated connection request, now to reset the connection configuration", + "tryConnect": "Attempting to connect to remote node" + } +} diff --git a/src/app/i18n/language/en_us.ts b/src/app/i18n/language/en_us.ts deleted file mode 100755 index e06b92dd..00000000 --- a/src/app/i18n/language/en_us.ts +++ /dev/null @@ -1,81 +0,0 @@ -export default { - common: { - title: "Title" - }, - // module name or file name - // src\app.ts - app: { - developInfo: - "Unable to start, this project is used by MCSManager developers and cannot be run directly by ordinary users.\nPlease go to https://mcsmanager.com/ for the latest installation method.\nIf you want to run in development mode, please create a public , src/public directory and place the front-end static files and re-run.", - panelStarted: "Control Panel has been started", - reference: "Project Reference: https://github.com/mcsmanager", - host: "Access address: http://localhost:{{port}}", - portTip: "Open port {{port}} and daemon port for software public network access", - exitTip: "To close this program please use Ctrl+C shortcut" - }, - // src\app\middleware\permission.ts - permission: { - forbidden: "Insufficient permissions", - forbiddenTokenError: "Token verification failed, access denied", - xmlhttprequestError: "Cannot find request header x-requested-with: xmlhttprequest", - apiError: "Incorrect key", - forbiddenInstance: - "[Forbidden] [Middleware] Incorrect parameters or illegal access to the instance", - tooFast: "Too fast" - }, - // src\app\service\system_remote_service.ts - systemRemoteService: { - nodeCount: "Number of remote nodes: {{n}}", - loadDaemonTitle: "Attempting to read local daemon {{localKeyFilePath}}", - autoCheckDaemon: "Detected local daemon, getting key and port automatically...", - error: - "The local daemon configuration file cannot be obtained automatically, please go to the panel to manually connect the daemon, go to https://docs.mcsmanager.com/ to learn more." - }, - systemUser: { - userCount: "Number of local users: {{n}}" - }, - router: { - user: { - invalidUserName: "Invalid username format", - invalidPassword: "Invalid password format", - existsUserName: "Username has been occupied", - deleteFailure: "Failed to complete user data deletion", - passwordCheck: - "The password is not standardized, it must have uppercase and lowercase letters, numbers, and the length is between 9 and 36" - }, - instance: { - createError: "Failed to create instance" - }, - file: { - off: "The administrator has restricted all users from using the file management function" - }, - schedule: { - invalidName: "Invalid scheduled task name" - }, - login: { - ban: "Too many authentications, your IP address has been locked for 10 minutes", - nameOrPassError: "Incorrect account or password", - init: "[Install Panel] Initializing panel admin account: {{userName}}", - installed: - "Panel is already installed and cannot be reinstalled, please backup and delete the data folder for a fresh install" - } - }, - daemonInfo: { - setLanguage: "set remote node language", - connect: "The remote node {{v}} is connected", - disconnect: "The remote node {{v}} has been disconnected", - connectError: "Error connecting to remote node: {{v}}", - authSuccess: "Authentication of the remote node {{v}} succeeded", - authFailure: "Authentication failed on remote node {{v}}", - authError: "Authentication error on remote node {{v}}", - closed: "Actively disconnect the remote node {{v}}", - resetConnect: - "The user initiates a reconnection to a remote node that is already available, and is resetting the connection channel", - replaceConnect: - "The user initiates a repeated connection request, now to reset the connection configuration", - tryConnect: "Attempting to connect to remote node" - } -}; -// import { $t } from "../../i18n"; -// $t("permission.forbiddenInstance");] -// $t("router.login.ban") diff --git a/src/app/i18n/language/zh_cn.json b/src/app/i18n/language/zh_cn.json new file mode 100644 index 00000000..633a9ce1 --- /dev/null +++ b/src/app/i18n/language/zh_cn.json @@ -0,0 +1,67 @@ +{ + "common": { + "title": "标题" + }, + "app": { + "developInfo": "无法启动,此项目是 MCSManager 开发人员所用项目,普通用户不可直接运行。\n请前往 https://mcsmanager.com/ 了解最新的安装方式。\n如果您要以开发模式运行,请创建 public,src/public 目录并放置前端静态文件再重新运行。", + "panelStarted": "控制面板端已启动", + "reference": "项目参考: https://github.com/mcsmanager", + "host": "访问地址: http://localhost:{{port}}", + "portTip": "软件公网访问需开放端口 {{port}} 与守护进程端口", + "exitTip": "关闭此程序请使用 Ctrl+C 快捷键" + }, + "permission": { + "forbidden": "权限不足", + "forbiddenTokenError": "令牌(Token)验证失败,拒绝访问", + "xmlhttprequestError": "无法找到请求头 x-requested-with: xmlhttprequest", + "apiError": "密钥不正确", + "forbiddenInstance": "[Forbidden] [中间件] 参数不正确或非法访问实例", + "tooFast": "请求速度过快,请稍后再进行操作" + }, + "systemRemoteService": { + "nodeCount": "远程节点数:{{n}}", + "loadDaemonTitle": "正在尝试读取本地守护进程 {{localKeyFilePath}}", + "autoCheckDaemon": "检测到本地守护进程,正在自动获取密钥和端口...", + "error": "无法自动获取本地守护进程配置文件,请前往面板手动连接守护进程,前往 https://docs.mcsmanager.com/ 了解更多。" + }, + "systemUser": { + "userCount": "本地用户数:{{n}}" + }, + "router": { + "user": { + "invalidUserName": "非法的用户名格式", + "invalidPassword": "非法的密码格式", + "existsUserName": "用户名已经被占用", + "deleteFailure": "无法完成用户数据删除", + "passwordCheck": "密码不规范,必须为拥有大小写字母,数字,长度在9到36之间" + }, + "instance": { + "createError": "创建实例失败" + }, + "file": { + "off": "管理员已限制全部用户使用文件管理功能" + }, + "schedule": { + "invalidName": "非法的计划任务名" + }, + "login": { + "ban": "身份验证次数过多,您的 IP 地址已被锁定 10 分钟", + "nameOrPassError": "账号或密码错误", + "init": "[安装面板] 正在初始化面板管理员账号: {{userName}}", + "installed": "面板已安装,无法重新安装,请备份并删除 data 文件夹以实现全新安装" + } + }, + "daemonInfo": { + "connect": "远程节点 {{- v}} 已连接", + "disconnect": "远程节点 {{- v}} 已断开", + "connectError": "连接远程节点错误:{{- v}} ", + "authSuccess": "远程节点 {{- v}} 密钥验证通过", + "authFailure": "远程节点 {{- v}} 密钥验证拒绝", + "authError": "远程节点 {{- v}} 密钥验证错误", + "closed": "主动断开远程节点 {{- v}} ", + "resetConnect": "用户发起重连已可用状态的远程节点,正在重置连接通道", + "replaceConnect": "用户发起重复连接请求,现进行重置连接配置", + "tryConnect": "正在尝试连接远程节点", + "setLanguage": "设置节点语言" + } +} diff --git a/src/app/i18n/language/zh_cn.ts b/src/app/i18n/language/zh_cn.ts deleted file mode 100755 index ecb22ee7..00000000 --- a/src/app/i18n/language/zh_cn.ts +++ /dev/null @@ -1,76 +0,0 @@ -export default { - common: { - title: "标题" - }, - // 模块名或者文件名 - // src\app.ts - app: { - developInfo: - "无法启动,此项目是 MCSManager 开发人员所用项目,普通用户不可直接运行。\n请前往 https://mcsmanager.com/ 了解最新的安装方式。\n如果您要以开发模式运行,请创建 public,src/public 目录并放置前端静态文件再重新运行。", - panelStarted: "控制面板端已启动", - reference: "项目参考: https://github.com/mcsmanager", - host: "访问地址: http://localhost:{{port}}", - portTip: "软件公网访问需开放端口 {{port}} 与守护进程端口", - exitTip: "关闭此程序请使用 Ctrl+C 快捷键" - }, - // src\app\middleware\permission.ts - permission: { - forbidden: "权限不足", - forbiddenTokenError: "令牌(Token)验证失败,拒绝访问", - xmlhttprequestError: "无法找到请求头 x-requested-with: xmlhttprequest", - apiError: "密钥不正确", - forbiddenInstance: "[Forbidden] [中间件] 参数不正确或非法访问实例", - tooFast: "请求速度过快,请稍后再进行操作" - }, - // src\app\service\system_remote_service.ts - systemRemoteService: { - nodeCount: "远程节点数:{{n}}", - loadDaemonTitle: "正在尝试读取本地守护进程 {{localKeyFilePath}}", - autoCheckDaemon: "检测到本地守护进程,正在自动获取密钥和端口...", - error: - "无法自动获取本地守护进程配置文件,请前往面板手动连接守护进程,前往 https://docs.mcsmanager.com/ 了解更多。" - }, - systemUser: { - userCount: "本地用户数:{{n}}" - }, - router: { - user: { - invalidUserName: "非法的用户名格式", - invalidPassword: "非法的密码格式", - existsUserName: "用户名已经被占用", - deleteFailure: "无法完成用户数据删除", - passwordCheck: "密码不规范,必须为拥有大小写字母,数字,长度在9到36之间" - }, - instance: { - createError: "创建实例失败" - }, - file: { - off: "管理员已限制全部用户使用文件管理功能" - }, - schedule: { - invalidName: "非法的计划任务名" - }, - login: { - ban: "身份验证次数过多,您的 IP 地址已被锁定 10 分钟", - nameOrPassError: "账号或密码错误", - init: "[安装面板] 正在初始化面板管理员账号: {{userName}}", - installed: "面板已安装,无法重新安装,请备份并删除 data 文件夹以实现全新安装" - } - }, - daemonInfo: { - connect: "远程节点 {{- v}} 已连接", - disconnect: "远程节点 {{- v}} 已断开", - connectError: "连接远程节点错误:{{- v}} ", - authSuccess: "远程节点 {{- v}} 密钥验证通过", - authFailure: "远程节点 {{- v}} 密钥验证拒绝", - authError: "远程节点 {{- v}} 密钥验证错误", - closed: "主动断开远程节点 {{- v}} ", - resetConnect: "用户发起重连已可用状态的远程节点,正在重置连接通道", - replaceConnect: "用户发起重复连接请求,现进行重置连接配置", - tryConnect: "正在尝试连接远程节点", - setLanguage: "设置节点语言" - } -}; -// import { $t } from "../../i18n"; -// $t("permission.forbiddenInstance");] -// $t("router.login.ban") diff --git a/tsconfig.json b/tsconfig.json index a8524f66..bf97de80 100755 --- a/tsconfig.json +++ b/tsconfig.json @@ -2,6 +2,8 @@ { "compilerOptions": { + "resolveJsonModule": true, + "esModuleInterop": true, "allowJs": false, "module": "commonjs", "esModuleInterop": true, @@ -13,13 +15,8 @@ "outDir": "dist", "baseUrl": ".", "paths": { - "*": [ - "node_modules/*", - "src/types/*" - ] + "*": ["node_modules/*", "src/types/*"] } }, - "include": [ - "src/**/*" - ] -} \ No newline at end of file + "include": ["src/**/*"] +}