Documentation ¶
Index ¶
- func Associate(bundle *i18n.Bundle, messageFile *i18n.MessageFile, languageCodes ...string) (err error)
- func GetMessage(bundle *i18n.Bundle, messageId string, langs ...string) (string, error)
- func LoadMessageFile(bundle *i18n.Bundle, path string) (*i18n.MessageFile, error)
- func LoadMessageFileBytes(bundle *i18n.Bundle, content []byte, path string) (*i18n.MessageFile, error)
- func NewBundle(defaultLanguage language.Tag) *i18n.Bundle
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Associate ¶ added in v3.0.21
func Associate(bundle *i18n.Bundle, messageFile *i18n.MessageFile, languageCodes ...string) (err error)
Associate 关联其他语言代码.
@param languageCode 语言代码,(1) 可参考: i18nKit/_info.md
(2) 大小写“不敏感”
func LoadMessageFileBytes ¶ added in v3.0.20
func LoadMessageFileBytes(bundle *i18n.Bundle, content []byte, path string) (*i18n.MessageFile, error)
LoadMessageFileBytes
@param path 文件名 或 文件的路径(绝对 || 相对; 可以不存在)
func NewBundle ¶
NewBundle
PS: (1) 返回的 *i18n.Bundle 实例,后续可以通过 Bundle.LoadMessageFile() 或 Bundle.ParseMessageFileBytes() 继续加载message file; (2) Bundle.ParseMessageFileBytes(buf []byte, path string),传参path可以是 文件名 || 文件路径(相对或绝对,可以不存在); (3) 支持的message file类型: toml、json、yaml、properties.
@param defaultLanguage e.g. language.English || language.Chinese || language.SimplifiedChinese || language.TraditionalChinese
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.