feat(cmd): Add internationalization for the output of the 1pctl version (#7263)

pull/7266/head
ssongliu 2024-12-05 15:43:14 +08:00 committed by GitHub
parent 7202de6f4c
commit 5b92b75090
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 13 additions and 8 deletions

View File

@ -278,5 +278,6 @@ UpdatePortFirewallReload: "Failed to reload the firewall, {{ .err }}, please man
UserInfo: "Get panel information" UserInfo: "Get panel information"
UserInfoAddr: "Panel address: " UserInfoAddr: "Panel address: "
UserInfoPassHelp: "Tip: To change the password, you can execute the command: " UserInfoPassHelp: "Tip: To change the password, you can execute the command: "
SystemVersion: "Get system version information"
DBConnErr: "Error: Failed to initialize database connection, {{ .err }}" DBConnErr: "Error: Failed to initialize database connection, {{ .err }}"
SystemVersion: "version: "
SystemMode: "mode: "

View File

@ -58,5 +58,6 @@ UpdatePortFirewallReload: "Reload firewall namovaffagh bud, {{ .err }}, lotfan f
UserInfo: "Daryaft etela'at-e panel" UserInfo: "Daryaft etela'at-e panel"
UserInfoAddr: "Adres-e panel: " UserInfoAddr: "Adres-e panel: "
UserInfoPassHelp: "Nokte: baraye taghiri ramz, mitavanid dastur zir ra anjam dahid: " UserInfoPassHelp: "Nokte: baraye taghiri ramz, mitavanid dastur zir ra anjam dahid: "
SystemVersion: "Daryaft etela'at-e version system"
DBConnErr: "Khatta: etesal be database namovaffagh bud, {{ .err }}" DBConnErr: "Khatta: etesal be database namovaffagh bud, {{ .err }}"
SystemVersion: "noskhe: "
SystemMode: "halat: "

View File

@ -58,5 +58,6 @@ UpdatePortFirewallReload: "Falha ao recarregar o firewall, {{ .err }}, recarregu
UserInfo: "Obter informações do painel" UserInfo: "Obter informações do painel"
UserInfoAddr: "Endereço do painel: " UserInfoAddr: "Endereço do painel: "
UserInfoPassHelp: "Dica: Para alterar a senha, execute o comando: " UserInfoPassHelp: "Dica: Para alterar a senha, execute o comando: "
SystemVersion: "Obter informações da versão do sistema"
DBConnErr: "Erro: Falha ao inicializar conexão com o banco de dados, {{ .err }}" DBConnErr: "Erro: Falha ao inicializar conexão com o banco de dados, {{ .err }}"
SystemVersion: "versão: "
SystemMode: "modo: "

View File

@ -278,5 +278,6 @@ UpdatePortFirewallReload: "防火牆重載失敗,{{ .err }},請您手動重
UserInfo: "獲取面板信息" UserInfo: "獲取面板信息"
UserInfoAddr: "面板地址:" UserInfoAddr: "面板地址:"
UserInfoPassHelp: "提示:修改密碼可執行命令:" UserInfoPassHelp: "提示:修改密碼可執行命令:"
SystemVersion: "獲取系統版本信息"
DBConnErr: "錯誤:初始化資料庫連接失敗,{{ .err }}" DBConnErr: "錯誤:初始化資料庫連接失敗,{{ .err }}"
SystemVersion: "版本:"
SystemMode: "模式:"

View File

@ -278,5 +278,6 @@ UpdatePortFirewallReload: "防火墙重载失败,{{ .err }},请您手动重
UserInfo: "获取面板信息" UserInfo: "获取面板信息"
UserInfoAddr: "面板地址:" UserInfoAddr: "面板地址:"
UserInfoPassHelp: "提示:修改密码可执行命令:" UserInfoPassHelp: "提示:修改密码可执行命令:"
SystemVersion: "获取系统版本信息"
DBConnErr: "错误:初始化数据库连接失败,{{ .err }}" DBConnErr: "错误:初始化数据库连接失败,{{ .err }}"
SystemVersion: "版本:"
SystemMode: "模式:"

View File

@ -29,12 +29,12 @@ var versionCmd = &cobra.Command{
} }
version := getSettingByKey(db, "SystemVersion") version := getSettingByKey(db, "SystemVersion")
fmt.Printf("1panel version: %s\n", version) fmt.Println(i18n.GetMsgByKeyForCmd("SystemVersion") + version)
config := configs.ServerConfig{} config := configs.ServerConfig{}
if err := yaml.Unmarshal(conf.AppYaml, &config); err != nil { if err := yaml.Unmarshal(conf.AppYaml, &config); err != nil {
return fmt.Errorf("unmarshal conf.App.Yaml failed, errL %v", err) return fmt.Errorf("unmarshal conf.App.Yaml failed, err: %v", err)
} else { } else {
fmt.Printf("mode: %s\n", config.System.Mode) fmt.Println(i18n.GetMsgByKeyForCmd("SystemMode") + config.System.Mode)
} }
return nil return nil
}, },