package langs
import "github.com/gohugoio/hugo/langs"
Index ¶
- func GetLocation(l *Language) *time.Location
- func GetTranslator(l *Language) locales.Translator
- type Language
- func NewDefaultLanguage(cfg config.Provider) *Language
- func NewLanguage(lang string, cfg config.Provider) *Language
- func (l *Language) GetLocal(key string) interface{}
- func (l *Language) IsSet(key string) bool
- func (l *Language) Merge(key string, value interface{})
- func (l *Language) Params() maps.Params
- func (l *Language) Set(k string, v interface{})
- func (l *Language) SetParam(k string, v interface{})
- func (l *Language) String() string
- type Languages
- func NewLanguages(l ...*Language) Languages
- func (l Languages) AsOrdinalSet() map[string]int
- func (l Languages) AsSet() map[string]bool
- func (l Languages) IsMultihost() bool
- func (l Languages) Len() int
- func (l Languages) Less(i, j int) bool
- func (l Languages) Swap(i, j int)
- type LanguagesConfig
Functions ¶
func GetLocation ¶
func GetTranslator ¶
func GetTranslator(l *Language) locales.Translator
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 // Global config. Cfg config.Provider // Language specific config. LocalCfg config.Provider // Composite config. 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) 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) IsSet ¶
IsSet checks whether the key is set in the language or the related config store.
func (*Language) Merge ¶
Merge is currently not supported for Language.
func (*Language) Params ¶
Params returns language-specific params merged with the global params.
func (*Language) Set ¶
func (*Language) SetParam ¶
SetParam sets a param with the given key and value. SetParam is case-insensitive.
func (*Language) String ¶
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 ¶
func (Languages) AsSet ¶
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.
func (Languages) Len ¶
func (Languages) Less ¶
func (Languages) Swap ¶
type LanguagesConfig ¶
type LanguagesConfig struct { Languages Languages Multihost bool DefaultContentLanguageInSubdir bool }
func LoadLanguageSettings ¶
func LoadLanguageSettings(cfg config.Provider, oldLangs Languages) (c LanguagesConfig, err error)
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
langs/i18n |
- Version
- v0.92.1
- Published
- Jan 27, 2022
- Platform
- js/wasm
- Imports
- 12 packages
- Last checked
- 1 minute ago –
Tools for package owners.