update: add a function to translate

This commit is contained in:
Mohammad Foroughi
2022-10-30 04:33:31 +03:30
parent 2d2d13aec0
commit 18117832e5

View File

@@ -21,3 +21,13 @@ func (a *BaseController) checkLogin(c *gin.Context) {
c.Next()
}
}
func I18n(c *gin.Context , name string, data ...string) string{
anyfunc, _ := c.Get("I18n")
i18n, _ := anyfunc.(func(key string, params ...string) (string, error))
message, _ := i18n("pages.index.title")
return message;
}