Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Translator ¶
type Translator struct {
// contains filtered or unexported fields
}
Translator provides lightweight string translation. Keys are English text; missing keys fall back to the key itself.
func New ¶
func New(locale string) *Translator
New creates a Translator for the given locale (e.g. "en", "zh"). If the locale has no translation file, all lookups fall back to the key.
func (*Translator) Locale ¶
func (t *Translator) Locale() string
Locale returns the current locale code (e.g. "en", "zh").
func (*Translator) T ¶
func (t *Translator) T(key string) string
T returns the translated string for key, or key itself as fallback.
Click to show internal directories.
Click to hide internal directories.