Documentation
¶
Overview ¶
Package i18n 提供了一个简单的国际化(i18n)支持库
Index ¶
- func AddTranslation(key, translation string) error
- func FormatTranslation(key string, args ...interface{}) string
- func GetCurrentLang() string
- func InitGlobal(lang string, customDir ...string) error
- func LoadTranslationsFromBytes(lang string, data []byte) error
- func SetLang(lang string) error
- func T(key string) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddTranslation ¶
AddTranslation 为当前语言添加或更新翻译,并保存到文件
func FormatTranslation ¶
FormatTranslation 格式化带参数的翻译
func InitGlobal ¶
InitGlobal 初始化全局 i18n 实例 lang: 初始语言 customDir: 可选的自定义翻译文件目录
func LoadTranslationsFromBytes ¶
LoadTranslationsFromBytes 从字节数组加载翻译
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.