From c0310d916f2bf589dab1905a61799dfcd7539f5c Mon Sep 17 00:00:00 2001 From: kkumar-gcc Date: Mon, 22 Apr 2024 20:01:17 +0530 Subject: [PATCH] add `commands` prefix for command translation --- app/console/commands/cert_renew.go | 2 +- app/console/commands/monitoring.go | 2 +- app/console/commands/panel.go | 56 +++++----- app/console/commands/panel_task.go | 2 +- lang/en.json | 158 +++++++++++++++-------------- lang/zh_CN.json | 158 +++++++++++++++-------------- 6 files changed, 191 insertions(+), 187 deletions(-) diff --git a/app/console/commands/cert_renew.go b/app/console/commands/cert_renew.go index 70806061..845aa453 100644 --- a/app/console/commands/cert_renew.go +++ b/app/console/commands/cert_renew.go @@ -27,7 +27,7 @@ func (receiver *CertRenew) Signature() string { // Description The console command description. func (receiver *CertRenew) Description() string { ctx := context.Background() - return facades.Lang(ctx).Get("panel:cert-renew.description") + return facades.Lang(ctx).Get("commands.panel:cert-renew.description") } // Extend The console command extend. diff --git a/app/console/commands/monitoring.go b/app/console/commands/monitoring.go index 869da0bf..3eeb28e5 100644 --- a/app/console/commands/monitoring.go +++ b/app/console/commands/monitoring.go @@ -29,7 +29,7 @@ func (receiver *Monitoring) Signature() string { // Description The console command description. func (receiver *Monitoring) Description() string { ctx := context.Background() - return facades.Lang(ctx).Get("panel:monitoring.description") + return facades.Lang(ctx).Get("commands.panel:monitoring.description") } // Extend The console command extend. diff --git a/app/console/commands/panel.go b/app/console/commands/panel.go index f9c05b2a..fa8f7ded 100644 --- a/app/console/commands/panel.go +++ b/app/console/commands/panel.go @@ -33,7 +33,7 @@ func (receiver *Panel) Signature() string { // Description The console command description. func (receiver *Panel) Description() string { ctx := context.Background() - return facades.Lang(ctx).Get("panel.description") + return facades.Lang(ctx).Get("commands.panel.description") } // Extend The console command extend. @@ -163,10 +163,10 @@ func (receiver *Panel) Handle(ctx console.Context) error { return nil } - color.Greenln(translate.Get("panel.getPort.port") + ": " + port) + color.Greenln(translate.Get("commands.panel.getPort.port") + ": " + port) case "getEntrance": - color.Greenln(translate.Get("panel.getEntrance.entrance") + ": " + facades.Config().GetString("http.entrance")) + color.Greenln(translate.Get("commands.panel.getEntrance.entrance") + ": " + facades.Config().GetString("http.entrance")) case "deleteEntrance": oldEntrance, err := tools.Exec(`cat /www/panel/panel.conf | grep APP_ENTRANCE | awk -F '=' '{print $2}' | tr -d '\n'`) @@ -691,31 +691,31 @@ func (receiver *Panel) Handle(ctx console.Context) error { color.Greenln("任务已提交") default: - color.Yellowln(facades.Config().GetString("panel.name") + " - " + translate.Get("panel.cmd_tool") + " - " + facades.Config().GetString("panel.version")) - color.Greenln(translate.Get("panel.use_commands") + ":") - color.Greenln("panel update " + translate.Get("panel.update.description")) - color.Greenln("panel getInfo " + translate.Get("panel.getInfo.description")) - color.Greenln("panel getPort " + translate.Get("panel.getPort.description")) - color.Greenln("panel getEntrance " + translate.Get("panel.getEntrance.description")) - color.Greenln("panel deleteEntrance " + translate.Get("panel.deleteEntrance.description")) - color.Greenln("panel cleanTask " + translate.Get("panel.cleanTask.description")) - color.Greenln("panel backup {website/mysql/postgresql} {name} {path} {save_copies} " + translate.Get("panel.backup.description")) - color.Greenln("panel cutoff {website_name} {save_copies} " + translate.Get("panel.cutoff.description")) - color.Greenln("panel installPlugin {slug} " + translate.Get("panel.installPlugin.description")) - color.Greenln("panel uninstallPlugin {slug} " + translate.Get("panel.uninstallPlugin.description")) - color.Greenln("panel updatePlugin {slug} " + translate.Get("panel.updatePlugin.description")) - color.Greenln("panel addSite {name} {domain} {port} {path} {php} " + translate.Get("panel.addSite.description")) - color.Greenln("panel removeSite {name} " + translate.Get("panel.removeSite.description")) - color.Redln(translate.Get("panel.developer_guidance") + ":") - color.Yellowln("panel init " + translate.Get("panel.init.description")) - color.Yellowln("panel writePlugin {slug} {version} " + translate.Get("panel.writePlugin.description")) - color.Yellowln("panel deletePlugin {slug} " + translate.Get("panel.deletePlugin.description")) - color.Yellowln("panel writeMysqlPassword {password} " + translate.Get("panel.writeMysqlPassword.description")) - color.Yellowln("panel writeSite {name} {status} {path} {php} {ssl} " + translate.Get("panel.writeSite.description")) - color.Yellowln("panel deleteSite {name} " + translate.Get("panel.deleteSite.description")) - color.Yellowln("panel getSetting {name} " + translate.Get("panel.getSetting.description")) - color.Yellowln("panel writeSetting {name} {value} " + translate.Get("panel.writeSetting.description")) - color.Yellowln("panel deleteSetting {name} " + translate.Get("panel.deleteSetting.description")) + color.Yellowln(facades.Config().GetString("panel.name") + " - " + translate.Get("commands.panel.tool") + " - " + facades.Config().GetString("panel.version")) + color.Greenln(translate.Get("commands.panel.use") + ":") + color.Greenln("panel update " + translate.Get("commands.panel.update.description")) + color.Greenln("panel getInfo " + translate.Get("commands.panel.getInfo.description")) + color.Greenln("panel getPort " + translate.Get("commands.panel.getPort.description")) + color.Greenln("panel getEntrance " + translate.Get("commands.panel.getEntrance.description")) + color.Greenln("panel deleteEntrance " + translate.Get("commands.panel.deleteEntrance.description")) + color.Greenln("panel cleanTask " + translate.Get("commands.panel.cleanTask.description")) + color.Greenln("panel backup {website/mysql/postgresql} {name} {path} {save_copies} " + translate.Get("commands.panel.backup.description")) + color.Greenln("panel cutoff {website_name} {save_copies} " + translate.Get("commands.panel.cutoff.description")) + color.Greenln("panel installPlugin {slug} " + translate.Get("commands.panel.installPlugin.description")) + color.Greenln("panel uninstallPlugin {slug} " + translate.Get("commands.panel.uninstallPlugin.description")) + color.Greenln("panel updatePlugin {slug} " + translate.Get("commands.panel.updatePlugin.description")) + color.Greenln("panel addSite {name} {domain} {port} {path} {php} " + translate.Get("commands.panel.addSite.description")) + color.Greenln("panel removeSite {name} " + translate.Get("commands.panel.removeSite.description")) + color.Redln(translate.Get("commands.panel.forDeveloper") + ":") + color.Yellowln("panel init " + translate.Get("commands.panel.init.description")) + color.Yellowln("panel writePlugin {slug} {version} " + translate.Get("commands.panel.writePlugin.description")) + color.Yellowln("panel deletePlugin {slug} " + translate.Get("commands.panel.deletePlugin.description")) + color.Yellowln("panel writeMysqlPassword {password} " + translate.Get("commands.panel.writeMysqlPassword.description")) + color.Yellowln("panel writeSite {name} {status} {path} {php} {ssl} " + translate.Get("commands.panel.writeSite.description")) + color.Yellowln("panel deleteSite {name} " + translate.Get("commands.panel.deleteSite.description")) + color.Yellowln("panel getSetting {name} " + translate.Get("commands.panel.getSetting.description")) + color.Yellowln("panel writeSetting {name} {value} " + translate.Get("commands.panel.writeSetting.description")) + color.Yellowln("panel deleteSetting {name} " + translate.Get("commands.panel.deleteSetting.description")) } return nil diff --git a/app/console/commands/panel_task.go b/app/console/commands/panel_task.go index e07592ab..7bd01555 100644 --- a/app/console/commands/panel_task.go +++ b/app/console/commands/panel_task.go @@ -23,7 +23,7 @@ func (receiver *PanelTask) Signature() string { // Description The console command description. func (receiver *PanelTask) Description() string { - return facades.Lang(context.Background()).Get("panel:task.description") + return facades.Lang(context.Background()).Get("commands.panel:task.description") } // Extend The console command extend. diff --git a/lang/en.json b/lang/en.json index 42998091..1f22bef8 100644 --- a/lang/en.json +++ b/lang/en.json @@ -1,85 +1,87 @@ { - "panel:cert-renew": { - "description": "[Panel] Certificate renewal" - }, - "panel:monitoring": { - "description": "[Panel] System Monitoring" - }, - "panel": { - "description": "[Panel] Command line", - "developer_guidance": "Please use the following commands under the guidance of the developer", - "use_commands": "Please use the following commands", - "cmd_tool": "command line tool", - "update": { - "description": "update/fix panel to latest version" + "commands": { + "panel:cert-renew": { + "description": "[Panel] Certificate renewal" }, - "getInfo": { - "description": "reinitialize panel account information" + "panel:monitoring": { + "description": "[Panel] System Monitoring" }, - "getPort": { - "description": "get the panel access port", - "port": "panel port" + "panel": { + "description": "[Panel] Command line", + "forDeveloper": "Please use the following commands under the guidance of the developer", + "use": "Please use the following commands", + "tool": "command line tool", + "update": { + "description": "update/fix panel to latest version" + }, + "getInfo": { + "description": "reinitialize panel account information" + }, + "getPort": { + "description": "get the panel access port", + "port": "panel port" + }, + "getEntrance": { + "description": "get panel access", + "entrance": "entrance" + }, + "deleteEntrance": { + "description": "delete panel access" + }, + "cleanTask": { + "description": "clean up running and waiting tasks in the panel [used when tasks are stuck]" + }, + "backup": { + "description": "back up website/MySQL database/PostgreSQL database to the specified directory and retain the specified amount" + }, + "cutoff": { + "description": "cut website logs and keep specified amount" + }, + "installPlugin": { + "description": "install plugin" + }, + "uninstallPlugin": { + "description": "uninstall plugin" + }, + "updatePlugin": { + "description": "update plugin" + }, + "addSite": { + "description": "add website [domain name and port separated by commas]" + }, + "removeSite": { + "description": "remove website" + }, + "init": { + "description": "initialize the panel" + }, + "writePlugin": { + "description": "write plugin installation status" + }, + "deletePlugin": { + "description": "delete plugin installation status" + }, + "writeMysqlPassword": { + "description": "write MySQL root password" + }, + "writeSite": { + "description": "write website data to the panel" + }, + "deleteSite": { + "description": "delete panel website data" + }, + "getSetting": { + "description": "get panel setting data" + }, + "writeSetting": { + "description": "write/update panel setting data" + }, + "deleteSetting": { + "description": "delete panel setting data" + } }, - "getEntrance": { - "description": "get panel access", - "entrance": "entrance" - }, - "deleteEntrance": { - "description": "delete panel access" - }, - "cleanTask": { - "description": "clean up running and waiting tasks in the panel [used when tasks are stuck]" - }, - "backup": { - "description": "back up website/MySQL database/PostgreSQL database to the specified directory and retain the specified amount" - }, - "cutoff": { - "description": "cut website logs and keep specified amount" - }, - "installPlugin": { - "description": "install plugin" - }, - "uninstallPlugin": { - "description": "uninstall plugin" - }, - "updatePlugin": { - "description": "update plugin" - }, - "addSite": { - "description": "add website [domain name and port separated by commas]" - }, - "removeSite": { - "description": "remove website" - }, - "init": { - "description": "initialize the panel" - }, - "writePlugin": { - "description": "write plugin installation status" - }, - "deletePlugin": { - "description": "delete plugin installation status" - }, - "writeMysqlPassword": { - "description": "write MySQL root password" - }, - "writeSite": { - "description": "write website data to the panel" - }, - "deleteSite": { - "description": "delete panel website data" - }, - "getSetting": { - "description": "get panel setting data" - }, - "writeSetting": { - "description": "write/update panel setting data" - }, - "deleteSetting": { - "description": "delete panel setting data" + "panel:task": { + "description": "[Panel] Daily tasks" } - }, - "panel:task": { - "description": "[Panel] Daily tasks" } } \ No newline at end of file diff --git a/lang/zh_CN.json b/lang/zh_CN.json index 36d157f6..d7ccdd3d 100644 --- a/lang/zh_CN.json +++ b/lang/zh_CN.json @@ -1,85 +1,87 @@ { - "panel:cert-renew": { - "description": "[面板] 证书续签" - }, - "panel:monitoring": { - "description": "[面板] 系统监控" - }, - "panel": { - "description": "[面板] 命令行", - "developer_guidance": "以下命令请在开发者指导下使用", - "use_commands": "请使用以下命令", - "cmd_tool": "命令行工具", - "update": { - "description": "更新 / 修复面板到最新版本" + "commands": { + "panel:cert-renew": { + "description": "[面板] 证书续签" }, - "getInfo": { - "description": "重新初始化面板账号信息" + "panel:monitoring": { + "description": "[面板] 系统监控" }, - "getPort": { - "description": "获取面板访问端口", - "port": "面板端口" + "panel": { + "description": "[面板] 命令行", + "forDeveloper": "以下命令请在开发者指导下使用", + "use": "请使用以下命令", + "tool": "命令行工具", + "update": { + "description": "更新 / 修复面板到最新版本" + }, + "getInfo": { + "description": "重新初始化面板账号信息" + }, + "getPort": { + "description": "获取面板访问端口", + "port": "面板端口" + }, + "getEntrance": { + "description": "获取面板访问入口", + "entrance": "面板入口" + }, + "deleteEntrance": { + "description": "删除面板访问入口" + }, + "cleanTask": { + "description": "清理面板运行中和等待中的任务[任务卡住时使用]" + }, + "backup": { + "description": "备份网站 / MySQL数据库 / PostgreSQL数据库到指定目录并保留指定数量" + }, + "cutoff": { + "description": "切割网站日志并保留指定数量" + }, + "installPlugin": { + "description": "安装插件" + }, + "uninstallPlugin": { + "description": "卸载插件" + }, + "updatePlugin": { + "description": "更新插件" + }, + "addSite": { + "description": "添加网站[域名和端口用英文逗号分隔]" + }, + "removeSite": { + "description": "删除网站" + }, + "init": { + "description": "初始化面板" + }, + "writePlugin": { + "description": "写入插件安装状态" + }, + "deletePlugin": { + "description": "移除插件安装状态" + }, + "writeMysqlPassword": { + "description": "写入MySQL root密码" + }, + "writeSite": { + "description": "写入网站数据到面板" + }, + "deleteSite": { + "description": "删除面板网站数据" + }, + "getSetting": { + "description": "获取面板设置数据" + }, + "writeSetting": { + "description": "写入 / 更新面板设置数据" + }, + "deleteSetting": { + "description": "删除面板设置数据" + } }, - "getEntrance": { - "description": "获取面板访问入口", - "entrance": "面板入口" - }, - "deleteEntrance": { - "description": "删除面板访问入口" - }, - "cleanTask": { - "description": "清理面板运行中和等待中的任务[任务卡住时使用]" - }, - "backup": { - "description": "备份网站 / MySQL数据库 / PostgreSQL数据库到指定目录并保留指定数量" - }, - "cutoff": { - "description": "切割网站日志并保留指定数量" - }, - "installPlugin": { - "description": "安装插件" - }, - "uninstallPlugin": { - "description": "卸载插件" - }, - "updatePlugin": { - "description": "更新插件" - }, - "addSite": { - "description": "添加网站[域名和端口用英文逗号分隔]" - }, - "removeSite": { - "description": "删除网站" - }, - "init": { - "description": "初始化面板" - }, - "writePlugin": { - "description": "写入插件安装状态" - }, - "deletePlugin": { - "description": "移除插件安装状态" - }, - "writeMysqlPassword": { - "description": "写入MySQL root密码" - }, - "writeSite": { - "description": "写入网站数据到面板" - }, - "deleteSite": { - "description": "删除面板网站数据" - }, - "getSetting": { - "description": "获取面板设置数据" - }, - "writeSetting": { - "description": "写入 / 更新面板设置数据" - }, - "deleteSetting": { - "description": "删除面板设置数据" + "panel:task": { + "description": "[面板] 每日任务" } - }, - "panel:task": { - "description": "[面板] 每日任务" } } \ No newline at end of file