mirror of
https://github.com/acepanel/panel.git
synced 2026-02-04 10:17:17 +08:00
setup basic translations
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package commands
|
||||
|
||||
import (
|
||||
"context"
|
||||
"crypto/x509"
|
||||
"encoding/pem"
|
||||
|
||||
@@ -25,7 +26,8 @@ func (receiver *CertRenew) Signature() string {
|
||||
|
||||
// Description The console command description.
|
||||
func (receiver *CertRenew) Description() string {
|
||||
return "[面板] 证书续签"
|
||||
ctx := context.Background()
|
||||
return facades.Lang(ctx).Get("panel:cert-renew.description")
|
||||
}
|
||||
|
||||
// Extend The console command extend.
|
||||
@@ -36,7 +38,7 @@ func (receiver *CertRenew) Extend() command.Extend {
|
||||
}
|
||||
|
||||
// Handle Execute the console command.
|
||||
func (receiver *CertRenew) Handle(ctx console.Context) error {
|
||||
func (receiver *CertRenew) Handle(console.Context) error {
|
||||
if internal.Status != internal.StatusNormal {
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package commands
|
||||
|
||||
import (
|
||||
"context"
|
||||
"strconv"
|
||||
|
||||
"github.com/gookit/color"
|
||||
@@ -27,7 +28,8 @@ func (receiver *Monitoring) Signature() string {
|
||||
|
||||
// Description The console command description.
|
||||
func (receiver *Monitoring) Description() string {
|
||||
return "[面板] 系统监控"
|
||||
ctx := context.Background()
|
||||
return facades.Lang(ctx).Get("panel:monitoring.description")
|
||||
}
|
||||
|
||||
// Extend The console command extend.
|
||||
@@ -38,7 +40,7 @@ func (receiver *Monitoring) Extend() command.Extend {
|
||||
}
|
||||
|
||||
// Handle Execute the console command.
|
||||
func (receiver *Monitoring) Handle(ctx console.Context) error {
|
||||
func (receiver *Monitoring) Handle(console.Context) error {
|
||||
if internal.Status != internal.StatusNormal {
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package commands
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
@@ -31,7 +32,8 @@ func (receiver *Panel) Signature() string {
|
||||
|
||||
// Description The console command description.
|
||||
func (receiver *Panel) Description() string {
|
||||
return "[面板] 命令行"
|
||||
ctx := context.Background()
|
||||
return facades.Lang(ctx).Get("panel.description")
|
||||
}
|
||||
|
||||
// Extend The console command extend.
|
||||
@@ -50,6 +52,8 @@ func (receiver *Panel) Handle(ctx console.Context) error {
|
||||
arg4 := ctx.Argument(4)
|
||||
arg5 := ctx.Argument(5)
|
||||
|
||||
translate := facades.Lang(context.Background())
|
||||
|
||||
switch action {
|
||||
case "init":
|
||||
var check models.User
|
||||
@@ -159,10 +163,10 @@ func (receiver *Panel) Handle(ctx console.Context) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
color.Greenln("面板端口: " + port)
|
||||
color.Greenln(translate.Get("panel.getPort.port") + ": " + port)
|
||||
|
||||
case "getEntrance":
|
||||
color.Greenln("面板入口: " + facades.Config().GetString("http.entrance"))
|
||||
color.Greenln(translate.Get("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'`)
|
||||
@@ -687,31 +691,31 @@ func (receiver *Panel) Handle(ctx console.Context) error {
|
||||
color.Greenln("任务已提交")
|
||||
|
||||
default:
|
||||
color.Yellowln(facades.Config().GetString("panel.name") + "命令行工具 - " + facades.Config().GetString("panel.version"))
|
||||
color.Greenln("请使用以下命令:")
|
||||
color.Greenln("panel update 更新 / 修复面板到最新版本")
|
||||
color.Greenln("panel getInfo 重新初始化面板账号信息")
|
||||
color.Greenln("panel getPort 获取面板访问端口")
|
||||
color.Greenln("panel getEntrance 获取面板访问入口")
|
||||
color.Greenln("panel deleteEntrance 删除面板访问入口")
|
||||
color.Greenln("panel cleanTask 清理面板运行中和等待中的任务[任务卡住时使用]")
|
||||
color.Greenln("panel backup {website/mysql/postgresql} {name} {path} {save_copies} 备份网站 / MySQL数据库 / PostgreSQL数据库到指定目录并保留指定数量")
|
||||
color.Greenln("panel cutoff {website_name} {save_copies} 切割网站日志并保留指定数量")
|
||||
color.Greenln("panel installPlugin {slug} 安装插件")
|
||||
color.Greenln("panel uninstallPlugin {slug} 卸载插件")
|
||||
color.Greenln("panel updatePlugin {slug} 更新插件")
|
||||
color.Greenln("panel addSite {name} {domain} {port} {path} {php} 添加网站[域名和端口用英文逗号分隔]")
|
||||
color.Greenln("panel removeSite {name} 删除网站")
|
||||
color.Redln("以下命令请在开发者指导下使用:")
|
||||
color.Yellowln("panel init 初始化面板")
|
||||
color.Yellowln("panel writePlugin {slug} {version} 写入插件安装状态")
|
||||
color.Yellowln("panel deletePlugin {slug} 移除插件安装状态")
|
||||
color.Yellowln("panel writeMysqlPassword {password} 写入MySQL root密码")
|
||||
color.Yellowln("panel writeSite {name} {status} {path} {php} {ssl} 写入网站数据到面板")
|
||||
color.Yellowln("panel deleteSite {name} 删除面板网站数据")
|
||||
color.Yellowln("panel getSetting {name} 获取面板设置数据")
|
||||
color.Yellowln("panel writeSetting {name} {value} 写入 / 更新面板设置数据")
|
||||
color.Yellowln("panel deleteSetting {name} 删除面板设置数据")
|
||||
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"))
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package commands
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/goravel/framework/contracts/console"
|
||||
"github.com/goravel/framework/contracts/console/command"
|
||||
"github.com/goravel/framework/facades"
|
||||
@@ -21,7 +23,7 @@ func (receiver *PanelTask) Signature() string {
|
||||
|
||||
// Description The console command description.
|
||||
func (receiver *PanelTask) Description() string {
|
||||
return "[面板] 每日任务"
|
||||
return facades.Lang(context.Background()).Get("panel:task.description")
|
||||
}
|
||||
|
||||
// Extend The console command extend.
|
||||
@@ -32,7 +34,7 @@ func (receiver *PanelTask) Extend() command.Extend {
|
||||
}
|
||||
|
||||
// Handle Execute the console command.
|
||||
func (receiver *PanelTask) Handle(ctx console.Context) error {
|
||||
func (receiver *PanelTask) Handle(console.Context) error {
|
||||
internal.Status = internal.StatusMaintain
|
||||
|
||||
// 优化数据库
|
||||
|
||||
@@ -19,6 +19,7 @@ import (
|
||||
"github.com/goravel/framework/schedule"
|
||||
"github.com/goravel/framework/support/carbon"
|
||||
"github.com/goravel/framework/testing"
|
||||
"github.com/goravel/framework/translation"
|
||||
"github.com/goravel/framework/validation"
|
||||
"github.com/goravel/gin"
|
||||
|
||||
@@ -60,7 +61,7 @@ func init() {
|
||||
// The application locale determines the default locale that will be used
|
||||
// by the translation service provider.You are free to set this value
|
||||
// to any of the locales which will be supported by the application.
|
||||
"locale": "zh_CN",
|
||||
"locale": config.Env("APP_LOCALE", "zh_CN"),
|
||||
|
||||
// Application Fallback Locale
|
||||
//
|
||||
@@ -96,6 +97,7 @@ func init() {
|
||||
&crypt.ServiceProvider{},
|
||||
&filesystem.ServiceProvider{},
|
||||
&validation.ServiceProvider{},
|
||||
&translation.ServiceProvider{},
|
||||
&testing.ServiceProvider{},
|
||||
&providers.AppServiceProvider{},
|
||||
&providers.AuthServiceProvider{},
|
||||
|
||||
85
lang/en.json
Normal file
85
lang/en.json
Normal file
@@ -0,0 +1,85 @@
|
||||
{
|
||||
"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"
|
||||
},
|
||||
"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"
|
||||
}
|
||||
},
|
||||
"panel:task": {
|
||||
"description": "[Panel] Daily tasks"
|
||||
}
|
||||
}
|
||||
85
lang/zh_CN.json
Normal file
85
lang/zh_CN.json
Normal file
@@ -0,0 +1,85 @@
|
||||
{
|
||||
"panel:cert-renew": {
|
||||
"description": "[面板] 证书续签"
|
||||
},
|
||||
"panel:monitoring": {
|
||||
"description": "[面板] 系统监控"
|
||||
},
|
||||
"panel": {
|
||||
"description": "[面板] 命令行",
|
||||
"developer_guidance": "以下命令请在开发者指导下使用",
|
||||
"use_commands": "请使用以下命令",
|
||||
"cmd_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": "删除面板设置数据"
|
||||
}
|
||||
},
|
||||
"panel:task": {
|
||||
"description": "[面板] 每日任务"
|
||||
}
|
||||
}
|
||||
@@ -4,5 +4,6 @@ APP_DEBUG=false
|
||||
APP_PORT=8888
|
||||
APP_ENTRANCE=/
|
||||
APP_SSL=false
|
||||
APP_LOCALE=
|
||||
|
||||
JWT_SECRET=
|
||||
|
||||
Reference in New Issue
Block a user