Skip to content

Commit

Permalink
feat(cmd): Add internationalization for the output of the 1pctl versi…
Browse files Browse the repository at this point in the history
  • Loading branch information
ssongliu authored Dec 5, 2024
1 parent 7202de6 commit 5b92b75
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 8 deletions.
3 changes: 2 additions & 1 deletion backend/i18n/lang/en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -278,5 +278,6 @@ UpdatePortFirewallReload: "Failed to reload the firewall, {{ .err }}, please man
UserInfo: "Get panel information"
UserInfoAddr: "Panel address: "
UserInfoPassHelp: "Tip: To change the password, you can execute the command: "
SystemVersion: "Get system version information"
DBConnErr: "Error: Failed to initialize database connection, {{ .err }}"
SystemVersion: "version: "
SystemMode: "mode: "
3 changes: 2 additions & 1 deletion backend/i18n/lang/fa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,6 @@ UpdatePortFirewallReload: "Reload firewall namovaffagh bud, {{ .err }}, lotfan f
UserInfo: "Daryaft etela'at-e panel"
UserInfoAddr: "Adres-e panel: "
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 }}"
SystemVersion: "noskhe: "
SystemMode: "halat: "
3 changes: 2 additions & 1 deletion backend/i18n/lang/pt.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,6 @@ UpdatePortFirewallReload: "Falha ao recarregar o firewall, {{ .err }}, recarregu
UserInfo: "Obter informações do painel"
UserInfoAddr: "Endereço do painel: "
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 }}"
SystemVersion: "versão: "
SystemMode: "modo: "
3 changes: 2 additions & 1 deletion backend/i18n/lang/zh-Hant.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -278,5 +278,6 @@ UpdatePortFirewallReload: "防火牆重載失敗,{{ .err }},請您手動重
UserInfo: "獲取面板信息"
UserInfoAddr: "面板地址:"
UserInfoPassHelp: "提示:修改密碼可執行命令:"
SystemVersion: "獲取系統版本信息"
DBConnErr: "錯誤:初始化資料庫連接失敗,{{ .err }}"
SystemVersion: "版本:"
SystemMode: "模式:"
3 changes: 2 additions & 1 deletion backend/i18n/lang/zh.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -278,5 +278,6 @@ UpdatePortFirewallReload: "防火墙重载失败,{{ .err }},请您手动重
UserInfo: "获取面板信息"
UserInfoAddr: "面板地址:"
UserInfoPassHelp: "提示:修改密码可执行命令:"
SystemVersion: "获取系统版本信息"
DBConnErr: "错误:初始化数据库连接失败,{{ .err }}"
SystemVersion: "版本:"
SystemMode: "模式:"
6 changes: 3 additions & 3 deletions cmd/server/cmd/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ var versionCmd = &cobra.Command{
}
version := getSettingByKey(db, "SystemVersion")

fmt.Printf("1panel version: %s\n", version)
fmt.Println(i18n.GetMsgByKeyForCmd("SystemVersion") + version)
config := configs.ServerConfig{}
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 {
fmt.Printf("mode: %s\n", config.System.Mode)
fmt.Println(i18n.GetMsgByKeyForCmd("SystemMode") + config.System.Mode)
}
return nil
},
Expand Down

0 comments on commit 5b92b75

Please sign in to comment.