Documentation
¶
Index ¶
- func DeMessages() map[string]string
- func EnMessages() map[string]string
- func EsMessages() map[string]string
- func FrMessages() map[string]string
- func GetLocale() string
- func JaMessages() map[string]string
- func KoMessages() map[string]string
- func Lookup(l, key string) string
- func Msg(key string, args ...map[string]string) string
- func Normalize(l string) string
- func Register(l, key, template string)
- func RegisterMessages(l string, messages map[string]string)
- func RuMessages() map[string]string
- func SetLocale(l string)
- func ZhMessages() map[string]string
- func ZhTWMessages() map[string]string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Msg ¶
Msg 根据 key 查找当前语言环境的消息模板,并用 args 替换占位符
单次快照加载即取得 locale 与消息库:原实现 GetLocale + Lookup 各取一次 RLock, 且 Lookup 会对已规范化的 locale 再跑一次 Normalize(内含 ToLower/ReplaceAll 分配)
func RegisterMessages ¶
RegisterMessages 批量注册某个语言下的翻译模板
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.