loader

package
v0.0.0-...-4f3e569 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bundle

type Bundle struct {
	Default *Language
	All     []*Language
}

func Load

func Load(dir string, glob string, defaultLang string) (*Bundle, error)

Load all files matched glob from dir

func (*Bundle) Get

func (bundle *Bundle) Get(lang string) *Language

func (*Bundle) Languages

func (bundle *Bundle) Languages() []string

type DefaultLanguageNotFoundError

type DefaultLanguageNotFoundError struct {
	Found   []string
	Default string
}

func (*DefaultLanguageNotFoundError) Error

func (err *DefaultLanguageNotFoundError) Error() string

type KeysNotFoundInDefaultError

type KeysNotFoundInDefaultError struct {
	Language        string
	DefaultLanguage string
	Keys            []string
}

func (*KeysNotFoundInDefaultError) Error

func (err *KeysNotFoundInDefaultError) Error() string

type Language

type Language struct {
	Name     string
	File     string
	Messages []*Message
}

func (*Language) Get

func (lang *Language) Get(key string) *Message

func (*Language) Has

func (lang *Language) Has(key string) bool

func (*Language) Keys

func (lang *Language) Keys() []string

type Message

type Message struct {
	Key   string
	Value string
	// contains filtered or unexported fields
}

func (*Message) IsTemplate

func (msg *Message) IsTemplate() bool

func (*Message) Vars

func (msg *Message) Vars() []string

Jump to

Keyboard shortcuts

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