MCPcopy
hub / github.com/gourouting/singo / LoadLocales

Function LoadLocales

conf/i18n.go:14–29  ·  view source on GitHub ↗

LoadLocales loads internationalization files.

(path string)

Source from the content-addressed store, hash-verified

12
13// LoadLocales loads internationalization files.
14func LoadLocales(path string) error {
15 data, err := os.ReadFile(path)
16 if err != nil {
17 return err
18 }
19
20 m := make(map[interface{}]interface{})
21 err = yaml.Unmarshal([]byte(data), &m)
22 if err != nil {
23 return err
24 }
25
26 Dictionary = &m
27
28 return nil
29}
30
31// T translates a key.
32func T(key string) string {

Callers 2

confInitFunction · 0.92
InitFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected