mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-02 11:20:18 +08:00
feat: refactor backend i18n (#1373)
* fix: handle the dataSourceName when DB changes * reduce duplication of code * feat: refactor translation error message * feat: use json intsead of ini file * remove useless translation * fix translate problems * remove useless addition * fix pr problems * fix pr problems * fix split problem * use gofumpt to fmt code * use crowdin to execute backend translation * fix pr problems * refactor: change translation file structure same as frontend * delete useless output * update go.mod
This commit is contained in:
@ -241,12 +241,12 @@ func GetTokenByTokenAndApplication(token string, application string) *Token {
|
||||
|
||||
func CheckOAuthLogin(clientId string, responseType string, redirectUri string, scope string, state string, lang string) (string, *Application) {
|
||||
if responseType != "code" && responseType != "token" && responseType != "id_token" {
|
||||
return fmt.Sprintf(i18n.Translate(lang, "ApplicationErr.GrantTypeNotSupport"), responseType), nil
|
||||
return fmt.Sprintf(i18n.Translate(lang, "token:Grant_type: %s is not supported in this application"), responseType), nil
|
||||
}
|
||||
|
||||
application := GetApplicationByClientId(clientId)
|
||||
if application == nil {
|
||||
return i18n.Translate(lang, "TokenErr.InvalidClientId"), nil
|
||||
return i18n.Translate(lang, "token:Invalid client_id"), nil
|
||||
}
|
||||
|
||||
validUri := false
|
||||
@ -257,7 +257,7 @@ func CheckOAuthLogin(clientId string, responseType string, redirectUri string, s
|
||||
}
|
||||
}
|
||||
if !validUri {
|
||||
return fmt.Sprintf(i18n.Translate(lang, "TokenErr.RedirectURIDoNotExist"), redirectUri), application
|
||||
return fmt.Sprintf(i18n.Translate(lang, "token:Redirect URI: %s doesn't exist in the allowed Redirect URI list"), redirectUri), application
|
||||
}
|
||||
|
||||
// Mask application for /api/get-app-login
|
||||
@ -269,7 +269,7 @@ func GetOAuthCode(userId string, clientId string, responseType string, redirectU
|
||||
user := GetUser(userId)
|
||||
if user == nil {
|
||||
return &Code{
|
||||
Message: fmt.Sprintf("The user: %s doesn't exist", userId),
|
||||
Message: fmt.Sprintf("token:The user: %s doesn't exist", userId),
|
||||
Code: "",
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user