Documentation
¶
Overview ¶
Package locale 用于处理本地化文件的加载
Index ¶
- func Load(s config.Serializer, b *catalog.Builder, glob string, fsys ...fs.FS) error
- func NewPrinter(tag language.Tag, cat catalog.Catalog) (*message.Printer, bool)
- type Locale
- func (l *Locale) AcceptLanguage() string
- func (l *Locale) Config() *config.Config
- func (l *Locale) ID() language.Tag
- func (l *Locale) LoadMessages(glob string, fsys ...fs.FS) error
- func (l *Locale) NewPrinter(id language.Tag) *message.Printer
- func (l *Locale) Printer() *message.Printer
- func (l *Locale) Sprintf(key string, v ...any) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewPrinter ¶ added in v0.86.0
NewPrinter 从 cat 是查找最符合 tag 的语言 ID 并返回对应的 message.Printer 对象
Types ¶
type Locale ¶
Locale 实现了 web.Locale 接口
func (*Locale) AcceptLanguage ¶ added in v0.104.0
AcceptLanguage 返回当前 Locale 形成的 Accept-Language 报头
func (*Locale) LoadMessages ¶ added in v0.86.0
Click to show internal directories.
Click to hide internal directories.