i18n
The pkg/i18n library provides localization support to Golang microservices.
go get src.srdev.io/pkg/i18n
import "src.srdev.io/pkg/i18n"
Usage
Localized strings can be retrieved from the desired or best available bundle by first creating a Translator func:
T := i18n.NewTranslator("global", "en-US")
The "T" func is then passed the needed message key using dot notation to traverse the bundle structure:
fmt.Println(T("test.key"))
The LoadBundle function retrieves the entire catalog for a given locale as a byte slice
b := i18n.LoadBundle("global", "en-US")
Links
Build: Jenkins