String i18n utilities for the Go Programming Language
polyglot is a String translation package and tool for Go.
Make sure you have a working Go installation. See Getting Started
Now run go get github.com/lxn/polyglot
and
go get github.com/lxn/polyglot/polyglot
.
func tr(source string, context ...string) string
, e.g. tr("bla")
. You
have to provide this function for every package you wish to use polyglot
from.tr
function. It will create or
update JSON .tr files, adding new translatable strings that it finds.Please see the hellopolyglot example for more details.