/
lower.go
61 lines (57 loc) · 1.62 KB
/
lower.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package main
import (
"strings"
)
func langsToLower(lm LM) LM {
cpy := make(LM)
for l := range lm {
x := lm[l]
xcpy := Lang{
Endonym: strings.ToLower(x.Endonym),
En: strings.ToLower(x.En),
De: strings.ToLower(x.De),
Fr: strings.ToLower(x.Fr),
ISO_639_1: strings.ToLower(x.ISO_639_1),
ISO_639_2: strings.ToLower(x.ISO_639_2),
Family: strings.ToLower(x.Family),
Translations: make(map[string]string),
}
for t := range x.Translations {
xcpy.Translations[strings.ToLower(t)] = strings.ToLower(x.Translations[t])
}
cpy[strings.ToLower(l)] = xcpy
}
return cpy
}
func categoriesToLower(tcat []TranslatedCategory) []TranslatedCategory {
cpy := make([]TranslatedCategory, len(tcat))
for i := range tcat {
cpy[i] = TranslatedCategory{
Name: strings.ToLower(tcat[i].Name),
Translations: make(map[string]string),
}
for l := range tcat[i].Translations {
x := tcat[i].Translations[l]
cpy[i].Translations[strings.ToLower(l)] = strings.ToLower(x)
}
}
return cpy
}
func disciplinesToLower(td []TranslatedSportDiscipline) []TranslatedSportDiscipline {
cpy := make([]TranslatedSportDiscipline, len(td))
for i := range td {
cpy[i] = TranslatedSportDiscipline{
SportDiscipline: SportDiscipline{
Name: strings.ToLower(td[i].SportDiscipline.Name),
Href: td[i].SportDiscipline.Href,
},
Category: strings.ToLower(td[i].Category),
Translations: make(map[string]string),
}
for l := range td[i].Translations {
x := td[i].Translations[l]
cpy[i].Translations[strings.ToLower(l)] = strings.ToLower(x)
}
}
return cpy
}