Files
golifehk/i18n/types.go
2026-03-10 15:18:34 +08:00

27 lines
362 B
Go

package i18n
import (
"fmt"
query "github.com/tgckpg/golifehk/query"
)
type Generics struct {
Name *map[string]string
query.Words
}
type Key string
func (k Key) Text(langPack map[string]string, args ...any) string {
txt, ok := langPack[string(k)]
if !ok {
return string(k)
}
if len(args) > 0 {
return fmt.Sprintf(txt, args...)
}
return txt
}