translator

package
v0.0.0-...-2e9bc18 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2025 License: LGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultLanguage = "en"
View Source
const LocalePath = "locales"

Variables

View Source
var RegexPlaceholder = regexp.MustCompile(`\{\{\.(\w+)}}`)

Functions

func Edit

func Edit(key, value string, action Action) (bool, error)

func IsSupported

func IsSupported(lang string) bool

func LangPack

func LangPack(lang string) map[Key]string

func SearchVar

func SearchVar(content string) (map[string]string, error)

func SupportedLanguages

func SupportedLanguages() []string

func TAll

func TAll(key Key) []string

Types

type Action

type Action int
const (
	Add Action = iota
	Remove
	Update
)

type Translator

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

func New

func New(language string) *Translator

func (*Translator) T

func (t *Translator) T(key Key) string

func (*Translator) TWithData

func (t *Translator) TWithData(key Key, values map[string]string) string

Jump to

Keyboard shortcuts

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