mirror of
https://github.com/casdoor/casdoor.git
synced 2025-09-07 11:00:28 +08:00
feat: support i18n in backend err messages (#1232)
* feat: support i18n in backend err messages * use gofumpt to fmt code * fix review problems * support auto generate err message * delete beego/i18n moudle * fix Github action test problems * fix review problems * use gofumpt to format code * use gofumpt to fmt code
This commit is contained in:
@@ -23,7 +23,7 @@ import (
|
||||
func (c *ApiController) Enforce() {
|
||||
userId := c.GetSessionUsername()
|
||||
if userId == "" {
|
||||
c.ResponseError("Please sign in first")
|
||||
c.ResponseError(c.T("EnforcerErr.SignInFirst"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ func (c *ApiController) Enforce() {
|
||||
func (c *ApiController) BatchEnforce() {
|
||||
userId := c.GetSessionUsername()
|
||||
if userId == "" {
|
||||
c.ResponseError("Please sign in first")
|
||||
c.ResponseError(c.T("EnforcerErr.SignInFirst"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ func (c *ApiController) BatchEnforce() {
|
||||
func (c *ApiController) GetAllObjects() {
|
||||
userId := c.GetSessionUsername()
|
||||
if userId == "" {
|
||||
c.ResponseError("Please sign in first")
|
||||
c.ResponseError(c.T("EnforcerErr.SignInFirst"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ func (c *ApiController) GetAllObjects() {
|
||||
func (c *ApiController) GetAllActions() {
|
||||
userId := c.GetSessionUsername()
|
||||
if userId == "" {
|
||||
c.ResponseError("Please sign in first")
|
||||
c.ResponseError(c.T("EnforcerErr.SignInFirst"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ func (c *ApiController) GetAllActions() {
|
||||
func (c *ApiController) GetAllRoles() {
|
||||
userId := c.GetSessionUsername()
|
||||
if userId == "" {
|
||||
c.ResponseError("Please sign in first")
|
||||
c.ResponseError(c.T("EnforcerErr.SignInFirst"))
|
||||
return
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user