Remove Go i18n duplicates

This commit is contained in:
Gucheng Wang
2023-03-19 21:47:49 +08:00
parent 4c4ad8320d
commit c7b9a77b4a
18 changed files with 55 additions and 115 deletions

View File

@ -103,7 +103,7 @@ type Captcha struct {
// @router /signup [post]
func (c *ApiController) Signup() {
if c.GetSessionUsername() != "" {
c.ResponseError(c.T("account:Please sign out first before signing up"), c.GetSessionUsername())
c.ResponseError(c.T("account:Please sign out first"), c.GetSessionUsername())
return
}
@ -211,7 +211,7 @@ func (c *ApiController) Signup() {
affected := object.AddUser(user)
if !affected {
c.ResponseError(c.T("account:Invalid information"), util.StructToJson(user))
c.ResponseError(c.T("account:Failed to add user"), util.StructToJson(user))
return
}

View File

@ -237,7 +237,7 @@ func (c *ApiController) Login() {
if form.Username != "" {
if form.Type == ResponseTypeLogin {
if c.GetSessionUsername() != "" {
c.ResponseError(c.T("account:Please sign out first before signing in"), c.GetSessionUsername())
c.ResponseError(c.T("account:Please sign out first"), c.GetSessionUsername())
return
}
}
@ -308,7 +308,7 @@ func (c *ApiController) Login() {
}
if !isHuman {
c.ResponseError(c.T("auth:Turing test failed."))
c.ResponseError(c.T("verification:Turing test failed."))
return
}
}
@ -368,7 +368,7 @@ func (c *ApiController) Login() {
idProvider := idp.GetIdProvider(provider.Type, provider.SubType, clientId, clientSecret, provider.AppId, form.RedirectUri, provider.Domain, provider.CustomAuthUrl, provider.CustomTokenUrl, provider.CustomUserInfoUrl)
if idProvider == nil {
c.ResponseError(fmt.Sprintf(c.T("auth:The provider type: %s is not supported"), provider.Type))
c.ResponseError(fmt.Sprintf(c.T("storage:The provider type: %s is not supported"), provider.Type))
return
}
@ -410,7 +410,7 @@ func (c *ApiController) Login() {
// Sign in via OAuth (want to sign up but already have account)
if user.IsForbidden {
c.ResponseError(c.T("auth:The user is forbidden to sign in, please contact the administrator"))
c.ResponseError(c.T("check:The user is forbidden to sign in, please contact the administrator"))
}
resp = c.HandleLoggedIn(application, user, &form)

View File

@ -195,7 +195,7 @@ func (c *ApiController) UploadResource() {
}
}
fileUrl, objectKey, err := object.UploadFileSafe(provider, fullFilePath, fileBuffer)
fileUrl, objectKey, err := object.UploadFileSafe(provider, fullFilePath, fileBuffer, c.GetAcceptLanguage())
if err != nil {
c.ResponseError(err.Error())
return

View File

@ -96,7 +96,7 @@ func (c *ApiController) SendVerificationCode() {
application := object.GetApplication(applicationId)
organization := object.GetOrganization(util.GetId(application.Owner, application.Organization))
if organization == nil {
c.ResponseError(c.T("verification:Organization does not exist"))
c.ResponseError(c.T("check:Organization does not exist"))
return
}
@ -112,7 +112,7 @@ func (c *ApiController) SendVerificationCode() {
switch destType {
case "email":
if !util.IsEmailValid(dest) {
c.ResponseError(c.T("verification:Email is invalid"))
c.ResponseError(c.T("check:Email is invalid"))
return
}