locale

package
v0.94.1 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package locale 用于处理本地化文件的加载

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Load added in v0.75.0

func Load(s config.Serializer, b *catalog.Builder, glob string, fsys ...fs.FS) error

func NewPrinter added in v0.86.0

func NewPrinter(tag language.Tag, cat catalog.Catalog) (*message.Printer, bool)

NewPrinter 从 cat 是查找最符合 tag 的语言 ID 并返回对应的 message.Printer 对象

Types

type Locale

type Locale struct {
	*catalog.Builder
	// contains filtered or unexported fields
}

Locale 实现了 web.Locale 接口

func New

func New(id language.Tag, conf *config.Config) *Locale

func (*Locale) Config added in v0.87.0

func (l *Locale) Config() *config.Config

func (*Locale) ID added in v0.86.0

func (l *Locale) ID() language.Tag

func (*Locale) LoadMessages added in v0.86.0

func (l *Locale) LoadMessages(glob string, fsys ...fs.FS) error

func (*Locale) NewPrinter

func (l *Locale) NewPrinter(id language.Tag) *message.Printer

func (*Locale) Printer

func (l *Locale) Printer() *message.Printer

func (*Locale) Sprintf added in v0.86.0

func (l *Locale) Sprintf(key string, v ...any) string

Jump to

Keyboard shortcuts

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