protoc-gen-go-errors-i18n

command module
v2.0.0-...-8e55a6f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 7, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

README

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(), "")
	}

}

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL