i18n

package
v0.4.21 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Locale

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

Locale 区域设置

type LocaleInfo

type LocaleInfo struct {
	Code    string `json:"code"`
	Name    string `json:"name"`
	Native  string `json:"native"`
	Current bool   `json:"current"`
}

LocaleInfo 语言信息

type Manager

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

Manager 国际化管理器

func NewManager

func NewManager(dataDir, defaultLocale string) (*Manager, error)

NewManager creates internationalization manager

func (*Manager) AddTranslation

func (m *Manager) AddTranslation(locale, key, value string) error

AddTranslation 添加翻译

func (*Manager) GetLocale

func (m *Manager) GetLocale() string

GetLocale 获取当前语言

func (*Manager) ListLocales

func (m *Manager) ListLocales() []LocaleInfo

ListLocales 列出可用语言

func (*Manager) SetLocale

func (m *Manager) SetLocale(code string) error

SetLocale 设置当前语言

func (*Manager) T

func (m *Manager) T(key string, args ...interface{}) string

T 翻译文本

Jump to

Keyboard shortcuts

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