2
0
mirror of https://github.com/acepanel/panel.git synced 2026-02-04 14:57:16 +08:00

finish translation for panel.writeSite

This commit is contained in:
kkumar-gcc
2024-04-26 19:05:50 +05:30
parent d35245aa11
commit 48b539b31a
3 changed files with 79 additions and 37 deletions

View File

@@ -474,19 +474,19 @@ func (receiver *Panel) Handle(ctx console.Context) error {
php := cast.ToInt(arg4)
ssl := cast.ToBool(ctx.Argument(5))
if len(name) == 0 || len(path) == 0 {
color.Redln("参数错误")
color.Redln(translate.Get("commands.panel.writeSite.paramFail"))
return nil
}
var website models.Website
if err := facades.Orm().Query().Where("name", name).FirstOrFail(&website); err == nil {
color.Redln("网站已存在")
color.Redln(translate.Get("commands.panel.writeSite.siteExist"))
return nil
}
_, err := os.Stat(path)
if os.IsNotExist(err) {
color.Redln("网站目录不存在")
color.Redln(translate.Get("commands.panel.writeSite.pathNotExist"))
return nil
}
@@ -498,32 +498,32 @@ func (receiver *Panel) Handle(ctx console.Context) error {
Ssl: ssl,
})
if err != nil {
color.Redln("写入网站失败")
color.Redln(translate.Get("commands.panel.writeSite.fail"))
return nil
}
color.Greenln("写入网站成功")
color.Greenln(translate.Get("commands.panel.writeSite.success"))
case "deleteSite":
name := arg1
if len(name) == 0 {
color.Redln("参数错误")
color.Redln(translate.Get("commands.panel.deleteSite.paramFail"))
return nil
}
_, err := facades.Orm().Query().Where("name", name).Delete(&models.Website{})
if err != nil {
color.Redln("删除网站失败")
color.Redln(translate.Get("commands.panel.deleteSite.fail"))
return nil
}
color.Greenln("删除网站成功")
color.Greenln(translate.Get("commands.panel.deleteSite.success"))
case "writeSetting":
key := arg1
value := arg2
if len(key) == 0 || len(value) == 0 {
color.Redln("参数错误")
color.Redln(translate.Get("commands.panel.writeSetting.paramFail"))
return nil
}
@@ -534,16 +534,16 @@ func (receiver *Panel) Handle(ctx console.Context) error {
Value: value,
})
if err != nil {
color.Redln("写入设置失败")
color.Redln(translate.Get("commands.panel.writeSetting.fail"))
return nil
}
color.Greenln("写入设置成功")
color.Greenln(translate.Get("commands.panel.writeSetting.success"))
case "getSetting":
key := arg1
if len(key) == 0 {
color.Redln("参数错误")
color.Redln(translate.Get("commands.panel.getSetting.paramFail"))
return nil
}
@@ -557,17 +557,17 @@ func (receiver *Panel) Handle(ctx console.Context) error {
case "deleteSetting":
key := arg1
if len(key) == 0 {
color.Redln("参数错误")
color.Redln(translate.Get("commands.panel.deleteSetting.paramFail"))
return nil
}
_, err := facades.Orm().Query().Where("key", key).Delete(&models.Setting{})
if err != nil {
color.Redln("删除设置失败")
color.Redln(translate.Get("commands.panel.deleteSetting.fail"))
return nil
}
color.Greenln("删除设置成功")
color.Greenln(translate.Get("commands.panel.deleteSetting.success"))
case "addSite":
name := arg1
@@ -648,7 +648,7 @@ func (receiver *Panel) Handle(ctx console.Context) error {
case "installPlugin":
slug := arg1
if len(slug) == 0 {
color.Redln("参数错误")
color.Redln(translate.Get("commands.panel.installPlugin.paramFail"))
return nil
}
@@ -658,12 +658,12 @@ func (receiver *Panel) Handle(ctx console.Context) error {
return nil
}
color.Greenln("任务已提交")
color.Greenln(translate.Get("commands.panel.installPlugin.success"))
case "uninstallPlugin":
slug := arg1
if len(slug) == 0 {
color.Redln("参数错误")
color.Redln(translate.Get("commands.panel.uninstallPlugin.paramFail"))
return nil
}
@@ -673,12 +673,12 @@ func (receiver *Panel) Handle(ctx console.Context) error {
return nil
}
color.Greenln("任务已提交")
color.Greenln(translate.Get("commands.panel.uninstallPlugin.success"))
case "updatePlugin":
slug := arg1
if len(slug) == 0 {
color.Redln("参数错误")
color.Redln(translate.Get("commands.panel.updatePlugin.paramFail"))
return nil
}
@@ -688,7 +688,7 @@ func (receiver *Panel) Handle(ctx console.Context) error {
return nil
}
color.Greenln("任务已提交")
color.Greenln(translate.Get("commands.panel.updatePlugin.success"))
default:
color.Yellowln(facades.Config().GetString("panel.name") + " - " + translate.Get("commands.panel.tool") + " - " + facades.Config().GetString("panel.version"))

View File

@@ -65,13 +65,19 @@
"end": "cutting completed"
},
"installPlugin": {
"description": "install plugin"
"description": "install plugin",
"paramFail": "plugin slug is required",
"success": "task has been submitted"
},
"uninstallPlugin": {
"description": "uninstall plugin"
"description": "uninstall plugin",
"paramFail": "plugin slug is required",
"success": "task has been submitted"
},
"updatePlugin": {
"description": "update plugin"
"description": "update plugin",
"paramFail": "plugin slug is required",
"success": "task has been submitted"
},
"addSite": {
"description": "add website [domain name and port separated by commas]"
@@ -105,19 +111,34 @@
"success": "MySQL root password written successfully"
},
"writeSite": {
"description": "write website data to the panel"
"description": "write website data to the panel",
"paramFail": "name and path are required",
"siteExist": "website already exists",
"pathNotExist": "website directory does not exist",
"fail": "failed to write to website",
"success": "writing to website successfully"
},
"deleteSite": {
"description": "delete panel website data"
"description": "delete panel website data",
"paramFail": "website name is required",
"fail": "failed to delete website",
"success": "website deleted successfully"
},
"getSetting": {
"description": "get panel setting data"
"description": "get panel setting data",
"paramFail": "key is required"
},
"writeSetting": {
"description": "write/update panel setting data"
"description": "write/update panel setting data",
"paramFail": "key and value are required",
"fail": "Writing settings failed",
"success": "settings written successfully"
},
"deleteSetting": {
"description": "delete panel setting data"
"description": "delete panel setting data",
"paramFail": "key is required",
"fail": "failed to delete settings",
"success": "settings deleted successfully"
}
},
"panel:task": {

View File

@@ -65,13 +65,19 @@
"end": "切割完成"
},
"installPlugin": {
"description": "安装插件"
"description": "安装插件",
"paramFail": "参数错误",
"success": "任务已提交"
},
"uninstallPlugin": {
"description": "卸载插件"
"description": "卸载插件",
"paramFail": "参数错误",
"success": "任务已提交"
},
"updatePlugin": {
"description": "更新插件"
"description": "更新插件",
"paramFail": "参数错误",
"success": "任务已提交"
},
"addSite": {
"description": "添加网站[域名和端口用英文逗号分隔]"
@@ -105,19 +111,34 @@
"success": "写入MySQL root密码成功"
},
"writeSite": {
"description": "写入网站数据到面板"
"description": "写入网站数据到面板",
"paramFail": "参数错误",
"siteExist": "网站已存在",
"pathNotExist": "网站目录不存在",
"fail": "写入网站失败",
"success": "写入网站成功"
},
"deleteSite": {
"description": "删除面板网站数据"
"description": "删除面板网站数据",
"paramFail": "参数错误",
"fail": "删除网站失败",
"success": "删除网站成功"
},
"getSetting": {
"description": "获取面板设置数据"
"description": "获取面板设置数据",
"paramFail": "参数错误"
},
"writeSetting": {
"description": "写入 / 更新面板设置数据"
"description": "写入 / 更新面板设置数据",
"paramFail": "参数错误",
"fail": "写入设置失败",
"success": "写入设置成功"
},
"deleteSetting": {
"description": "删除面板设置数据"
"description": "删除面板设置数据",
"paramFail": "参数错误",
"fail": "删除设置失败",
"success": "删除设置成功"
}
},
"panel:task": {