Documentation ¶
Index ¶
- type Language
- func (l *Language) Get(key string) interface{}
- func (l *Language) GetBool(key string) bool
- func (l *Language) GetInt(key string) int
- func (l *Language) GetLocal(key string) interface{}
- func (l *Language) GetString(key string) string
- func (l *Language) GetStringMap(key string) map[string]interface{}
- func (l *Language) GetStringMapString(key string) map[string]string
- func (l *Language) GetStringSlice(key string) []string
- func (l *Language) IsSet(key string) bool
- func (l *Language) Params() maps.Params
- func (l *Language) Set(key string, value interface{})
- func (l *Language) SetParam(k string, v interface{})
- func (l *Language) String() string
- type Languages
- type LanguagesConfig
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 LanguageDirection 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 reference. It is what we get. ContentDir string Cfg config.Provider // contains filtered or unexported fields }
Language manages specific-language configuration.
func NewDefaultLanguage ¶
NewDefaultLanguage creates the default language for a config.Provider. If not otherwise specified the default is "en".
func NewLanguage ¶
NewLanguage creates a new language.
func (*Language) Get ¶
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) GetLocal ¶
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) GetStringMap ¶
GetStringMap returns the value associated with the key as a map of interfaces.
func (*Language) GetStringMapString ¶
GetStringMapString returns the value associated with the key as a map of strings.
func (*Language) GetStringSlice ¶
GetStringSlice returns the value associated with the key as a slice of strings.
func (*Language) IsSet ¶
IsSet checks whether the key is set in the language or the related config store.
type Languages ¶
type Languages []*Language
Languages is a sortable list of languages.
func NewLanguages ¶
NewLanguages creates a sorted list of languages. NOTE: function is currently unused.
func (Languages) AsOrdinalSet ¶ added in v0.56.0
func (Languages) IsMultihost ¶
IsMultihost returns whether there are more than one language and at least one of the languages has baseURL specificed on the language level.
type LanguagesConfig ¶ added in v0.56.0
type LanguagesConfig struct { Languages Languages Multihost bool DefaultContentLanguageInSubdir bool }
func LoadLanguageSettings ¶ added in v0.56.0
func LoadLanguageSettings(cfg config.Provider, oldLangs Languages) (c LanguagesConfig, err error)