Documentation
¶
Overview ¶
Package i18n provides internationalization support for lokit itself.
It wraps the gotext library to provide simple T() and N() functions for translating lokit's user-facing strings. Translations are embedded in the binary via //go:embed and loaded at startup via Init().
Usage:
import "github.com/minios-linux/lokit/i18n"
func main() {
i18n.Init("") // auto-detect from LANGUAGE/LC_ALL/LC_MESSAGES/LANG
fmt.Println(i18n.T("Hello, world!"))
fmt.Println(i18n.N("Found %d file", "Found %d files", count))
}
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Init ¶
func Init(lang string)
Init initializes the i18n system. If lang is empty, it auto-detects from the environment variables LANGUAGE, LC_ALL, LC_MESSAGES, LANG (in that order, matching GNU gettext behavior).
Init should be called once at program startup, before any T() or N() calls.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.