Total Lines | 37 |
Duplicated Lines | 0 % |
Coverage | 83.33% |
Changes | 0 |
1 | package timeago |
||
2 | |||
3 | type Translation struct { |
||
4 | Language string |
||
5 | Translations map[string]string |
||
6 | } |
||
7 | |||
8 | type Config struct { |
||
9 | Language string |
||
10 | Location string |
||
11 | Translations []Translation |
||
12 | } |
||
13 | |||
14 | var config = Config{ |
||
15 | Language: "en", |
||
16 | Location: "", |
||
17 | Translations: []Translation{}, |
||
18 | } |
||
19 | |||
20 | func SetConfig(conf Config) { |
||
21 | 1 | if conf.Language == "" { |
|
22 | 1 | conf.Language = config.Language |
|
23 | } |
||
24 | |||
25 | 1 | config = conf |
|
26 | } |
||
27 | |||
28 | func locationIsSet() bool { |
||
29 | 1 | return config.Location != "" |
|
30 | } |
||
31 | |||
32 | func locationIsNotSet() bool { |
||
33 | return !locationIsSet() |
||
34 | } |
||
35 | |||
36 | func translationsAreSet() bool { |
||
37 | 1 | return len(config.Translations) > 0 |
|
38 | } |
||
39 |