Conditions | 4 |
Total Lines | 14 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 20 |
Changes | 0 |
1 | package timeago |
||
46 | func identifyGrammarRules(num int, lang string) (*Rule, error) { |
||
47 | rules := grammarRules(num) |
||
48 | |||
49 | if v, ok := rules[lang]; ok { |
||
50 | return v, nil |
||
51 | } |
||
52 | |||
53 | for langs, v := range rules { |
||
54 | if strings.Contains(langs, lang) { |
||
55 | return v, nil |
||
56 | } |
||
57 | } |
||
58 | |||
59 | return nil, utils.Errorf("Language '" + lang + "' not found") |
||
60 | } |
||
61 |