mirror of
https://github.com/ergochat/ergo.git
synced 2024-12-23 03:02:48 +01:00
Show translator names in INFO
This commit is contained in:
parent
421ecc9811
commit
fc9b501a77
@ -4,6 +4,8 @@
|
|||||||
package irc
|
package irc
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
)
|
)
|
||||||
@ -67,6 +69,24 @@ func (lm *LanguageManager) Count() int {
|
|||||||
return len(lm.Info)
|
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.
|
// Codes returns the proper language codes for the given casefolded language codes.
|
||||||
func (lm *LanguageManager) Codes(codes []string) []string {
|
func (lm *LanguageManager) Codes(codes []string) []string {
|
||||||
lm.RLock()
|
lm.RLock()
|
||||||
|
@ -2281,11 +2281,19 @@ func infoHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
|
|||||||
for _, line := range infoString2 {
|
for _, line := range infoString2 {
|
||||||
client.Send(nil, server.name, RPL_INFO, client.nick, line)
|
client.Send(nil, server.name, RPL_INFO, client.nick, line)
|
||||||
}
|
}
|
||||||
client.Send(nil, server.name, RPL_INFO, client.nick, "")
|
|
||||||
client.Send(nil, server.name, RPL_INFO, client.nick, client.t("Contributors and Former Developers:"))
|
client.Send(nil, server.name, RPL_INFO, client.nick, client.t("Contributors and Former Developers:"))
|
||||||
for _, line := range infoString3 {
|
for _, line := range infoString3 {
|
||||||
client.Send(nil, server.name, RPL_INFO, client.nick, line)
|
client.Send(nil, server.name, RPL_INFO, client.nick, line)
|
||||||
}
|
}
|
||||||
|
// show translators for languages other than good ole' regular English
|
||||||
|
tlines := server.languages.Translators()
|
||||||
|
if 0 < len(tlines) {
|
||||||
|
client.Send(nil, server.name, RPL_INFO, client.nick, client.t("Translators:"))
|
||||||
|
for _, line := range tlines {
|
||||||
|
client.Send(nil, server.name, RPL_INFO, client.nick, " "+line)
|
||||||
|
}
|
||||||
|
client.Send(nil, server.name, RPL_INFO, client.nick, "")
|
||||||
|
}
|
||||||
client.Send(nil, server.name, RPL_ENDOFINFO, client.nick, client.t("End of /INFO"))
|
client.Send(nil, server.name, RPL_ENDOFINFO, client.nick, client.t("End of /INFO"))
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user