models

package
v0.0.0-...-3ff8be4 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Langs map[string]string
	I18ns = make(map[string]*I18n)
)
View Source
var (
	Videos = make(map[string]*Video)
)

Functions

func Init

func Init()

Init init models

func ReadI18n

func ReadI18n(langMap map[string]string)

ReadI18n read i18n data

func ReadNav

func ReadNav(iniFile config.Configer)

ReadNav read navigation data

func ReadVideo

func ReadVideo(langMap map[string]string)

Types

type I18n

type I18n struct {
	Lang string // language string
	// contains filtered or unexported fields
}

I18n object

func NewI18n

func NewI18n(lang string, file string) (*I18n, error)

NewI18n reads ini file

func (*I18n) Tr

func (i *I18n) Tr(str string) string

Tr converts string

func (*I18n) Trf

func (i *I18n) Trf(str string, values ...interface{}) string

Trf converts string with arguments

type Nav struct {
	Order    int
	Key      string
	URL      string
	Children []*Nav
	// contains filtered or unexported fields
}

Nav is item of navigation

func (n *Nav) I18n() string

I18n return the i18n key of this navigation item

func (n *Nav) IsURL() bool

IsURL return whether the link is in url, or just separator

type NavGroup []*Nav

NavGroup is group as navigation

var (
	// HomeNav is navigation for all pages
	HomeNav NavGroup
	// DocNav is navigation for documentation pages
	DocNav NavGroup
)
func (ng NavGroup) Find(key string) *Nav

Find find navigation in group by key string

type Video

type Video struct {
	Desc string
	List []map[string]string
}

func NewVideo

func NewVideo(file string) (*Video, error)

Jump to

Keyboard shortcuts

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