Documentation ¶
Overview ¶
Package message implements formatted I/O for localized strings with functions analogous to the fmt's print functions.
NOTE: Under construction. See https://yougam/libraries/design/text/12750-localization and its corresponding proposal issue https://yougam/libraries/issues/12750.
Index ¶
- func SetString(tag language.Tag, key string, msg string) error
- type Catalog
- type Printer
- func (p *Printer) Fprint(w io.Writer, a ...interface{}) (n int, err error)
- func (p *Printer) Fprintf(w io.Writer, key Reference, a ...interface{}) (n int, err error)
- func (p *Printer) Fprintln(w io.Writer, a ...interface{}) (n int, err error)
- func (p *Printer) Print(a ...interface{}) (n int, err error)
- func (p *Printer) Printf(key Reference, a ...interface{}) (n int, err error)
- func (p *Printer) Println(a ...interface{}) (n int, err error)
- func (p *Printer) Sprint(a ...interface{}) string
- func (p *Printer) Sprintf(key Reference, a ...interface{}) string
- func (p *Printer) Sprintln(a ...interface{}) string
- type Reference
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Catalog ¶
type Catalog struct {
// contains filtered or unexported fields
}
A Catalog holds translations for messages for supported languages.
var DefaultCatalog *Catalog = newCatalog()
DefaultCatalog is used by SetString.
func (*Catalog) Languages ¶
Languages returns a slice of all languages for which the Catalog contains variants.
type Printer ¶
type Printer struct {
// contains filtered or unexported fields
}
A Printer implements language-specific formatted I/O analogous to the fmt package. Only one goroutine may use a Printer at the same time.
func NewPrinter ¶
NewPrinter returns a Printer that formats messages tailored to language t.