Clean imports

This commit is contained in:
Tnze
2022-02-20 19:23:41 +08:00
parent fee2e0c939
commit 23bcf9149a
11 changed files with 63 additions and 42 deletions

View File

@ -185,7 +185,7 @@ var colors = map[string]string{
// By default, it's en-us.
var translateMap = en_us.Map
// SetLanguage set the translate map to this map.
// SetLanguage set the default language used by String() and ClearString().
func SetLanguage(trans map[string]string) {
translateMap = trans
}
@ -205,11 +205,7 @@ func (m Message) ClearString() string {
args[i] = arg.ClearString()
}
if translateMap != nil {
_, _ = fmt.Fprintf(&msg, translateMap[m.Translate], args...)
} else {
_, _ = fmt.Fprint(&msg, m.Translate, m.With)
}
_, _ = fmt.Fprintf(&msg, translateMap[m.Translate], args...)
}
if m.Extra != nil {
@ -256,11 +252,7 @@ func (m Message) String() string {
args[i] = arg
}
if translateMap != nil {
_, _ = fmt.Fprintf(&msg, translateMap[m.Translate], args...)
} else {
_, _ = fmt.Fprint(&msg, m.Translate, m.With)
}
_, _ = fmt.Fprintf(&msg, translateMap[m.Translate], args...)
}
if m.Extra != nil {