goi18nx

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2023 License: MIT Imports: 9 Imported by: 4

Documentation

Index

Constants

View Source
const I18nKey = "SpectatorNan/goi18nx"

Variables

This section is empty.

Functions

func FetchCurrentLanguageTag added in v0.1.2

func FetchCurrentLanguageTag(accept string, supportTags []language.Tag) language.Tag

func FormatMessage

func FormatMessage(ctx context.Context, message *i18n2.Message, args map[string]interface{}) string

func FormatText

func FormatText(ctx context.Context, msgId string, defaultText string) string

func FormatTextWithData

func FormatTextWithData(ctx context.Context, msgId string, defaultText string, args map[string]interface{}) string

func IsHasI18n added in v0.1.3

func IsHasI18n(ctx context.Context) bool

func NewBundle

func NewBundle(tag language.Tag, configs ...string) *i18n2.Bundle

func SetDefaultErrCode added in v0.1.3

func SetDefaultErrCode(code uint32)

SetDefaultErrCode sets the default value of the err code. need to be set before use

func SetDefaultLangHeaderKey added in v0.1.1

func SetDefaultLangHeaderKey(key string)

SetDefaultLangHeaderKey sets the default value of the lang header key. need to be set before use

Types

type I18nGrpcInterceptor added in v0.1.3

type I18nGrpcInterceptor struct {
	// contains filtered or unexported fields
}

func NewI18nGrpcInterceptor added in v0.1.3

func NewI18nGrpcInterceptor(supportTags []language.Tag, localizationFiles []string) *I18nGrpcInterceptor

func (*I18nGrpcInterceptor) Interceptor added in v0.1.3

func (i *I18nGrpcInterceptor) Interceptor(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (resp interface{}, err error)

type I18nMiddleware

type I18nMiddleware struct {
	// contains filtered or unexported fields
}

func NewI18nMiddleware

func NewI18nMiddleware(supportTags []language.Tag, localizationFiles []string) *I18nMiddleware

func (*I18nMiddleware) Handle

Jump to

Keyboard shortcuts

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