i18n

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultLang = "zh-cn"

Functions

func NewError

func NewError(ctx context.Context, code int, v ...interface{}) error

NewError 参数校验错误

func NewErrorWithStatus

func NewErrorWithStatus(ctx context.Context, status int, code int, v ...interface{}) error

NewErrorWithStatus 自定义错误

func NewForbiddenError

func NewForbiddenError(ctx context.Context, code int, v ...interface{}) error

NewForbiddenError 403禁止访问

func NewInternalError

func NewInternalError(ctx context.Context, code int, v ...interface{}) error

NewInternalError 500构造内部错误

func NewNotFoundError

func NewNotFoundError(ctx context.Context, code int, v ...interface{}) error

NewNotFoundError 404资源不存在

func NewUnauthorizedError

func NewUnauthorizedError(ctx context.Context, code int, v ...interface{}) error

NewUnauthorizedError 401未授权

func Register

func Register(lang string, code map[int]string)

func T

func T(ctx context.Context, key int, args ...interface{}) string

func WithLanguage

func WithLanguage(ctx context.Context, lang string) context.Context

Types

This section is empty.

Jump to

Keyboard shortcuts

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