locale

package
v0.0.0-...-5365f31 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2018 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package locale handles the internationalization of the application.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AvailableLanguages

func AvailableLanguages() map[string]string

AvailableLanguages returns the list of available languages.

Types

type Language

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

Language represents a language in the system.

func (*Language) Get

func (l *Language) Get(key string, args ...interface{}) string

Get fetch the translation for the given key.

func (*Language) Plural

func (l *Language) Plural(key string, n int, args ...interface{}) string

Plural returns the translation of the given key by using the language plural form.

type Locales

type Locales map[string]Translation

Locales represents locales supported by the system.

type Translation

type Translation map[string]interface{}

Translation is the translation mapping table.

type Translator

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

Translator manage supported locales.

func Load

func Load() *Translator

Load prepare the locale system by loading all translations.

func NewTranslator

func NewTranslator() *Translator

NewTranslator creates a new Translator.

func (*Translator) AddLanguage

func (t *Translator) AddLanguage(language, translations string) error

AddLanguage loads a new language into the system.

func (*Translator) GetLanguage

func (t *Translator) GetLanguage(language string) *Language

GetLanguage returns the given language handler.

Jump to

Keyboard shortcuts

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