go get -u github.com/maczh/mgi18n
- 本框架依赖x-lang多语言字典库微服务模块提供数据支持
go:
xlang:
appName: test
default: zh-cn
mgi18n.Init()
//添加多语种支持
engine.Use(mgerr.RequestLanguage())
engine.Any("/err", func(c *gin.Context) {
m := utils.GinParamMap(c)
result = mgi18n.Error(-1,m["msgId"])
c.JSON(http.StatusOK, result)
})
engine.Any("/test", func(c *gin.Context) {
m := utils.GinParamMap(c)
result = mgi18n.Success(mgi18n.String(m["msgId"]))
c.JSON(http.StatusOK, result)
})
msgId := "100001"
msg := mgi18n.String(msgId)
func ErrorWithMsg(code int, messageId, msg string) mgresult.Result
func SuccessWithPage(data interface{},count, index, size, total int) mgresult.Result