go-admin: github.com/GoAdminGroup/go-admin/modules/language Index | Files

package language

import "github.com/GoAdminGroup/go-admin/modules/language"

Index

Package Files

cn.go en.go jp.go language.go tc.go

Variables

var (
    EN  = language.English.String()
    CN  = language.Chinese.String()
    JP  = language.Japanese.String()
    TC  = language.TraditionalChinese.String()
)
var Lang = LangMap{
    language.Chinese.String():            cn,
    language.English.String():            en,
    language.Japanese.String():           jp,
    language.TraditionalChinese.String(): tc,

    "cn": cn,
    "en": en,
    "jp": jp,
    "tc": tc,
}

Lang is the global LangMap.

func Add Uses

func Add(key string, lang map[string]string)

Add add a language package to the Lang.

func Get Uses

func Get(value string) string

Get return the value of default scope.

func GetFromHtml Uses

func GetFromHtml(value template.HTML, scopes ...string) template.HTML

GetFromHtml return the value of given scopes and template.HTML value.

func GetWithScope Uses

func GetWithScope(value string, scopes ...string) string

GetWithScope return the value of given scopes.

func JoinScopes Uses

func JoinScopes(scopes []string) string

func WithScopes Uses

func WithScopes(value string, scopes ...string) string

WithScopes join scopes prefix and the value.

type LangMap Uses

type LangMap map[string]map[string]string

LangMap is the map of language packages.

func (LangMap) Get Uses

func (lang LangMap) Get(value string) string

Get get the value from LangMap.

func (LangMap) GetWithScope Uses

func (lang LangMap) GetWithScope(value string, scopes ...string) string

GetWithScope get the value from LangMap with given scopes.

Package language imports 4 packages (graph) and is imported by 61 packages. Updated 2020-01-22. Refresh now. Tools for package owners.