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

@@ -1,8 +1,6 @@
package controller
import (
"errors"
"github.com/gin-gonic/gin"
"github.com/naiba/nezha/model"
"github.com/naiba/nezha/service/singleton"
@@ -44,10 +42,10 @@ func createUser(c *gin.Context) (uint64, error) {
}
if len(uf.Password) < 6 {
return 0, errors.New("password length must be greater than 6")
return 0, singleton.Localizer.ErrorT("password length must be greater than 6")
}
if uf.Username == "" {
return 0, errors.New("username can't be empty")
return 0, singleton.Localizer.ErrorT("username can't be empty")
}
var u model.User