i18n

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2022 License: BSD-2-Clause Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrLanguageDoesntExist = errors.New("language does not exist")
View Source
var ErrRessourceDoesNotExist = errors.New("ressource does not exist")

Functions

This section is empty.

Types

type LangKey

type LangKey string
var ContextLangKey LangKey = "lang"

type TranslationRegistry

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

func NewTranslationRegistry

func NewTranslationRegistry(dir fs.FS, log *zap.Logger) (*TranslationRegistry, error)

func (*TranslationRegistry) ContainsLanguage

func (t *TranslationRegistry) ContainsLanguage(language string) bool

func (*TranslationRegistry) CreateVoidTranslator

func (t *TranslationRegistry) CreateVoidTranslator(language string, ressource string) *Translator

func (*TranslationRegistry) Languages

func (t *TranslationRegistry) Languages() []string

func (*TranslationRegistry) Matcher

func (t *TranslationRegistry) Matcher() language.Matcher

func (*TranslationRegistry) TranslatorFor

func (t *TranslationRegistry) TranslatorFor(
	language string,
	ressource string,
) (*Translator, error)

type Translator

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

func (*Translator) Registry

func (t *Translator) Registry() *TranslationRegistry

Registry retruns the translation registry the Translator was created from

func (*Translator) T

func (t *Translator) T(key ...string) string

T retrives the translation for the supplied key

Jump to

Keyboard shortcuts

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