Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GoTextJSONLoader ¶
type GoTextJSONLoader struct {
// contains filtered or unexported fields
}
GoTextJSONLoader loads strings from files in the JSON format supported by gotext.
func NewGoTextJSONLoader ¶
func NewGoTextJSONLoader() *GoTextJSONLoader
NewGoTextJSONLoader factory method.
func (*GoTextJSONLoader) NeedsTag ¶
func (ldr *GoTextJSONLoader) NeedsTag() bool
NeedsTag implements the Loader interface.
func (*GoTextJSONLoader) ReadMessages ¶
func (ldr *GoTextJSONLoader) ReadMessages(reader io.Reader, tag *language.Tag, modTime time.Time) error
ReadMessages implements the Loader interface.
func (*GoTextJSONLoader) StringsByTag ¶
func (ldr *GoTextJSONLoader) StringsByTag(tag language.Tag) (*StringCatalog, error)
StringsByTag gets the string table for the given language tag.
type Loader ¶
type Loader interface { StringsByTag(tag language.Tag) (*StringCatalog, error) // NeedsTag indicates whether or not this loader requires that the language tag // be passed or if it can be inferred from the file format. NeedsTag() bool // ReadMessages loads messages from the given reader. // tag may be ignored by the implementation if NeedsTag is false. ReadMessages(reader io.Reader, tag *language.Tag, modTime time.Time) error }
Loader loads messages.
type POLoader ¶
type POLoader struct {
// contains filtered or unexported fields
}
POLoader loads strings from files in the gettext PO format.
func (*POLoader) ReadMessages ¶
ReadMessages implements the Loader interface.
func (*POLoader) StringsByTag ¶
func (ldr *POLoader) StringsByTag(tag language.Tag) (*StringCatalog, error)
StringsByTag gets the string table for the given language tag.
type StringCatalog ¶
StringCatalog lets us store an entire catalog by tag.
func NewStringCatalog ¶
func NewStringCatalog(modTime time.Time) *StringCatalog
NewStringCatalog factory method.
type StringTable ¶
type StringTable struct { LocalesDir string Matcher *language.Matcher Loader Loader // contains filtered or unexported fields }
StringTable loads all the languages from a base directory of locales.
func NewStringTable ¶
func NewStringTable(localesDir string, watch bool, ldr Loader) (*StringTable, error)
NewStringTable is a factory method for StringTable
func (*StringTable) Load ¶
func (st *StringTable) Load() error
Load loads the languages from the configured local directory.
type XLIFF2Loader ¶
type XLIFF2Loader struct {
// contains filtered or unexported fields
}
XLIFF2Loader loads strings from files in the XLIFF 2 format.
func (*XLIFF2Loader) NeedsTag ¶
func (ldr *XLIFF2Loader) NeedsTag() bool
NeedsTag implements the Loader interface.
func (*XLIFF2Loader) ReadMessages ¶
ReadMessages implements the Loader interface.
func (*XLIFF2Loader) StringsByTag ¶
func (ldr *XLIFF2Loader) StringsByTag(tag language.Tag) (*StringCatalog, error)
StringsByTag gets the string table for the given language tag.