Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddParser

func AddParser(parser ParseDirFunc)

AddParser to the known parser list

func ParseDir

func ParseDir(dirPath, basePath string, data *DomainMap) error

ParseDir calls all known parser for each directory

func ParseDirRec

func ParseDirRec(dirPath string, exclude []string, data *DomainMap, verbose bool) error

ParseDirRec calls all known parser for each directory

Types

type Domain

type Domain struct {
	Translations        TranslationMap
	ContextTranslations map[string]TranslationMap
}

Domain holds all translations of one domain

func (*Domain) AddTranslation

func (d *Domain) AddTranslation(translation *Translation)

AddTranslation to the domain

func (*Domain) Dump

func (d *Domain) Dump() string

Dump the domain as string

func (*Domain) Save

func (d *Domain) Save(path string) error

Save domain to file

type DomainMap

type DomainMap struct {
	Domains map[string]*Domain
	Default string
}

DomainMap contains multiple domains as map with name as key

func (*DomainMap) AddTranslation

func (m *DomainMap) AddTranslation(domain string, translation *Translation)

AddTranslation to domain map

func (*DomainMap) Save

func (m *DomainMap) Save(directory string) error

Save domains to directory

type GetterDef

type GetterDef struct {
	Id      int
	Plural  int
	Context int
	Domain  int
}

GetterDef describes a getter

type GoFile

type GoFile struct {
	// contains filtered or unexported fields
}

GoFile handles the parsing of one go file

type ParseDirFunc

type ParseDirFunc func(filePath, basePath string, data *DomainMap) error

ParseDirFunc parses one directory

type Translation

type Translation struct {
	MsgId           string
	MsgIdPlural     string
	Context         string
	SourceLocations []string
}

Translation for a text to translate

func (*Translation) AddLocations

func (t *Translation) AddLocations(locations []string)

AddLocations to translation

func (*Translation) Dump

func (t *Translation) Dump() string

Dump translation as string

type TranslationMap

type TranslationMap map[string]*Translation

TranslationMap contains a map of translations with the ID as key

func (TranslationMap) Dump

func (m TranslationMap) Dump() string

Dump the translation map as string