feat: add i18n support

This commit is contained in:
uubulb
2024-11-01 05:07:04 +08:00
parent 482d787a56
commit 5114fc2854
30 changed files with 930 additions and 91 deletions

View File

@@ -185,7 +185,7 @@ func commonHandler[T any](handler handlerFunc[T]) func(*gin.Context) {
switch err.(type) {
case *gormError:
log.Printf("NEZHA>> gorm error: %v", err)
c.JSON(http.StatusOK, newErrorResponse(errors.New("database error")))
c.JSON(http.StatusOK, newErrorResponse(singleton.Localizer.ErrorT("database error")))
return
case *wsError:
// Connection is upgraded to WebSocket, so c.Writer is no longer usable