Documentation
¶
Overview ¶
Package languages is the host of the languages icebath speaks to people in: the catalogs bundled with it, each profile's own and the language packs of its extensions, and which language a profile, a window, a request and a chat speak
Index ¶
- Constants
- func Carried(id string) *lang.Language
- func Carries(id string) bool
- func Computer() string
- func English(key string) (string, bool)
- func Replaces(id, key string) bool
- func Speaks(id string) bool
- func Unformed(id string, catalog lang.Catalog) map[string][]plural.Form
- type Languages
- func (l *Languages) Accepting(cfg *config.Config, accept string) *lang.Language
- func (l *Languages) Asked(profile, named string) *lang.Language
- func (l *Languages) Chosen(cfg *config.Config) string
- func (l *Languages) Entries(cfg *config.Config, id string) lang.Catalog
- func (l *Languages) Export(cfg *config.Config, id string) (string, int, error)
- func (l *Languages) Folders(cfg *config.Config) []string
- func (l *Languages) For(cfg *config.Config, told ...string) *lang.Language
- func (l *Languages) Has(cfg *config.Config, id string) bool
- func (l *Languages) Ids(cfg *config.Config) []string
- func (l *Languages) Kept(dir string, where lang.Text) Words
- func (l *Languages) Language(cfg *config.Config, id string) *lang.Language
- func (l *Languages) Problems(cfg *config.Config) []Problem
- func (l *Languages) Reference(cfg *config.Config) map[string]bool
- func (l *Languages) Register(registrant Registrant)
- func (l *Languages) Resolve(cfg *config.Config, value string) (string, bool)
- func (l *Languages) Said(cfg *config.Config, id string, reference map[string]bool) int
- func (l *Languages) Sources(cfg *config.Config, id string) []lang.Text
- type Pack
- type Packs
- type Problem
- type Registrant
- type Registry
- type Words
Constants ¶
const Domains = "domains.yaml"
File of the bundled catalogs that names the domain file of each folder of the tree, and the folders whose texts are all messages
const Folder = "locales"
Folder of a profile, and of a catalog folder, that holds a person's own catalogs: a folder of YAML files or one YAML file per language
Variables ¶
This section is empty.
Functions ¶
func Carried ¶
The language of the id as icebath carries it, from the bundled catalogs alone: what a window speaks before its server tells it more
func Computer ¶
func Computer() string
The language this computer is set to for its user, empty when nothing names one
func English ¶
The English format a key stands for, the other form of a plural, and whether it is a plural, as lang.Parts reads a key: its English, the one and the other form of a plural apart by lang.PluralMark, or the English and its context in the marks of a context. A structural name stands for no English
func Replaces ¶
Whether words a pack brings for the text of the key in the language would take the place of icebath's own: the language is one icebath speaks and the text one it carries words for. A pack leaves those out, so none changes what icebath itself says, its approval prompts among it, in a language icebath speaks, nor in one that falls back to such a language and that a computer could pick on its own
func Speaks ¶
Whether the language, or one it falls back to, is one icebath carries, English among them: one icebath speaks by its own words
Types ¶
type Languages ¶
type Languages struct {
Registry
// contains filtered or unexported fields
}
func (*Languages) Accepting ¶
The language a request of the HTTP API speaks, by the languages the program accepts in the order it prefers them, after the profile's own choice
func (*Languages) Asked ¶
The language a request of a window speaks: the one the window names, which it resolved itself, else what the profile the window works on speaks; the profile in use when the window names none
func (*Languages) Chosen ¶
The language the profile chose, empty for Automatic or a language it no longer has
func (*Languages) Entries ¶
Every entry of the language of the profile from all its layers, the first layer's words winning, which a window speaks it with
func (*Languages) Export ¶
Writes the texts the language of the profile lacks into the profile's own folder of catalogs, each with no words, for a translator to fill in; the file and how many texts it holds
func (*Languages) Folders ¶
Folders of the profile's catalogs a person writes: its own, and the catalog folder its settings name
func (*Languages) For ¶
The language the profile of the settings speaks to a person: the one it chose, else the first of those told of the person that it has (what a chat app says of them, what a program accepts), else this computer's, else English
func (*Languages) Ids ¶
Ids of the languages of the profile of the settings: English, the bundled ones, those its own catalogs and its packs bring, sorted with English first
func (*Languages) Kept ¶
Words of a folder of catalogs as the host keeps them, read again once its files changed and at most every few seconds; the catalogs are the host's, which a caller copies before it changes them
func (*Languages) Language ¶
The language of the id as the profile speaks it: the words of its packs, its own catalogs and the bundled ones, of the id and of each tag it falls back to, then the English of the sites
func (*Languages) Problems ¶
What is wrong in the catalogs of the profile: its own, those of the catalog folder, the packs, and the bundled ones: what does not read, words whose placeholders differ from their English, and texts that name nothing icebath says
func (*Languages) Reference ¶
Every text icebath says that the profile knows of: the keys of every bundled language, and the copy of the settings of the profile by its English
func (*Languages) Register ¶
func (l *Languages) Register(registrant Registrant)
Adds a registrant; a registry nested in the host reaches it through Host
func (*Languages) Resolve ¶
The language of the profile a value stands for: an id, a name, a tag or a locale, false for none it has
type Pack ¶
type Pack struct {
// Id of the language, one of the bundled ones or a new one
Language string
// What a new language calls itself and whether it is written right to left; the bundled ones keep their own
Endonym string
RTL bool
// What brought it, as a person reads it, such as the extension of its name
Source lang.Text
Catalog lang.Catalog
// Fingerprint of what its words were read from, which changes once they do, so a language made with it is made again
Version string
}
Words a language pack of an extension brings for a language. For a language Speaks, the pack holds words for texts icebath carries none for alone: a registrant leaves out what Replaces says, so no pack changes what icebath itself says in a language it speaks
type Problem ¶
type Problem struct {
// Where the catalog is, a file or a pack's source
Where lang.Text
// Language it is of
Language string
Text lang.Text
}
Something wrong in a catalog, which the Doctor says: where it is and what
type Registrant ¶
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
func (*Registry) Packs ¶
Every pack of the profile of the settings, in the order they were registered
func (*Registry) Register ¶
func (r *Registry) Register(registrant Registrant)