lang.go raw
1 package lang
2
3 type Text struct {
4 ID string
5 Definition string
6 }
7
8 type Language struct {
9 Code string
10 Definitions []Text
11 }
12 type Com struct {
13 Component string
14 Languages []Language
15 }
16 type Dictionary []Com
17
18 type Lexicon map[string]string
19
20 var dict Dictionary
21
22 func ExportLanguage(l string) *Lexicon {
23 lex := Lexicon{}
24 d := Dictionary{}
25 d = append(d, goAppDict())
26 for _, c := range d {
27 for _, lang := range c.Languages {
28 for _, def := range lang.Definitions {
29 lex[c.Component+"_"+def.ID] = def.Definition
30 }
31 }
32 }
33 return &lex
34 }
35
36 func (l *Lexicon) RenderText(id string) string {
37 return (*l)[id]
38 }
39