Customized international multilingual support for gin, built on golangorg/x/text/language and supporting GRPC server calls
go get -u github.com/hinet/gin-i18n
Using for GRPC
import (
"google.golang.org/grpc"
i18n "github.com/hinet/gin-i18n"
)
grpc.NewServer(
grpc.UnaryInterceptor(i18n.LanguageInterceptor),
)
//services
func login(ctx context.Context) {
t := i18n.GetTranslator()
println(t.Translate("welcome {name}!!", map[string]string{"name":"liming"}))
}