Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
i18n
✓ github.com/nicksnyder/go-i18n/v2/i18n
Minimal example showing how to load translations and localize a message.
package main
import (
"fmt"
"github.com/nicksnyder/go-i18n/v2/i18n"
"golang.org/x/text/language"
)
func main() {
bundle := i18n.NewBundle(language.English)
bundle.RegisterUnmarshalFunc("toml", i18n.UnmarshalTOML)
bundle.MustLoadMessageFile("en.toml")
localizer := i18n.NewLocalizer(bundle, language.English.String())
msg := localizer.MustLocalize(&i18n.LocalizeConfig{MessageID: "HelloWorld"})
fmt.Println(msg)
}
Debug
Known issues
No known issues recorded.
Upgrade
Version history
2.4.0+incompatiblelatest on pkg.go.dev
Audit
Dependencies
No dependency data recorded yet.