refactor: support i18n

This commit is contained in:
mlogclub
2026-05-25 12:06:15 +08:00
parent 309ac1fe9e
commit 988f55c80d
179 changed files with 10968 additions and 3763 deletions
+4 -1
View File
@@ -1,6 +1,7 @@
package middleware
import (
"cs-agent/internal/pkg/i18nx"
"cs-agent/internal/services"
"github.com/gin-gonic/gin"
@@ -16,7 +17,9 @@ func AuthMiddleware(ctx *gin.Context) {
func authenticateRequest(ctx *gin.Context) bool {
if _, err := services.AuthService.Authenticate(ctx); err != nil {
ctx.JSON(200, web.JsonError(err))
result := web.JsonError(err)
result.Message = i18nx.T(ctx, "error.auth.expired", nil)
ctx.JSON(200, result)
ctx.Abort()
return false
}