i18n

package module
v0.0.0-...-8f8dc1a Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2018 License: BSD-2-Clause Imports: 3 Imported by: 1

README

i18n

i18n

Documentation

Overview

Package i18n is for app Internationalization and Localization.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetLangByIndex

func GetLangByIndex(index int) string

Get language by index id

func IndexLang

func IndexLang(lang string) int

Check language name if exist

func IsExist

func IsExist(lang string) bool

Check language name if exist

func ListLangs

func ListLangs() []string

List all locale languages

func ReloadLangs

func ReloadLangs(langs ...string) error

Reload locales

func SetMessage

func SetMessage(lang, filePath string) error

SetMessage sets the message file for localization.

func Tr

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

Tr translate content to target language.

Types

type Locale

type Locale struct {
	Lang string
}

A Locale describles the information of localization.

func (Locale) Index

func (l Locale) Index() int

Index get lang index of LangStore

func (Locale) Tr

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

Tr translate content to target language.

Directories

Path Synopsis
v2

Jump to

Keyboard shortcuts

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