texts

package
v0.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 15, 2026 License: Apache-2.0 Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package texts is the Go clients' catalog of the client strings the daemon serves.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Catalog

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

Catalog reads client strings by key, in the locale the daemon served them in.

func English

func English() *Catalog

English is the empty catalog: every key reads as itself.

func New

func New(s api.Strings) *Catalog

New is the catalog of s.

func (*Catalog) Fill

func (c *Catalog) Fill(word string, vars map[string]string) string

Fill is a plugin's word with each {{.name}} replaced by vars[name], and each {{plural .name "one" "…" "other" "…"}} by the form of vars[name] in the catalog's locale, as the cockpit fills a word.

func (*Catalog) Locale

func (c *Catalog) Locale() string

Locale is the locale the strings were served in.

func (*Catalog) Number

func (c *Catalog) Number(n int) string

Number is n with the served group separator.

func (*Catalog) T

func (c *Catalog) T(key string, params map[string]any) string

T is key's text with params interpolated; key itself when the catalog lacks it.

func (*Catalog) TN

func (c *Catalog) TN(key string, n int, params map[string]any) string

TN is key's text in n's plural form, with n and params interpolated; a key the catalog lacks reads as its other form, the key itself.

func (*Catalog) Time

func (c *Catalog) Time(t time.Time, style string) string

Time is t formatted by the served format style (time, date, datetime).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL