i18n

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultLanguage = English

DefaultLanguage is the fallback language

View Source
const DefaultTheme = ThemeAuto

DefaultTheme is the fallback theme

Variables

This section is empty.

Functions

This section is empty.

Types

type Language

type Language string

Language represents a supported language

const (
	// English is the English language
	English Language = "en"
	// Japanese is the Japanese language
	Japanese Language = "ja"
)

func DetectLanguage

func DetectLanguage(r *http.Request) Language

DetectLanguage detects the preferred language from HTTP request

type Theme

type Theme string

Theme represents a UI theme

const (
	// ThemeAuto uses system preference
	ThemeAuto Theme = "auto"
	// ThemeLight uses light theme
	ThemeLight Theme = "light"
	// ThemeDark uses dark theme
	ThemeDark Theme = "dark"
)

func DetectTheme

func DetectTheme(r *http.Request) Theme

DetectTheme detects the preferred theme from HTTP request

type Translation

type Translation map[string]string

Translation represents a translation map

type Translations

type Translations map[Language]Translation

Translations holds all language translations

type Translator

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

Translator provides translation functionality

func NewTranslator

func NewTranslator() *Translator

NewTranslator creates a new translator

func (*Translator) T

func (t *Translator) T(lang Language, key string) string

T translates a key for the given language

Jump to

Keyboard shortcuts

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