i18n

package
v0.0.0-...-75c4490 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ContextKey          = "i18nLocalizer"
	ValidatorContextKey = "validatorTranslator"
	LocaleHeader        = "Accept-Language"
	DefaultLanguage     = "en"
)

Variables

This section is empty.

Functions

func FormatValidationError

func FormatValidationError(c *gin.Context, err error) string

func FromContext

func FromContext(c *gin.Context) *i18n_lib.Localizer

func GetLocalizer

func GetLocalizer(langs ...string) *i18n_lib.Localizer

func GetTranslatorFromContext

func GetTranslatorFromContext(c *gin.Context) interface{}

func GetValidatorTranslator

func GetValidatorTranslator(locale string) (ut.Translator, bool)

func InitValidator

func InitValidator() error

func Initialize

func Initialize(localesPath string, defaultLang language.Tag) error

func Middleware

func Middleware() gin.HandlerFunc

func T

func T(localizer *i18n_lib.Localizer, messageID string, templateData interface{}) string

func Translate

func Translate(c *gin.Context, messageID string, templateData ...interface{}) string

Types

This section is empty.

Jump to

Keyboard shortcuts

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