localize

package
v0.52.2-alpha1 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDefaultLanguage

func GetDefaultLanguage() *language.Tag

GetDefaultLanguage returns the default i18n language used

func GetDefaultLocales

func GetDefaultLocales() fs.FS

GetDefaultLocales returns the default locale files

Types

type Localizer

type Localizer interface {
	MustLocalize(id string, templateEntries ...*TemplateEntry) string
	MustLocalizePlural(id string, pluralCount int, templateEntries ...*TemplateEntry) string
	MustLocalizeError(id string, templateEntries ...*TemplateEntry) error
}

Localizer is an abstract interface which defines methods to load i18n messages

type TemplateEntry

type TemplateEntry struct {
	Key   string
	Value interface{}
}

TemplateEntry is a type which defines variable interpolation key:value pairs which are used to pass dynamic values to the template

func NewEntry

func NewEntry(key string, val interface{}) *TemplateEntry

NewEntry returns a new template entry which is a type for interpolating a string

Directories

Path Synopsis
Internationalization implementation using nicksnyder/go-i18n
Internationalization implementation using nicksnyder/go-i18n

Jump to

Keyboard shortcuts

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