From 1ddfe4aba3ff16df9e5006051407d2488ffe4a59 Mon Sep 17 00:00:00 2001 From: "Shishkevich D." <135337715+shishkevichd@users.noreply.github.com> Date: Fri, 9 May 2025 10:46:29 +0700 Subject: chore: toasts translation refactoring --- web/controller/server.go | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'web/controller/server.go') 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) -- cgit v1.2.3