TrMsg translate the reason cause as a message
(lang i18n.Language)
| 39 | |
| 40 | // TrMsg translate the reason cause as a message |
| 41 | func (r *RespBody) TrMsg(lang i18n.Language) *RespBody { |
| 42 | if len(r.Message) == 0 { |
| 43 | r.Message = translator.Tr(lang, r.Reason) |
| 44 | } |
| 45 | return r |
| 46 | } |
| 47 | |
| 48 | // NewRespBody new response body |
| 49 | func NewRespBody(code int, reason string) *RespBody { |