Documentation ¶
Overview ¶
context
context
message_source 用来处理国际化资源
Index ¶
- func ReFormatToPlain(path string)
- type GlobalizationMessage
- type GoContext
- func (ctx *GoContext) Bind(v interface{}) error
- func (ctx *GoContext) Invoke(fn interface{}) ([]reflect.Value, error)
- func (ctx *GoContext) InvokeSpecific(fn interface{}, names ...string) ([]reflect.Value, error)
- func (ctx *GoContext) Register(v interface{})
- func (ctx *GoContext) RegisterAs(v interface{}, interfacePtr interface{})
- func (ctx *GoContext) With(fn interface{}) ([]reflect.Value, error)
- func (ctx *GoContext) WithSpecific(fn interface{}, names ...string) ([]reflect.Value, error)
- type GoNamer
- type MessageSource
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ReFormatToPlain ¶
func ReFormatToPlain(path string)
解析gotext extract产生的json文件,包装成自己项目中的json格式 ERR开头的错误文件放前面
Types ¶
type GlobalizationMessage ¶
type GlobalizationMessage struct { Code string `json:"code"` En string `json:"en_US"` Cn string `json:"zh_CN"` }
自己定义的国际化资源
type GoContext ¶
type GoContext struct {
// contains filtered or unexported fields
}
func NewGoContext ¶
func NewGoContext() *GoContext
func (*GoContext) InvokeSpecific ¶
func (*GoContext) RegisterAs ¶
func (ctx *GoContext) RegisterAs(v interface{}, interfacePtr interface{})
用接口注册
type MessageSource ¶
type MessageSource struct {
// contains filtered or unexported fields
}
func NewMessageSource ¶
func NewMessageSource() *MessageSource
func (*MessageSource) GetLocalized ¶
func (ms *MessageSource) GetLocalized(code string, lang language.Tag, a ...interface{}) string
func (*MessageSource) Load ¶
func (ms *MessageSource) Load(paths ...string)
Click to show internal directories.
Click to hide internal directories.