mirror of
https://github.com/ergochat/ergo.git
synced 2024-11-22 11:59:40 +01:00
Add 'are supported by this server' to translatable strings
This commit is contained in:
parent
1fae186637
commit
ddd7f0dc99
@ -596,8 +596,10 @@ func (client *Client) LoggedIntoAccount() bool {
|
|||||||
|
|
||||||
// RplISupport outputs our ISUPPORT lines to the client. This is used on connection and in VERSION responses.
|
// RplISupport outputs our ISUPPORT lines to the client. This is used on connection and in VERSION responses.
|
||||||
func (client *Client) RplISupport() {
|
func (client *Client) RplISupport() {
|
||||||
|
translatedISupport := client.t("are supported by this server")
|
||||||
for _, tokenline := range client.server.ISupport().CachedReply {
|
for _, tokenline := range client.server.ISupport().CachedReply {
|
||||||
// ugly trickery ahead
|
// ugly trickery ahead
|
||||||
|
tokenline = append(tokenline, translatedISupport)
|
||||||
client.Send(nil, client.server.name, RPL_ISUPPORT, append([]string{client.nick}, tokenline...)...)
|
client.Send(nil, client.server.name, RPL_ISUPPORT, append([]string{client.nick}, tokenline...)...)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,6 @@ import "sort"
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
maxLastArgLength = 400
|
maxLastArgLength = 400
|
||||||
supportedString = "are supported by this server"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// List holds a list of ISUPPORT tokens
|
// List holds a list of ISUPPORT tokens
|
||||||
@ -89,7 +88,6 @@ func (il *List) GetDifference(newil *List) [][]string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if len(cache) == 13 || len(token)+length >= maxLastArgLength {
|
if len(cache) == 13 || len(token)+length >= maxLastArgLength {
|
||||||
cache = append(cache, supportedString)
|
|
||||||
replies = append(replies, cache)
|
replies = append(replies, cache)
|
||||||
cache = make([]string, 0)
|
cache = make([]string, 0)
|
||||||
length = 0
|
length = 0
|
||||||
@ -97,7 +95,6 @@ func (il *List) GetDifference(newil *List) [][]string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if len(cache) > 0 {
|
if len(cache) > 0 {
|
||||||
cache = append(cache, supportedString)
|
|
||||||
replies = append(replies, cache)
|
replies = append(replies, cache)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -130,7 +127,6 @@ func (il *List) RegenerateCachedReply() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if len(cache) == 13 || len(token)+length >= maxLastArgLength {
|
if len(cache) == 13 || len(token)+length >= maxLastArgLength {
|
||||||
cache = append(cache, supportedString)
|
|
||||||
il.CachedReply = append(il.CachedReply, cache)
|
il.CachedReply = append(il.CachedReply, cache)
|
||||||
cache = make([]string, 0)
|
cache = make([]string, 0)
|
||||||
length = 0
|
length = 0
|
||||||
@ -138,7 +134,6 @@ func (il *List) RegenerateCachedReply() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if len(cache) > 0 {
|
if len(cache) > 0 {
|
||||||
cache = append(cache, supportedString)
|
|
||||||
il.CachedReply = append(il.CachedReply, cache)
|
il.CachedReply = append(il.CachedReply, cache)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,8 +29,8 @@ func TestISUPPORT(t *testing.T) {
|
|||||||
tListLong.RegenerateCachedReply()
|
tListLong.RegenerateCachedReply()
|
||||||
|
|
||||||
longReplies := [][]string{
|
longReplies := [][]string{
|
||||||
{"1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "are supported by this server"},
|
{"1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D"},
|
||||||
{"E", "F", "are supported by this server"},
|
{"E", "F"},
|
||||||
}
|
}
|
||||||
|
|
||||||
if !reflect.DeepEqual(tListLong.CachedReply, longReplies) {
|
if !reflect.DeepEqual(tListLong.CachedReply, longReplies) {
|
||||||
@ -46,7 +46,7 @@ func TestISUPPORT(t *testing.T) {
|
|||||||
tList1.Add("RANDKILL", "whenever")
|
tList1.Add("RANDKILL", "whenever")
|
||||||
tList1.RegenerateCachedReply()
|
tList1.RegenerateCachedReply()
|
||||||
|
|
||||||
expected := [][]string{{"CASEMAPPING=rfc1459-strict", "EXTBAN", "INVEX=i", "RANDKILL=whenever", "SASL=yes", "are supported by this server"}}
|
expected := [][]string{{"CASEMAPPING=rfc1459-strict", "EXTBAN", "INVEX=i", "RANDKILL=whenever", "SASL=yes"}}
|
||||||
if !reflect.DeepEqual(tList1.CachedReply, expected) {
|
if !reflect.DeepEqual(tList1.CachedReply, expected) {
|
||||||
t.Error("tList1's cached reply does not match expected cached reply")
|
t.Error("tList1's cached reply does not match expected cached reply")
|
||||||
}
|
}
|
||||||
@ -60,14 +60,14 @@ func TestISUPPORT(t *testing.T) {
|
|||||||
tList2.AddNoValue("STABLEKILL")
|
tList2.AddNoValue("STABLEKILL")
|
||||||
tList2.RegenerateCachedReply()
|
tList2.RegenerateCachedReply()
|
||||||
|
|
||||||
expected = [][]string{{"CASEMAPPING=ascii", "EXTBAN=TestBah", "INVEX", "SASL=yes", "STABLEKILL", "are supported by this server"}}
|
expected = [][]string{{"CASEMAPPING=ascii", "EXTBAN=TestBah", "INVEX", "SASL=yes", "STABLEKILL"}}
|
||||||
if !reflect.DeepEqual(tList2.CachedReply, expected) {
|
if !reflect.DeepEqual(tList2.CachedReply, expected) {
|
||||||
t.Error("tList2's cached reply does not match expected cached reply")
|
t.Error("tList2's cached reply does not match expected cached reply")
|
||||||
}
|
}
|
||||||
|
|
||||||
// compare lists
|
// compare lists
|
||||||
actual := tList1.GetDifference(tList2)
|
actual := tList1.GetDifference(tList2)
|
||||||
expected = [][]string{{"-RANDKILL", "CASEMAPPING=ascii", "EXTBAN=TestBah", "INVEX", "STABLEKILL", "are supported by this server"}}
|
expected = [][]string{{"-RANDKILL", "CASEMAPPING=ascii", "EXTBAN=TestBah", "INVEX", "STABLEKILL"}}
|
||||||
if !reflect.DeepEqual(actual, expected) {
|
if !reflect.DeepEqual(actual, expected) {
|
||||||
t.Error("difference reply does not match expected difference reply")
|
t.Error("difference reply does not match expected difference reply")
|
||||||
}
|
}
|
||||||
|
@ -137,6 +137,7 @@
|
|||||||
"You're not a channel operator": "You're not a channel operator",
|
"You're not a channel operator": "You're not a channel operator",
|
||||||
"You're not on that channel": "You're not on that channel",
|
"You're not on that channel": "You're not on that channel",
|
||||||
"Your host is %[1]s, running version %[2]s": "Your host is %[1]s, running version %[2]s",
|
"Your host is %[1]s, running version %[2]s": "Your host is %[1]s, running version %[2]s",
|
||||||
|
"are supported by this server": "are supported by this server",
|
||||||
"can speak these languages": "can speak these languages",
|
"can speak these languages": "can speak these languages",
|
||||||
"has client certificate fingerprint %s": "has client certificate fingerprint %s",
|
"has client certificate fingerprint %s": "has client certificate fingerprint %s",
|
||||||
"is a $bBot$b on %s": "is a $bBot$b on %s",
|
"is a $bBot$b on %s": "is a $bBot$b on %s",
|
||||||
|
Loading…
Reference in New Issue
Block a user