protoc-gen-go-errors-i18n
generate i18n method for errors
for example
func ErrorInvalidCredentialsLocalized(localizer *i18n.Localizer, data map[string]interface{}, pluralCount interface{}) *errors.Error {
msg, err := localizer.Localize(&i18n.LocalizeConfig{
DefaultMessage: &i18n.Message{
ID: "InvalidCredentials",
},
TemplateData: data,
PluralCount: pluralCount,
})
if err == nil {
return errors.New(400, ErrorReason_INVALID_CREDENTIALS.String(), msg)
} else {
return errors.New(400, ErrorReason_INVALID_CREDENTIALS.String(), "")
}
}