i18n

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Errorf

func Errorf(key string, args ...any) error

func Locale

func Locale(ctx context.Context) string

func Localize

func Localize(err error, locale string) error

func Match

func Match(header string) string

func Message

func Message(err error, locale string) string

func Register

func Register() error

func Text

func Text(locale, key string, args ...any) string

func WithLocale

func WithLocale(ctx context.Context, locale string) context.Context

Types

type Error

type Error struct {
	Key  string
	Args []any
}

Error保留原始key和参数,直到HTTP、CLI或WS出口才决定语言。

func (Error) Error

func (e Error) Error() string

func (Error) Unwrap

func (e Error) Unwrap() error

Jump to

Keyboard shortcuts

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