27 lines
362 B
Go
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
|
|
}
|