i18n

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultLang = "en"

Variables

This section is empty.

Functions

func Active

func Active() string

Active returns the current language code.

func Available

func Available() []string

Available returns the list of supported language codes.

func DetectLang

func DetectLang(lang string) string

DetectLang returns lang if supported, otherwise tries $LANG, falls back to DefaultLang.

func Init

func Init(lang string) error

Init (re-)initialises the localizer for the given language code.

func T

func T(key string) string

T returns the translation for key; falls back to key if not found.

func Tf

func Tf(key string, data map[string]any) string

Tf returns the translation for key with template data.

Types

This section is empty.

Jump to

Keyboard shortcuts

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