Minimalistic Go internationalization (i18n) package.
Setting up an INTL instance
langSrcs = []LangSource{
{
Lang: "EN",
Filepath: "path/to/file.yml",
},
}
i, err := intl.New(langSrcs...)
Getting the specific locale before use
locale, err := i.GetLocale("EN")
Using locale to get a basic message
msg, err := locale.Msg("msg-name")
Using locale to get a template message
data := MsgTmpl{"name": "John Doe"}
msg, err := locale.Msg("template-msg-name", data)
Files are just a collection of messages.
Messages can optionally be templates, following the default go text/template
logic.
# example.yml
greet: "Welcome!"
dialog-start: "Hello, {{ .name }}!"