i18n

package
v0.12.4 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetPrinter

func GetPrinter(r *http.Request) *message.Printer

GetPrinter ...

func GetTag

func GetTag(r *http.Request) language.Tag

GetTag ...

Types

type ErrorCode

type ErrorCode int

ErrorCode ...

const (
	ErrOK             ErrorCode = iota // ok
	ErrSystemError                     // system error
	ErrSystemFailed                    // system faild
	ErrSystemPause                     // system pause
	ErrSystemReadonly                  // system readonly

	ErrNotFound      // 404
	ErrForbiddedn    // 403
	ErrParamRequired // need some param or value input
	ErrParamInvalid  // invalid param

	ErrLoginFailed    // Incorrect username or password
	ErrAuthRequired   // 401 need login
	ErrVerifySend     // old error (1402, "😓发送验证码失败")
	ErrRegistFaild    // old error (1403, "😓注册失败")
	ErrNoneMobile     // old error (1404, "😓没有这个手机号!")
	ErrBadAlias       // old error (1405, "🤔貌似不像合法的名称?")
	ErrBadEmail       // old error (1408, "🤔您确认这是邮箱地址?")
	ErrBadMobile      // old error (1406, "🤔您确认这是手机号码?")
	ErrAliasTaken     // old error (1407, "😓此用户已存在,请直接登录")
	ErrMobileTaken    // old error (1416, "😓此手机号已存在")
	ErrBadVerifyCode  // old error (1409, "😓验证码不正确")
	ErrTokenExpired   // old error (1410, "😓登录身份已过期")
	ErrTokenInvalid   // old error (1411, "😓登录身份无效或已过期")
	ErrOldPassword    // old error (1412, "😓原密码不正确")
	ErrEmptyPassword  // old error (1413, "😓密码不能为空")
	ErrSimplePassword // old error (1415, "😓您的密码太简单了")
	ErrMultiOnline    // old error (1414, "🤔您似乎已经登录了")
	ErrEqualOldMobile // old error (1417, "😓新手机号和旧的一样唉")
	ErrAliasTooFew    // 有一些必需的别名不能解绑

	ErrEnableTwoFactor // old error (1420, "😓两步认证未开启,请先开启两步认证")
	ErrTwoFactorCode   // old error (1421, "😓两步认证验证码输入有误")

	ErrSNSInfoLost   // 第三方(绑定)信息因过期而丢失
	ErrSNSBindFailed // 绑定第三方信息失败

)

consts of error value

func (ErrorCode) Code

func (ec ErrorCode) Code() int

Code ...

func (ErrorCode) Error

func (ec ErrorCode) Error() string

Error as error

func (ErrorCode) ErrorP added in v0.12.4

func (ec ErrorCode) ErrorP(p *Printer) string

ErrorP return locale string with message printer

func (ErrorCode) ErrorReq added in v0.12.4

func (ec ErrorCode) ErrorReq(r *http.Request) string

ErrorReq return locale message with http request

func (ErrorCode) String

func (i ErrorCode) String() string

type Field added in v0.12.4

type Field string

Field ...

func (Field) ErrorReq added in v0.12.4

func (f Field) ErrorReq(r *http.Request) string

func (Field) Field added in v0.12.4

func (f Field) Field() string

type Printer

type Printer = message.Printer

Printer ...

type Scope added in v0.12.4

type Scope string

Scope ...

const (
	ScopeBasic   Scope = "basic"
	ScopeOpenID  Scope = "openid"
	ScopeProfile Scope = "profile"
	ScopeEmail   Scope = "email"
)

consts of scope

func (Scope) DescriptionP added in v0.12.4

func (s Scope) DescriptionP(p *Printer) string

func (Scope) LabelP added in v0.12.4

func (s Scope) LabelP(p *Printer) string

func (Scope) Valid added in v0.12.4

func (s Scope) Valid() bool

Valid ...

Jump to

Keyboard shortcuts

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