i18n

package
v0.1.65 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2018 License: MIT Imports: 4 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Localizer

type Localizer struct {
	Log *logrus.Logger
	// contains filtered or unexported fields
}

Localizer will translate a message into the user's language

func NewLocalizer

func NewLocalizer(log *logrus.Logger) (*Localizer, error)

NewLocalizer creates a new Localizer

func (*Localizer) GetLanguage

func (l *Localizer) GetLanguage() string

GetLanguage returns the currently selected language, e.g 'en'

func (*Localizer) Localize

func (l *Localizer) Localize(config *i18n.LocalizeConfig) string

Localize handels the translations expects i18n.LocalizeConfig as input: https://godoc.org/github.com/nicksnyder/go-i18n/v2/i18n#Localizer.MustLocalize output: translated string

func (*Localizer) SLocalize

func (l *Localizer) SLocalize(ID string) string

SLocalize (short localize) is for 1 line localizations ID: The id that is used in the .toml translation files Other: the default message it needs to return if there is no translation found or the system is english

func (*Localizer) TemplateLocalize

func (l *Localizer) TemplateLocalize(ID string, TemplateData map[string]interface{}) string

TemplateLocalize allows the Other input to be dynamic

type Teml

type Teml map[string]interface{}

Teml is short for template used to make the required map[string]interface{} shorter when using gui.Tr.SLocalize and gui.Tr.TemplateLocalize

Jump to

Keyboard shortcuts

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