diff options
| author | Shishkevich D. <135337715+shishkevichd@users.noreply.github.com> | 2025-05-09 06:46:29 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-05-09 06:46:29 +0300 |
| commit | 1ddfe4aba3ff16df9e5006051407d2488ffe4a59 (patch) | |
| tree | 28eb61df88797217558fd168e3a3bac7b49dc7b6 /web/controller/server.go | |
| parent | fe3b1c9b52f584b0f045907585b206344fed55db (diff) | |
chore: toasts translation refactoring
Diffstat (limited to 'web/controller/server.go')
| -rw-r--r-- | web/controller/server.go | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/web/controller/server.go b/web/controller/server.go index 5d89e356..e00a1206 100644 --- a/web/controller/server.go +++ b/web/controller/server.go @@ -109,19 +109,19 @@ func (a *ServerController) stopXrayService(c *gin.Context) { a.lastGetStatusTime = time.Now() err := a.serverService.StopXrayService() if err != nil { - jsonMsg(c, "", err) + jsonMsg(c, I18nWeb(c, "pages.xray.stopError"), err) return } - jsonMsg(c, "Xray stopped", err) + jsonMsg(c, I18nWeb(c, "pages.xray.stopSuccess"), err) } func (a *ServerController) restartXrayService(c *gin.Context) { err := a.serverService.RestartXrayService() if err != nil { - jsonMsg(c, "", err) + jsonMsg(c, I18nWeb(c, "pages.xray.restartError"), err) return } - jsonMsg(c, "Xray restarted", err) + jsonMsg(c, I18nWeb(c, "pages.xray.restartSuccess"), err) } func (a *ServerController) getLogs(c *gin.Context) { @@ -135,7 +135,7 @@ func (a *ServerController) getLogs(c *gin.Context) { func (a *ServerController) getConfigJson(c *gin.Context) { configJson, err := a.serverService.GetConfigJson() if err != nil { - jsonMsg(c, "get config.json", err) + jsonMsg(c, I18nWeb(c, "pages.index.getConfigError"), err) return } jsonObj(c, configJson, nil) @@ -144,7 +144,7 @@ func (a *ServerController) getConfigJson(c *gin.Context) { func (a *ServerController) getDb(c *gin.Context) { db, err := a.serverService.GetDb() if err != nil { - jsonMsg(c, "get Database", err) + jsonMsg(c, I18nWeb(c, "pages.index.getDatabaseError"), err) return } @@ -172,7 +172,7 @@ func (a *ServerController) importDB(c *gin.Context) { // Get the file from the request body file, _, err := c.Request.FormFile("db") if err != nil { - jsonMsg(c, "Error reading db file", err) + jsonMsg(c, I18nWeb(c, "pages.index.readDatabaseError"), err) return } defer file.Close() @@ -184,16 +184,16 @@ func (a *ServerController) importDB(c *gin.Context) { // Import it err = a.serverService.ImportDB(file) if err != nil { - jsonMsg(c, "", err) + jsonMsg(c, I18nWeb(c, "pages.index.importDatabaseError"), err) return } - jsonObj(c, "Import DB", nil) + jsonObj(c, I18nWeb(c, "pages.index.importDatabaseSuccess"), nil) } func (a *ServerController) getNewX25519Cert(c *gin.Context) { cert, err := a.serverService.GetNewX25519Cert() if err != nil { - jsonMsg(c, "get x25519 certificate", err) + jsonMsg(c, I18nWeb(c, "pages.inbounds.toasts.getNewX25519CertError"), err) return } jsonObj(c, cert, nil) |
