From b412df70f1b2e9f10b75e095a2329f10b48e01b5 Mon Sep 17 00:00:00 2001 From: MHSanaei Date: Sat, 18 Feb 2023 16:07:32 +0330 Subject: update pack 2 --- web/controller/base.go | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'web/controller/base.go') diff --git a/web/controller/base.go b/web/controller/base.go index 6ed2f0ef..a9659bd2 100644 --- a/web/controller/base.go +++ b/web/controller/base.go @@ -12,7 +12,7 @@ type BaseController struct { func (a *BaseController) checkLogin(c *gin.Context) { if !session.IsLogin(c) { if isAjax(c) { - pureJsonMsg(c, false, I18n(c , "pages.login.loginAgain")) + pureJsonMsg(c, false, I18n(c, "pages.login.loginAgain")) } else { c.Redirect(http.StatusTemporaryRedirect, c.GetString("base_path")) } @@ -22,12 +22,11 @@ func (a *BaseController) checkLogin(c *gin.Context) { } } +func I18n(c *gin.Context, name string) string { + anyfunc, _ := c.Get("I18n") + i18n, _ := anyfunc.(func(key string, params ...string) (string, error)) -func I18n(c *gin.Context , name string) string{ - anyfunc, _ := c.Get("I18n") - i18n, _ := anyfunc.(func(key string, params ...string) (string, error)) + message, _ := i18n(name) - message, _ := i18n(name) - - return message; + return message } -- cgit v1.2.3