1
0
Fork 0
forked from External/ergo

Show translator names in INFO

This commit is contained in:
Daniel Oaks 2018-01-25 19:51:02 +10:00
parent 421ecc9811
commit fc9b501a77
2 changed files with 29 additions and 1 deletions

View file

@ -4,6 +4,8 @@
package irc
import (
"fmt"
"sort"
"strings"
"sync"
)
@ -67,6 +69,24 @@ func (lm *LanguageManager) Count() int {
return len(lm.Info)
}
// Translators returns the languages we have and the translators.
func (lm *LanguageManager) Translators() []string {
lm.RLock()
defer lm.RUnlock()
var tlist sort.StringSlice
for _, info := range lm.Info {
if info.Code == "en" {
continue
}
tlist = append(tlist, fmt.Sprintf("%s (%s): %s", info.Name, info.Code, info.Contributors))
}
sort.Sort(tlist)
return tlist
}
// Codes returns the proper language codes for the given casefolded language codes.
func (lm *LanguageManager) Codes(codes []string) []string {
lm.RLock()