goi18nx

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2023 License: MIT Imports: 5 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 NewBundle

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

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 I18nMiddleware

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

func NewI18nMiddleware

func NewI18nMiddleware(fetchTag func(r *http.Request) language.Tag, configs ...string) *I18nMiddleware

func (*I18nMiddleware) Handle

Jump to

Keyboard shortcuts

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