refactor: update UI text and error messages to English for better accessibility

This commit is contained in:
Laisky.Cai
2025-01-19 12:59:58 +00:00
parent 76ba80d406
commit 13b1b165bd
62 changed files with 805 additions and 805 deletions

View File

@@ -27,7 +27,7 @@ func authHelper(c *gin.Context, minRole int) {
if accessToken == "" {
c.JSON(http.StatusUnauthorized, gin.H{
"success": false,
"message": "无权进行此操作,未登录且未提供 access token",
"message": "No permission to perform this operation, not logged in and no access token provided",
})
c.Abort()
return
@@ -43,7 +43,7 @@ func authHelper(c *gin.Context, minRole int) {
} else {
c.JSON(http.StatusOK, gin.H{
"success": false,
"message": "无权进行此操作,access token 无效",
"message": "No permission to perform this operation, access token is invalid",
})
c.Abort()
return
@@ -52,7 +52,7 @@ func authHelper(c *gin.Context, minRole int) {
if status.(int) == model.UserStatusDisabled || blacklist.IsUserBanned(id.(int)) {
c.JSON(http.StatusOK, gin.H{
"success": false,
"message": "用户已被封禁",
"message": "User has been banned",
})
session := sessions.Default(c)
session.Clear()
@@ -63,7 +63,7 @@ func authHelper(c *gin.Context, minRole int) {
if role.(int) < minRole {
c.JSON(http.StatusOK, gin.H{
"success": false,
"message": "无权进行此操作,权限不足",
"message": "No permission to perform this operation, insufficient permissions",
})
c.Abort()
return
@@ -107,7 +107,7 @@ func TokenAuth() func(c *gin.Context) {
}
if token.Subnet != nil && *token.Subnet != "" {
if !network.IsIpInSubnets(ctx, c.ClientIP(), *token.Subnet) {
abortWithMessage(c, http.StatusForbidden, fmt.Sprintf("该令牌只能在指定网段使用:%s当前 ip%s", *token.Subnet, c.ClientIP()))
abortWithMessage(c, http.StatusForbidden, fmt.Sprintf("该API Keys只能在指定网段使用:%s当前 ip%s", *token.Subnet, c.ClientIP()))
return
}
}
@@ -117,7 +117,7 @@ func TokenAuth() func(c *gin.Context) {
return
}
if !userEnabled || blacklist.IsUserBanned(token.UserId) {
abortWithMessage(c, http.StatusForbidden, "用户已被封禁")
abortWithMessage(c, http.StatusForbidden, "User has been banned")
return
}
requestModel, err := getRequestModel(c)
@@ -129,7 +129,7 @@ func TokenAuth() func(c *gin.Context) {
if token.Models != nil && *token.Models != "" {
c.Set(ctxkey.AvailableModels, *token.Models)
if requestModel != "" && !isModelInList(requestModel, *token.Models) {
abortWithMessage(c, http.StatusForbidden, fmt.Sprintf("该令牌无权使用模型%s", requestModel))
abortWithMessage(c, http.StatusForbidden, fmt.Sprintf("该API KeysNone权使用Model%s", requestModel))
return
}
}
@@ -144,7 +144,7 @@ func TokenAuth() func(c *gin.Context) {
if model.IsAdmin(token.UserId) {
c.Set(ctxkey.SpecificChannelId, parts[1])
} else {
abortWithMessage(c, http.StatusForbidden, "普通用户不支持指定渠道")
abortWithMessage(c, http.StatusForbidden, "Ordinary users do not support specifying channels")
return
}
}