structs

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2023 License: LGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultTemplatePlaceholder = "<NotFound>"

Variables

This section is empty.

Functions

This section is empty.

Types

type I18nFS

type I18nFS struct {
	LangFSEmbed *embed.FS
	FSPrefix    string
	FsMode      i18nfs.FSMode
	// contains filtered or unexported fields
}

func NewI18nFS

func NewI18nFS(fsMode i18nfs.FSMode, prefix string, embedFS *embed.FS) (*I18nFS, error)

func (*I18nFS) GetLanguages

func (i *I18nFS) GetLanguages() []string

GetLanguages get list of languages

func (*I18nFS) GetValByPath

func (i *I18nFS) GetValByPath(lang string, path string) (any, error)

GetValByPath get value by paths which are split by dot

func (*I18nFS) HasLang

func (i *I18nFS) HasLang(lang string) bool

HasLang check language in langStringMaps

func (*I18nFS) IsLangExists

func (i *I18nFS) IsLangExists(lang string) bool

IsLangExists check language exists or not on filesystem

func (*I18nFS) ParseTemplateString

func (i *I18nFS) ParseTemplateString(stringVal string, lang string) any

ParseTemplateString parse path in template to refer others string format of template like "${path}"

func (*I18nFS) Read

func (i *I18nFS) Read(lang string) error

Read all yaml of language on filesystem into langStringMaps

func (*I18nFS) WalkLangYAML

func (i *I18nFS) WalkLangYAML(lang string, walkFunc func(content string)) error

WalkLangYAML walk all yaml file of language, and process content of them with walkFunc

Jump to

Keyboard shortcuts

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