Documentation
¶
Index ¶
- Constants
- func LanguageFrom(ctx context.Context) string
- func Normalize(lang string) string
- func WithLanguage(ctx context.Context, lang string) context.Context
- type Bundle
- func (b *Bundle) Choices() []Choice
- func (b *Bundle) For(ctx context.Context) *Localizer
- func (b *Bundle) Has(lang string) bool
- func (b *Bundle) Instance() string
- func (b *Bundle) Languages() []string
- func (b *Bundle) Localizer(lang string) *Localizer
- func (b *Bundle) Match(accept string) string
- func (b *Bundle) Name(lang string) string
- func (b *Bundle) Negotiate(chosen, accept, siteDefault string) string
- type Choice
- type Localizer
Constants ¶
const ( DefaultLanguage = "zh-hans" InstanceLanguage = "en" )
const AcceptHeader = "Accept-Language"
Variables ¶
This section is empty.
Functions ¶
func LanguageFrom ¶
LanguageFrom is empty for a request that never met the negotiator, which Localizer already reads as the default language.
Types ¶
type Bundle ¶
type Bundle struct {
// contains filtered or unexported fields
}
func LoadKeys ¶
Goldens rendered with this bundle pin which message lands where without pinning its wording, so a rewording does not force every golden to be redone.
func (*Bundle) Match ¶
Match is empty when the header names nothing the bundle carries, so the caller can tell "no opinion" apart from "asked for the default".