i18n

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package i18n localizes the handful of user-facing strings the Go side produces (notification bodies, menu-bar style labels). The web UI carries its own dictionary (internal/webui/assets/i18n.js); this package only covers text that never passes through the webview.

The default locale is English and nothing is auto-detected at import time, so library consumers (and their tests) are deterministic. The GUI app calls SetLocale(Detect()) once at startup to follow the macOS system language.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Detect

func Detect() string

Detect returns the user's preferred language. On macOS it asks the global preferences (AppleLanguages) — the same source the system UI language uses — because a GUI app launched from Finder/launchd inherits no LANG. Elsewhere (and as a fallback) it reads the usual POSIX env vars. NETSCOPE_LANG overrides everything, which is also the escape hatch for testing a language.

func Locale

func Locale() string

Locale returns the active language code (e.g. "en", "ko").

func SetLocale

func SetLocale(lang string)

SetLocale switches the active message table. Unsupported languages fall back to English.

func T

func T(key string, args ...any) string

T returns the message for key in the active locale, formatted with args when given. Unknown keys fall back to English, then to the key itself.

Types

This section is empty.

Jump to

Keyboard shortcuts

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