Documentation
¶
Overview ¶
Package msgfile manages message files.
Index ¶
Constants ¶
View Source
const ( UpdatedRemoved = "removed" UpdatedChanged = "changed" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Entries ¶
Entries are a list of translatable entries.
func FindTemplate ¶
FindTemplate finds all strings in Go templates.
func (Entries) Untranslated ¶
Untranslated reports the number of untranslated messages.
type Entry ¶
type Entry struct {
ID string `toml:"id" json:"id"` // Translation ID.
Loc []string `toml:"loc" json:"loc"` // Locations in code.
Context string `toml:"context,omitempty" json:"context,omitempty"` // Translation context.
Updated string `toml:"updated,omitempty" json:"updated,omitempty"` // Updated?
// Messages.
Default string `toml:"default,omitempty" json:"default,omitempty"`
Zero string `toml:"zero,omitempty" json:"zero,omitempty"`
One string `toml:"one,omitempty" json:"one,omitempty"`
Two string `toml:"two,omitempty" json:"two,omitempty"`
Few string `toml:"few,omitempty" json:"few,omitempty"`
Many string `toml:"many,omitempty" json:"many,omitempty"`
}
Entry is a single translatable entry.
type File ¶
type File struct {
// Is this a template file?
Template bool `toml:"template,omitempty" json:"template,omitempty"`
// Don't update with "z18n update"
NoUpdate bool `toml:"no-update,omitempty" json:"no_update,omitempty"`
// Updated date.
Modified time.Time `toml:"generated,omitempty" json:"generated,omitempty"`
// Language this is for.
Language string `toml:"language" json:"language"`
// Maintainer(s) of this file.
Maintainers []string `toml:"maintainers" json:"maintainers"`
// Comments for translators.
Comments string `toml:"comments" json:"comments"`
// CLI options; only if template=true.
Options map[string]any `toml:"options,omitempty" json:"options,omitempty"`
// Translate strings.
Strings Entries `toml:"strings" json:"strings"`
// File path; used internally.
Path string `toml:"-" json:"-"`
}
File is a translation file.
func New ¶
TODO: what we really want is a new "Dir" type; would come in handy in a few other places too.
func (*File) UnmarshalTOML ¶
Custom unmarshal to treat __meta__ as special.
Click to show internal directories.
Click to hide internal directories.