From d86c75b9250ed09f34823022a8a57dfefff46d56 Mon Sep 17 00:00:00 2001 From: Alireza Ahmadi Date: Mon, 15 May 2023 19:26:11 +0200 Subject: [PATCH] translation --- web/controller/inbound.go | 22 ++-- web/controller/setting.go | 26 ++-- web/controller/xui.go | 2 +- web/html/xui/form/client.html | 12 +- web/html/xui/form/protocol/shadowsocks.html | 4 +- web/html/xui/form/protocol/trojan.html | 4 +- web/html/xui/form/protocol/vless.html | 4 +- web/html/xui/form/protocol/vmess.html | 4 +- web/translation/translate.en_US.toml | 124 +++++++++++++------ web/translation/translate.fa_IR.toml | 128 ++++++++++++++------ web/translation/translate.zh_Hans.toml | 120 +++++++++++++----- 11 files changed, 310 insertions(+), 140 deletions(-) diff --git a/web/controller/inbound.go b/web/controller/inbound.go index 99b472e5..f84a5721 100644 --- a/web/controller/inbound.go +++ b/web/controller/inbound.go @@ -90,7 +90,7 @@ func (a *InboundController) addInbound(c *gin.Context) { inbound := &model.Inbound{} err := c.ShouldBind(inbound) if err != nil { - jsonMsg(c, I18n(c, "pages.inbounds.addTo"), err) + jsonMsg(c, I18n(c, "pages.inbounds.create"), err) return } user := session.GetLoginUser(c) @@ -98,7 +98,7 @@ func (a *InboundController) addInbound(c *gin.Context) { inbound.Enable = true inbound.Tag = fmt.Sprintf("inbound-%v", inbound.Port) inbound, err = a.inboundService.AddInbound(inbound) - jsonMsgObj(c, I18n(c, "pages.inbounds.addTo"), inbound, err) + jsonMsgObj(c, I18n(c, "pages.inbounds.create"), inbound, err) if err == nil { a.xrayService.SetToNeedRestart() } @@ -120,7 +120,7 @@ func (a *InboundController) delInbound(c *gin.Context) { func (a *InboundController) updateInbound(c *gin.Context) { id, err := strconv.Atoi(c.Param("id")) if err != nil { - jsonMsg(c, I18n(c, "pages.inbounds.revise"), err) + jsonMsg(c, I18n(c, "pages.inbounds.update"), err) return } inbound := &model.Inbound{ @@ -128,11 +128,11 @@ func (a *InboundController) updateInbound(c *gin.Context) { } err = c.ShouldBind(inbound) if err != nil { - jsonMsg(c, I18n(c, "pages.inbounds.revise"), err) + jsonMsg(c, I18n(c, "pages.inbounds.update"), err) return } inbound, err = a.inboundService.UpdateInbound(inbound) - jsonMsgObj(c, I18n(c, "pages.inbounds.revise"), inbound, err) + jsonMsgObj(c, I18n(c, "pages.inbounds.update"), inbound, err) if err == nil { a.xrayService.SetToNeedRestart() } @@ -142,7 +142,7 @@ func (a *InboundController) addInboundClient(c *gin.Context) { data := &model.Inbound{} err := c.ShouldBind(data) if err != nil { - jsonMsg(c, I18n(c, "pages.inbounds.revise"), err) + jsonMsg(c, I18n(c, "pages.inbounds.update"), err) return } @@ -160,7 +160,7 @@ func (a *InboundController) addInboundClient(c *gin.Context) { func (a *InboundController) delInboundClient(c *gin.Context) { id, err := strconv.Atoi(c.Param("id")) if err != nil { - jsonMsg(c, I18n(c, "pages.inbounds.revise"), err) + jsonMsg(c, I18n(c, "pages.inbounds.update"), err) return } clientId := c.Param("clientId") @@ -182,7 +182,7 @@ func (a *InboundController) updateInboundClient(c *gin.Context) { inbound := &model.Inbound{} err := c.ShouldBind(inbound) if err != nil { - jsonMsg(c, I18n(c, "pages.inbounds.revise"), err) + jsonMsg(c, I18n(c, "pages.inbounds.update"), err) return } @@ -200,7 +200,7 @@ func (a *InboundController) updateInboundClient(c *gin.Context) { func (a *InboundController) resetClientTraffic(c *gin.Context) { id, err := strconv.Atoi(c.Param("id")) if err != nil { - jsonMsg(c, I18n(c, "pages.inbounds.revise"), err) + jsonMsg(c, I18n(c, "pages.inbounds.update"), err) return } email := c.Param("email") @@ -228,7 +228,7 @@ func (a *InboundController) resetAllTraffics(c *gin.Context) { func (a *InboundController) resetAllClientTraffics(c *gin.Context) { id, err := strconv.Atoi(c.Param("id")) if err != nil { - jsonMsg(c, I18n(c, "pages.inbounds.revise"), err) + jsonMsg(c, I18n(c, "pages.inbounds.update"), err) return } @@ -243,7 +243,7 @@ func (a *InboundController) resetAllClientTraffics(c *gin.Context) { func (a *InboundController) delDepletedClients(c *gin.Context) { id, err := strconv.Atoi(c.Param("id")) if err != nil { - jsonMsg(c, I18n(c, "pages.inbounds.revise"), err) + jsonMsg(c, I18n(c, "pages.inbounds.update"), err) return } err = a.inboundService.DelDepletedClients(id) diff --git a/web/controller/setting.go b/web/controller/setting.go index 3f1e49df..10129d17 100644 --- a/web/controller/setting.go +++ b/web/controller/setting.go @@ -43,7 +43,7 @@ func (a *SettingController) initRouter(g *gin.RouterGroup) { func (a *SettingController) getAllSetting(c *gin.Context) { allSetting, err := a.settingService.GetAllSetting() if err != nil { - jsonMsg(c, I18n(c, "pages.setting.toasts.getSetting"), err) + jsonMsg(c, I18n(c, "pages.settings.toasts.getSetting"), err) return } jsonObj(c, allSetting, nil) @@ -52,22 +52,22 @@ func (a *SettingController) getAllSetting(c *gin.Context) { func (a *SettingController) getDefaultSettings(c *gin.Context) { expireDiff, err := a.settingService.GetExpireDiff() if err != nil { - jsonMsg(c, I18n(c, "pages.setting.toasts.getSetting"), err) + jsonMsg(c, I18n(c, "pages.settings.toasts.getSetting"), err) return } trafficDiff, err := a.settingService.GetTrafficDiff() if err != nil { - jsonMsg(c, I18n(c, "pages.setting.toasts.getSetting"), err) + jsonMsg(c, I18n(c, "pages.settings.toasts.getSetting"), err) return } defaultCert, err := a.settingService.GetCertFile() if err != nil { - jsonMsg(c, I18n(c, "pages.setting.toasts.getSetting"), err) + jsonMsg(c, I18n(c, "pages.settings.toasts.getSetting"), err) return } defaultKey, err := a.settingService.GetKeyFile() if err != nil { - jsonMsg(c, I18n(c, "pages.setting.toasts.getSetting"), err) + jsonMsg(c, I18n(c, "pages.settings.toasts.getSetting"), err) return } result := map[string]interface{}{ @@ -83,27 +83,27 @@ func (a *SettingController) updateSetting(c *gin.Context) { allSetting := &entity.AllSetting{} err := c.ShouldBind(allSetting) if err != nil { - jsonMsg(c, I18n(c, "pages.setting.toasts.modifySetting"), err) + jsonMsg(c, I18n(c, "pages.settings.toasts.modifySetting"), err) return } err = a.settingService.UpdateAllSetting(allSetting) - jsonMsg(c, I18n(c, "pages.setting.toasts.modifySetting"), err) + jsonMsg(c, I18n(c, "pages.settings.toasts.modifySetting"), err) } func (a *SettingController) updateUser(c *gin.Context) { form := &updateUserForm{} err := c.ShouldBind(form) if err != nil { - jsonMsg(c, I18n(c, "pages.setting.toasts.modifySetting"), err) + jsonMsg(c, I18n(c, "pages.settings.toasts.modifySetting"), err) return } user := session.GetLoginUser(c) if user.Username != form.OldUsername || user.Password != form.OldPassword { - jsonMsg(c, I18n(c, "pages.setting.toasts.modifyUser"), errors.New(I18n(c, "pages.setting.toasts.originalUserPassIncorrect"))) + jsonMsg(c, I18n(c, "pages.settings.toasts.modifyUser"), errors.New(I18n(c, "pages.settings.toasts.originalUserPassIncorrect"))) return } if form.NewUsername == "" || form.NewPassword == "" { - jsonMsg(c, I18n(c, "pages.setting.toasts.modifyUser"), errors.New(I18n(c, "pages.setting.toasts.userPassMustBeNotEmpty"))) + jsonMsg(c, I18n(c, "pages.settings.toasts.modifyUser"), errors.New(I18n(c, "pages.settings.toasts.userPassMustBeNotEmpty"))) return } err = a.userService.UpdateUser(user.Id, form.NewUsername, form.NewPassword) @@ -112,18 +112,18 @@ func (a *SettingController) updateUser(c *gin.Context) { user.Password = form.NewPassword session.SetLoginUser(c, user) } - jsonMsg(c, I18n(c, "pages.setting.toasts.modifyUser"), err) + jsonMsg(c, I18n(c, "pages.settings.toasts.modifyUser"), err) } func (a *SettingController) restartPanel(c *gin.Context) { err := a.panelService.RestartPanel(time.Second * 3) - jsonMsg(c, I18n(c, "pages.setting.restartPanel"), err) + jsonMsg(c, I18n(c, "pages.settings.restartPanel"), err) } func (a *SettingController) getDefaultXrayConfig(c *gin.Context) { defaultJsonConfig, err := a.settingService.GetDefaultXrayConfig() if err != nil { - jsonMsg(c, I18n(c, "pages.setting.toasts.getSetting"), err) + jsonMsg(c, I18n(c, "pages.settings.toasts.getSetting"), err) return } jsonObj(c, defaultJsonConfig, nil) diff --git a/web/controller/xui.go b/web/controller/xui.go index 5832be84..fc3ca5f8 100644 --- a/web/controller/xui.go +++ b/web/controller/xui.go @@ -38,5 +38,5 @@ func (a *XUIController) inbounds(c *gin.Context) { } func (a *XUIController) setting(c *gin.Context) { - html(c, "setting.html", "pages.setting.title", nil) + html(c, "setting.html", "pages.settings.title", nil) } diff --git a/web/html/xui/form/client.html b/web/html/xui/form/client.html index 85b2a6fc..83aab2be 100644 --- a/web/html/xui/form/client.html +++ b/web/html/xui/form/client.html @@ -14,10 +14,10 @@ - {{ i18n "pages.inbounds.Email" }} + {{ i18n "pages.inbounds.email" }} @@ -39,7 +39,7 @@ - ID + ID @@ -55,7 +55,7 @@ - Subscription + Subscription @@ -83,7 +83,7 @@ - {{ i18n "pages.inbounds.totalFlow" }}(GB) + {{ i18n "pages.inbounds.totalFlow" }}(GB)