mirror of
https://github.com/ergochat/ergo.git
synced 2024-11-10 22:19:31 +01:00
Update translation framework
This commit is contained in:
parent
ddec79f8d0
commit
1a5ff05493
@ -149,7 +149,7 @@ type StackImpactConfig struct {
|
|||||||
type LangData struct {
|
type LangData struct {
|
||||||
Name string
|
Name string
|
||||||
Code string
|
Code string
|
||||||
Maintainers string
|
Contributors string
|
||||||
Incomplete bool
|
Incomplete bool
|
||||||
Translations map[string]string
|
Translations map[string]string
|
||||||
}
|
}
|
||||||
@ -571,8 +571,8 @@ func LoadConfig(filename string) (config *Config, err error) {
|
|||||||
return nil, fmt.Errorf("Cannot have language file with code 'en' (this is the default language using strings inside the server code). If you're making an English variant, name it with a more specific code")
|
return nil, fmt.Errorf("Cannot have language file with code 'en' (this is the default language using strings inside the server code). If you're making an English variant, name it with a more specific code")
|
||||||
}
|
}
|
||||||
|
|
||||||
if langInfo.Code == "" || langInfo.Name == "" || langInfo.Maintainers == "" {
|
if langInfo.Code == "" || langInfo.Name == "" || langInfo.Contributors == "" {
|
||||||
return nil, fmt.Errorf("Code, name or maintainers is empty in language file [%s]", name)
|
return nil, fmt.Errorf("Code, name or contributors is empty in language file [%s]", name)
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(langInfo.Translations) == 0 {
|
if len(langInfo.Translations) == 0 {
|
||||||
|
@ -236,7 +236,7 @@ func dlineHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for key, info := range bans {
|
for key, info := range bans {
|
||||||
client.Notice(fmt.Sprintf(client.t("Ban - %s - added by %s - %s"), key, info.OperName, info.BanMessage("%s")))
|
client.Notice(fmt.Sprintf(client.t("Ban - %[1]s - added by %[2]s - %[3]s"), key, info.OperName, info.BanMessage("%s")))
|
||||||
}
|
}
|
||||||
|
|
||||||
return false
|
return false
|
||||||
@ -372,7 +372,7 @@ func dlineHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
|
|||||||
|
|
||||||
var snoDescription string
|
var snoDescription string
|
||||||
if durationIsUsed {
|
if durationIsUsed {
|
||||||
client.Notice(fmt.Sprintf(client.t("Added temporary (%s) D-Line for %s"), duration.String(), hostString))
|
client.Notice(fmt.Sprintf(client.t("Added temporary (%[1]s) D-Line for %[2]s"), duration.String(), hostString))
|
||||||
snoDescription = fmt.Sprintf(ircfmt.Unescape("%s [%s]$r added temporary (%s) D-Line for %s"), client.nick, operName, duration.String(), hostString)
|
snoDescription = fmt.Sprintf(ircfmt.Unescape("%s [%s]$r added temporary (%s) D-Line for %s"), client.nick, operName, duration.String(), hostString)
|
||||||
} else {
|
} else {
|
||||||
client.Notice(fmt.Sprintf(client.t("Added D-Line for %s"), hostString))
|
client.Notice(fmt.Sprintf(client.t("Added D-Line for %s"), hostString))
|
||||||
|
@ -269,7 +269,7 @@ func klineHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
|
|||||||
|
|
||||||
var snoDescription string
|
var snoDescription string
|
||||||
if durationIsUsed {
|
if durationIsUsed {
|
||||||
client.Notice(fmt.Sprintf(client.t("Added temporary (%s) K-Line for %s"), duration.String(), mask))
|
client.Notice(fmt.Sprintf(client.t("Added temporary (%[1]s) K-Line for %[2]s"), duration.String(), mask))
|
||||||
snoDescription = fmt.Sprintf(ircfmt.Unescape("%s [%s]$r added temporary (%s) K-Line for %s"), client.nick, operName, duration.String(), mask)
|
snoDescription = fmt.Sprintf(ircfmt.Unescape("%s [%s]$r added temporary (%s) K-Line for %s"), client.nick, operName, duration.String(), mask)
|
||||||
} else {
|
} else {
|
||||||
client.Notice(fmt.Sprintf(client.t("Added K-Line for %s"), mask))
|
client.Notice(fmt.Sprintf(client.t("Added K-Line for %s"), mask))
|
||||||
|
@ -28,7 +28,7 @@ func NewLanguageManager(defaultLang string, languageData map[string]LangData) *L
|
|||||||
lm.Info["en"] = LangData{
|
lm.Info["en"] = LangData{
|
||||||
Code: "en",
|
Code: "en",
|
||||||
Name: "English",
|
Name: "English",
|
||||||
Maintainers: "Oragono contributors and the IRC community",
|
Contributors: "Oragono contributors and the IRC community",
|
||||||
}
|
}
|
||||||
|
|
||||||
// load language data
|
// load language data
|
||||||
|
@ -428,7 +428,7 @@ func (server *Server) tryRegister(c *Client) {
|
|||||||
//NOTE(dan): we specifically use the NICK here instead of the nickmask
|
//NOTE(dan): we specifically use the NICK here instead of the nickmask
|
||||||
// see http://modern.ircdocs.horse/#rplwelcome-001 for details on why we avoid using the nickmask
|
// see http://modern.ircdocs.horse/#rplwelcome-001 for details on why we avoid using the nickmask
|
||||||
c.Send(nil, server.name, RPL_WELCOME, c.nick, fmt.Sprintf(c.t("Welcome to the Internet Relay Network %s"), c.nick))
|
c.Send(nil, server.name, RPL_WELCOME, c.nick, fmt.Sprintf(c.t("Welcome to the Internet Relay Network %s"), c.nick))
|
||||||
c.Send(nil, server.name, RPL_YOURHOST, c.nick, fmt.Sprintf(c.t("Your host is %s, running version %s"), server.name, Ver))
|
c.Send(nil, server.name, RPL_YOURHOST, c.nick, fmt.Sprintf(c.t("Your host is %[1]s, running version %[2]s"), server.name, Ver))
|
||||||
c.Send(nil, server.name, RPL_CREATED, c.nick, fmt.Sprintf(c.t("This server was created %s"), server.ctime.Format(time.RFC1123)))
|
c.Send(nil, server.name, RPL_CREATED, c.nick, fmt.Sprintf(c.t("This server was created %s"), server.ctime.Format(time.RFC1123)))
|
||||||
//TODO(dan): Look at adding last optional [<channel modes with a parameter>] parameter
|
//TODO(dan): Look at adding last optional [<channel modes with a parameter>] parameter
|
||||||
c.Send(nil, server.name, RPL_MYINFO, c.nick, server.name, Ver, supportedUserModesString, supportedChannelModesString)
|
c.Send(nil, server.name, RPL_MYINFO, c.nick, server.name, Ver, supportedUserModesString, supportedChannelModesString)
|
||||||
@ -2094,10 +2094,10 @@ func lusersHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
|
|||||||
opercount++
|
opercount++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
client.Send(nil, server.name, RPL_LUSERCLIENT, client.nick, fmt.Sprintf(client.t("There are %d users and %d invisible on %d server(s)"), totalcount, invisiblecount, 1))
|
client.Send(nil, server.name, RPL_LUSERCLIENT, client.nick, fmt.Sprintf(client.t("There are %[1]d users and %[2]d invisible on %[3]d server(s)"), totalcount, invisiblecount, 1))
|
||||||
client.Send(nil, server.name, RPL_LUSEROP, client.nick, fmt.Sprintf(client.t("%d IRC Operators online"), opercount))
|
client.Send(nil, server.name, RPL_LUSEROP, client.nick, fmt.Sprintf(client.t("%d IRC Operators online"), opercount))
|
||||||
client.Send(nil, server.name, RPL_LUSERCHANNELS, client.nick, fmt.Sprintf(client.t("%d channels formed"), server.channels.Len()))
|
client.Send(nil, server.name, RPL_LUSERCHANNELS, client.nick, fmt.Sprintf(client.t("%d channels formed"), server.channels.Len()))
|
||||||
client.Send(nil, server.name, RPL_LUSERME, client.nick, fmt.Sprintf(client.t("I have %d clients and %d servers"), totalcount, 1))
|
client.Send(nil, server.name, RPL_LUSERME, client.nick, fmt.Sprintf(client.t("I have %[1]d clients and %[2]d servers"), totalcount, 1))
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,9 +13,10 @@
|
|||||||
"Actual user@host, Actual IP": "Actual user@host, Actual IP",
|
"Actual user@host, Actual IP": "Actual user@host, Actual IP",
|
||||||
"Added D-Line for %s": "Added D-Line for %s",
|
"Added D-Line for %s": "Added D-Line for %s",
|
||||||
"Added K-Line for %s": "Added K-Line for %s",
|
"Added K-Line for %s": "Added K-Line for %s",
|
||||||
"Added temporary (%s) D-Line for %s": "Added temporary (%s) D-Line for %s",
|
"Added temporary (%[1]s) D-Line for %[2]s": "Added temporary (%[1]s) D-Line for %[2]s",
|
||||||
"Added temporary (%s) K-Line for %s": "Added temporary (%s) K-Line for %s",
|
"Added temporary (%[1]s) K-Line for %[2]s": "Added temporary (%[1]s) K-Line for %[2]s",
|
||||||
"Authentication successful": "Authentication successful",
|
"Authentication successful": "Authentication successful",
|
||||||
|
"Ban - %[1]s - added by %[2]s - %[3]s": "Ban - %[1]s - added by %[2]s - %[3]s",
|
||||||
"Ban - %s - added by %s - %s": "Ban - %s - added by %s - %s",
|
"Ban - %s - added by %s - %s": "Ban - %s - added by %s - %s",
|
||||||
"Callback namespace is not supported": "Callback namespace is not supported",
|
"Callback namespace is not supported": "Callback namespace is not supported",
|
||||||
"Can't change modes for other users": "Can't change modes for other users",
|
"Can't change modes for other users": "Can't change modes for other users",
|
||||||
@ -57,7 +58,7 @@
|
|||||||
"First param must be a mask or channel": "First param must be a mask or channel",
|
"First param must be a mask or channel": "First param must be a mask or channel",
|
||||||
"HELPOP <argument>\n\nGet an explanation of <argument>, or \"index\" for a list of help topics.": "HELPOP <argument>\n\nGet an explanation of <argument>, or \"index\" for a list of help topics.",
|
"HELPOP <argument>\n\nGet an explanation of <argument>, or \"index\" for a list of help topics.": "HELPOP <argument>\n\nGet an explanation of <argument>, or \"index\" for a list of help topics.",
|
||||||
"Help not found": "Help not found",
|
"Help not found": "Help not found",
|
||||||
"I have %d clients and %d servers": "I have %d clients and %d servers",
|
"I have %[1]d clients and %[2]d servers": "I have %[1]d clients and %[2]d servers",
|
||||||
"Insufficient oper privs": "Insufficient oper privs",
|
"Insufficient oper privs": "Insufficient oper privs",
|
||||||
"Invalid CAP subcommand": "Invalid CAP subcommand",
|
"Invalid CAP subcommand": "Invalid CAP subcommand",
|
||||||
"JOIN 0 is not allowed": "JOIN 0 is not allowed",
|
"JOIN 0 is not allowed": "JOIN 0 is not allowed",
|
||||||
@ -103,7 +104,7 @@
|
|||||||
"Sorry, I don't know that command": "Sorry, I don't know that command",
|
"Sorry, I don't know that command": "Sorry, I don't know that command",
|
||||||
"Syntax: REGISTER <channel>": "Syntax: REGISTER <channel>",
|
"Syntax: REGISTER <channel>": "Syntax: REGISTER <channel>",
|
||||||
"Thanks to Jeremy Latt for founding Ergonomadic, the project this is based on <3": "Thanks to Jeremy Latt for founding Ergonomadic, the project this is based on <3",
|
"Thanks to Jeremy Latt for founding Ergonomadic, the project this is based on <3": "Thanks to Jeremy Latt for founding Ergonomadic, the project this is based on <3",
|
||||||
"There are %d users and %d invisible on %d server(s)": "There are %d users and %d invisible on %d server(s)",
|
"There are %[1]d users and %[2]d invisible on %[3]d server(s)": "There are %[1]d users and %[2]d invisible on %[3]d server(s)",
|
||||||
"There was no such nickname": "There was no such nickname",
|
"There was no such nickname": "There was no such nickname",
|
||||||
"They aren't on that channel": "They aren't on that channel",
|
"They aren't on that channel": "They aren't on that channel",
|
||||||
"This ban matches you. To DLINE yourself, you must use the command: /DLINE MYSELF <arguments>": "This ban matches you. To DLINE yourself, you must use the command: /DLINE MYSELF <arguments>",
|
"This ban matches you. To DLINE yourself, you must use the command: /DLINE MYSELF <arguments>": "This ban matches you. To DLINE yourself, you must use the command: /DLINE MYSELF <arguments>",
|
||||||
@ -134,7 +135,7 @@
|
|||||||
"You're already opered-up!": "You're already opered-up!",
|
"You're already opered-up!": "You're already opered-up!",
|
||||||
"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 %s, running version %s": "Your host is %s, running version %s",
|
"Your host is %[1]s, running version %[2]s": "Your host is %[1]s, running version %[2]s",
|
||||||
"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",
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
# language info file for our example language
|
# translation info file for our example language
|
||||||
#
|
#
|
||||||
# languages are made up of a few different files:
|
# languages are made up of a few different files:
|
||||||
# <locale>.lang.yaml - general info about the translation
|
# <locale>.lang.yaml - general info about the translation
|
||||||
@ -8,13 +8,13 @@
|
|||||||
# we split up translations in this way so that they can be displayed more nicely on CrowdIn
|
# we split up translations in this way so that they can be displayed more nicely on CrowdIn
|
||||||
|
|
||||||
# name - this is the 'nice' or 'full' name of the language
|
# name - this is the 'nice' or 'full' name of the language
|
||||||
name: "Example"
|
name: "English"
|
||||||
|
|
||||||
# code - this is what the language will be referred to in our list of languages
|
# code - this is what the language will be referred to in our list of languages
|
||||||
code: "example"
|
code: "en"
|
||||||
|
|
||||||
# maintainers - these are the maintainer details given
|
# contributors - people who have contributed to this translation
|
||||||
maintainers: "Daniel Oaks <daniel@danieloaks.net>"
|
contributors: "Example Person <example@example.com>"
|
||||||
|
|
||||||
# incomplete - whether to mark this language as incomplete
|
# incomplete - whether to mark this language as incomplete
|
||||||
incomplete: true
|
incomplete: true
|
||||||
|
Loading…
Reference in New Issue
Block a user