Conditions | 4 |
Total Lines | 16 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 4 |
Changes | 0 |
1 | package timeago |
||
30 | func modifyResult(result string, translations map[string]string) (string, string) { |
||
31 | 1 | suffix := trans().Ago |
|
32 | |||
33 | 1 | for key, translation := range translations { |
|
34 | 1 | parts := strings.Split(result, " ") |
|
35 | |||
36 | 1 | if key == trans().Ago { |
|
37 | 1 | suffix = translation |
|
38 | } |
||
39 | |||
40 | 1 | if parts[1] == key { |
|
41 | 1 | result = strings.Replace(result, key, translation, 1) |
|
42 | } |
||
43 | } |
||
44 | |||
45 | 1 | return result, suffix |
|
46 | } |
||
47 |