i18n: github.com/Unknwon/i18n Index | Files | Directories

package i18n

import "github.com/Unknwon/i18n"

Package i18n is for app Internationalization and Localization.

Index

Package Files

i18n.go

Variables

var (
    ErrLangAlreadyExist = errors.New("Lang already exists")
)

func Count Uses

func Count() int

Count returns number of languages that are registered.

func GetDescriptionByIndex Uses

func GetDescriptionByIndex(index int) string

func GetDescriptionByLang Uses

func GetDescriptionByLang(lang string) string

func GetLangByIndex Uses

func GetLangByIndex(index int) string

GetLangByIndex return language by given index.

func IndexLang Uses

func IndexLang(lang string) int

IndexLang returns index of language locale, it returns -1 if locale not exists.

func IsExist Uses

func IsExist(lang string) bool

IsExist returns true if given language locale exists.

func ListLangDescs Uses

func ListLangDescs() []string

func ListLangs Uses

func ListLangs() []string

ListLangs returns list of all locale languages.

func ReloadLangs Uses

func ReloadLangs(langs ...string) error

ReloadLangs reloads locale files.

func SetDefaultLang Uses

func SetDefaultLang(lang string)

SetDefaultLang sets default language which is a indicator that when target language is not found, try find in default language again.

func SetMessage Uses

func SetMessage(lang string, localeFile interface{}, otherLocaleFiles ...interface{}) error

SetMessage sets the message file for localization.

func SetMessageWithDesc Uses

func SetMessageWithDesc(lang, langDesc string, localeFile interface{}, otherLocaleFiles ...interface{}) error

func Tr Uses

func Tr(lang, format string, args ...interface{}) string

Tr translates content to target language.

type Locale Uses

type Locale struct {
    Lang string
}

Locale represents the information of localization.

func (Locale) Index Uses

func (l Locale) Index() int

Index returns lang index of LangStore.

func (Locale) Tr Uses

func (l Locale) Tr(format string, args ...interface{}) string

Tr translates content to target language.

Directories

PathSynopsis
ui18nui18n is a helper tool for Unknwon/i18n package.

Package i18n imports 5 packages (graph) and is imported by 116 packages. Updated 2017-11-25. Refresh now. Tools for package owners.