i18n

package
v0.15.2 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2020 License: MIT Imports: 4 Imported by: 2 modules, 4 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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.Entry
	// contains filtered or unexported fields
}

Localizer will translate a message into the user's language

func NewLocalizer

func NewLocalizer(log *logrus.Entry) *Localizer

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