translation

package
v0.0.0-...-fd201ba Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	AcceptLanguage *i18n.Localizer
	Bundle         *i18n.Bundle
)

Functions

func Initialize

func Initialize(conf config.App)

Types

type MockTranslator

type MockTranslator struct {
	mock.Mock
}

func (*MockTranslator) GetLocalizer

func (r *MockTranslator) GetLocalizer(lang string) *i18n.Localizer

func (*MockTranslator) Lang

func (r *MockTranslator) Lang(key string, args map[string]interface{}, lang *string) string

type Translation

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

func NewTranslation

func NewTranslation(conf config.App) *Translation

func (*Translation) GetLocalizer

func (r *Translation) GetLocalizer(lang string) *i18n.Localizer

GetLocalizer initializes the localizer with the desired language.

func (*Translation) Lang

func (r *Translation) Lang(key string, args map[string]interface{}, lang *string) string

Lang is a helper function that translates a message.

type Translator

type Translator interface {
	GetLocalizer(lang string) *i18n.Localizer
	Lang(key string, args map[string]interface{}, lang *string) string
}

Translator is an interface that defines the methods needed to translate messages.

Jump to

Keyboard shortcuts

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