langs

package
v0.42.1 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2018 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Language

type Language struct {
	Lang         string
	LanguageName string
	Title        string
	Weight       int

	Disabled bool

	// If set per language, this tells Hugo that all content files without any
	// language indicator (e.g. my-page.en.md) is in this language.
	// This is usually a path relative to the working dir, but it can be an
	// absolute directory referenece. It is what we get.
	ContentDir string

	Cfg config.Provider
	// contains filtered or unexported fields
}

Language manages specific-language configuration.

func NewDefaultLanguage

func NewDefaultLanguage(cfg config.Provider) *Language

NewDefaultLanguage creates the default language for a config.Provider. If not otherwise specified the default is "en".

func NewLanguage

func NewLanguage(lang string, cfg config.Provider) *Language

NewLanguage creates a new language.

func (*Language) Get

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

Get returns a value associated with the key relying on specified language. Get is case-insensitive for a key.

Get returns an interface. For a specific value use one of the Get____ methods.

func (*Language) GetBool

func (l *Language) GetBool(key string) bool

GetBool returns the value associated with the key as a boolean.

func (*Language) GetInt

func (l *Language) GetInt(key string) int

GetInt returns the value associated with the key as an int.

func (*Language) GetLocal

func (l *Language) GetLocal(key string) interface{}

GetLocal gets a configuration value set on language level. It will not fall back to any global value. It will return nil if a value with the given key cannot be found.

func (*Language) GetString

func (l *Language) GetString(key string) string

GetString returns the value associated with the key as a string.

func (*Language) GetStringMap

func (l *Language) GetStringMap(key string) map[string]interface{}

GetStringMap returns the value associated with the key as a map of interfaces.

func (*Language) GetStringMapString

func (l *Language) GetStringMapString(key string) map[string]string

GetStringMapString returns the value associated with the key as a map of strings.

func (*Language) GetStringSlice

func (l *Language) GetStringSlice(key string) []string

returns the value associated with the key as a slice of strings.

func (*Language) IsSet

func (l *Language) IsSet(key string) bool

IsSet checks whether the key is set in the language or the related config store.

func (*Language) Params

func (l *Language) Params() map[string]interface{}

Params retunrs language-specific params merged with the global params.

func (*Language) Set

func (l *Language) Set(key string, value interface{})

Set sets the value for the key in the language's params.

func (*Language) SetParam

func (l *Language) SetParam(k string, v interface{})

SetParam sets a param with the given key and value. SetParam is case-insensitive.

func (*Language) String

func (l *Language) String() string

type Languages

type Languages []*Language

Languages is a sortable list of languages.

func NewLanguages

func NewLanguages(l ...*Language) Languages

NewLanguages creates a sorted list of languages. NOTE: function is currently unused.

func (Languages) IsMultihost

func (l Languages) IsMultihost() bool

IsMultihost returns whether there are more than one language and at least one of the languages has baseURL specificed on the language level.

func (Languages) Len

func (l Languages) Len() int

func (Languages) Less

func (l Languages) Less(i, j int) bool

func (Languages) Swap

func (l Languages) Swap(i, j int)

Jump to

Keyboard shortcuts

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