Bladeren bron

Update translation framework

tags/v0.11.0-alpha
Daniel Oaks 6 jaren geleden
bovenliggende
commit
1a5ff05493
7 gewijzigde bestanden met toevoegingen van 24 en 23 verwijderingen
  1. 3
    3
      irc/config.go
  2. 2
    2
      irc/dline.go
  3. 1
    1
      irc/kline.go
  4. 3
    3
      irc/languages.go
  5. 3
    3
      irc/server.go
  6. 7
    6
      languages/example-irc.lang.json
  7. 5
    5
      languages/example.lang.yaml

+ 3
- 3
irc/config.go Bestand weergeven

149
 type LangData struct {
149
 type LangData struct {
150
 	Name         string
150
 	Name         string
151
 	Code         string
151
 	Code         string
152
-	Maintainers  string
152
+	Contributors string
153
 	Incomplete   bool
153
 	Incomplete   bool
154
 	Translations map[string]string
154
 	Translations map[string]string
155
 }
155
 }
571
 				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")
571
 				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")
572
 			}
572
 			}
573
 
573
 
574
-			if langInfo.Code == "" || langInfo.Name == "" || langInfo.Maintainers == "" {
575
-				return nil, fmt.Errorf("Code, name or maintainers is empty in language file [%s]", name)
574
+			if langInfo.Code == "" || langInfo.Name == "" || langInfo.Contributors == "" {
575
+				return nil, fmt.Errorf("Code, name or contributors is empty in language file [%s]", name)
576
 			}
576
 			}
577
 
577
 
578
 			if len(langInfo.Translations) == 0 {
578
 			if len(langInfo.Translations) == 0 {

+ 2
- 2
irc/dline.go Bestand weergeven

236
 		}
236
 		}
237
 
237
 
238
 		for key, info := range bans {
238
 		for key, info := range bans {
239
-			client.Notice(fmt.Sprintf(client.t("Ban - %s - added by %s - %s"), key, info.OperName, info.BanMessage("%s")))
239
+			client.Notice(fmt.Sprintf(client.t("Ban - %[1]s - added by %[2]s - %[3]s"), key, info.OperName, info.BanMessage("%s")))
240
 		}
240
 		}
241
 
241
 
242
 		return false
242
 		return false
372
 
372
 
373
 	var snoDescription string
373
 	var snoDescription string
374
 	if durationIsUsed {
374
 	if durationIsUsed {
375
-		client.Notice(fmt.Sprintf(client.t("Added temporary (%s) D-Line for %s"), duration.String(), hostString))
375
+		client.Notice(fmt.Sprintf(client.t("Added temporary (%[1]s) D-Line for %[2]s"), duration.String(), hostString))
376
 		snoDescription = fmt.Sprintf(ircfmt.Unescape("%s [%s]$r added temporary (%s) D-Line for %s"), client.nick, operName, duration.String(), hostString)
376
 		snoDescription = fmt.Sprintf(ircfmt.Unescape("%s [%s]$r added temporary (%s) D-Line for %s"), client.nick, operName, duration.String(), hostString)
377
 	} else {
377
 	} else {
378
 		client.Notice(fmt.Sprintf(client.t("Added D-Line for %s"), hostString))
378
 		client.Notice(fmt.Sprintf(client.t("Added D-Line for %s"), hostString))

+ 1
- 1
irc/kline.go Bestand weergeven

269
 
269
 
270
 	var snoDescription string
270
 	var snoDescription string
271
 	if durationIsUsed {
271
 	if durationIsUsed {
272
-		client.Notice(fmt.Sprintf(client.t("Added temporary (%s) K-Line for %s"), duration.String(), mask))
272
+		client.Notice(fmt.Sprintf(client.t("Added temporary (%[1]s) K-Line for %[2]s"), duration.String(), mask))
273
 		snoDescription = fmt.Sprintf(ircfmt.Unescape("%s [%s]$r added temporary (%s) K-Line for %s"), client.nick, operName, duration.String(), mask)
273
 		snoDescription = fmt.Sprintf(ircfmt.Unescape("%s [%s]$r added temporary (%s) K-Line for %s"), client.nick, operName, duration.String(), mask)
274
 	} else {
274
 	} else {
275
 		client.Notice(fmt.Sprintf(client.t("Added K-Line for %s"), mask))
275
 		client.Notice(fmt.Sprintf(client.t("Added K-Line for %s"), mask))

+ 3
- 3
irc/languages.go Bestand weergeven

26
 
26
 
27
 	// make fake "en" info
27
 	// make fake "en" info
28
 	lm.Info["en"] = LangData{
28
 	lm.Info["en"] = LangData{
29
-		Code:        "en",
30
-		Name:        "English",
31
-		Maintainers: "Oragono contributors and the IRC community",
29
+		Code:         "en",
30
+		Name:         "English",
31
+		Contributors: "Oragono contributors and the IRC community",
32
 	}
32
 	}
33
 
33
 
34
 	// load language data
34
 	// load language data

+ 3
- 3
irc/server.go Bestand weergeven

428
 	//NOTE(dan): we specifically use the NICK here instead of the nickmask
428
 	//NOTE(dan): we specifically use the NICK here instead of the nickmask
429
 	// see http://modern.ircdocs.horse/#rplwelcome-001 for details on why we avoid using the nickmask
429
 	// see http://modern.ircdocs.horse/#rplwelcome-001 for details on why we avoid using the nickmask
430
 	c.Send(nil, server.name, RPL_WELCOME, c.nick, fmt.Sprintf(c.t("Welcome to the Internet Relay Network %s"), c.nick))
430
 	c.Send(nil, server.name, RPL_WELCOME, c.nick, fmt.Sprintf(c.t("Welcome to the Internet Relay Network %s"), c.nick))
431
-	c.Send(nil, server.name, RPL_YOURHOST, c.nick, fmt.Sprintf(c.t("Your host is %s, running version %s"), server.name, Ver))
431
+	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))
432
 	c.Send(nil, server.name, RPL_CREATED, c.nick, fmt.Sprintf(c.t("This server was created %s"), server.ctime.Format(time.RFC1123)))
432
 	c.Send(nil, server.name, RPL_CREATED, c.nick, fmt.Sprintf(c.t("This server was created %s"), server.ctime.Format(time.RFC1123)))
433
 	//TODO(dan): Look at adding last optional [<channel modes with a parameter>] parameter
433
 	//TODO(dan): Look at adding last optional [<channel modes with a parameter>] parameter
434
 	c.Send(nil, server.name, RPL_MYINFO, c.nick, server.name, Ver, supportedUserModesString, supportedChannelModesString)
434
 	c.Send(nil, server.name, RPL_MYINFO, c.nick, server.name, Ver, supportedUserModesString, supportedChannelModesString)
2094
 			opercount++
2094
 			opercount++
2095
 		}
2095
 		}
2096
 	}
2096
 	}
2097
-	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))
2097
+	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))
2098
 	client.Send(nil, server.name, RPL_LUSEROP, client.nick, fmt.Sprintf(client.t("%d IRC Operators online"), opercount))
2098
 	client.Send(nil, server.name, RPL_LUSEROP, client.nick, fmt.Sprintf(client.t("%d IRC Operators online"), opercount))
2099
 	client.Send(nil, server.name, RPL_LUSERCHANNELS, client.nick, fmt.Sprintf(client.t("%d channels formed"), server.channels.Len()))
2099
 	client.Send(nil, server.name, RPL_LUSERCHANNELS, client.nick, fmt.Sprintf(client.t("%d channels formed"), server.channels.Len()))
2100
-	client.Send(nil, server.name, RPL_LUSERME, client.nick, fmt.Sprintf(client.t("I have %d clients and %d servers"), totalcount, 1))
2100
+	client.Send(nil, server.name, RPL_LUSERME, client.nick, fmt.Sprintf(client.t("I have %[1]d clients and %[2]d servers"), totalcount, 1))
2101
 	return false
2101
 	return false
2102
 }
2102
 }
2103
 
2103
 

+ 7
- 6
languages/example-irc.lang.json Bestand weergeven

13
   "Actual user@host, Actual IP": "Actual user@host, Actual IP",
13
   "Actual user@host, Actual IP": "Actual user@host, Actual IP",
14
   "Added D-Line for %s": "Added D-Line for %s",
14
   "Added D-Line for %s": "Added D-Line for %s",
15
   "Added K-Line for %s": "Added K-Line for %s",
15
   "Added K-Line for %s": "Added K-Line for %s",
16
-  "Added temporary (%s) D-Line for %s": "Added temporary (%s) D-Line for %s",
17
-  "Added temporary (%s) K-Line for %s": "Added temporary (%s) K-Line for %s",
16
+  "Added temporary (%[1]s) D-Line for %[2]s": "Added temporary (%[1]s) D-Line for %[2]s",
17
+  "Added temporary (%[1]s) K-Line for %[2]s": "Added temporary (%[1]s) K-Line for %[2]s",
18
   "Authentication successful": "Authentication successful",
18
   "Authentication successful": "Authentication successful",
19
+  "Ban - %[1]s - added by %[2]s - %[3]s": "Ban - %[1]s - added by %[2]s - %[3]s",
19
   "Ban - %s - added by %s - %s": "Ban - %s - added by %s - %s",
20
   "Ban - %s - added by %s - %s": "Ban - %s - added by %s - %s",
20
   "Callback namespace is not supported": "Callback namespace is not supported",
21
   "Callback namespace is not supported": "Callback namespace is not supported",
21
   "Can't change modes for other users": "Can't change modes for other users",
22
   "Can't change modes for other users": "Can't change modes for other users",
57
   "First param must be a mask or channel": "First param must be a mask or channel",
58
   "First param must be a mask or channel": "First param must be a mask or channel",
58
   "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.",
59
   "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.",
59
   "Help not found": "Help not found",
60
   "Help not found": "Help not found",
60
-  "I have %d clients and %d servers": "I have %d clients and %d servers",
61
+  "I have %[1]d clients and %[2]d servers": "I have %[1]d clients and %[2]d servers",
61
   "Insufficient oper privs": "Insufficient oper privs",
62
   "Insufficient oper privs": "Insufficient oper privs",
62
   "Invalid CAP subcommand": "Invalid CAP subcommand",
63
   "Invalid CAP subcommand": "Invalid CAP subcommand",
63
   "JOIN 0 is not allowed": "JOIN 0 is not allowed",
64
   "JOIN 0 is not allowed": "JOIN 0 is not allowed",
103
   "Sorry, I don't know that command": "Sorry, I don't know that command",
104
   "Sorry, I don't know that command": "Sorry, I don't know that command",
104
   "Syntax: REGISTER <channel>": "Syntax: REGISTER <channel>",
105
   "Syntax: REGISTER <channel>": "Syntax: REGISTER <channel>",
105
   "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",
106
   "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",
106
-  "There are %d users and %d invisible on %d server(s)": "There are %d users and %d invisible on %d server(s)",
107
+  "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)",
107
   "There was no such nickname": "There was no such nickname",
108
   "There was no such nickname": "There was no such nickname",
108
   "They aren't on that channel": "They aren't on that channel",
109
   "They aren't on that channel": "They aren't on that channel",
109
   "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>",
110
   "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
   "You're already opered-up!": "You're already opered-up!",
135
   "You're already opered-up!": "You're already opered-up!",
135
   "You're not a channel operator": "You're not a channel operator",
136
   "You're not a channel operator": "You're not a channel operator",
136
   "You're not on that channel": "You're not on that channel",
137
   "You're not on that channel": "You're not on that channel",
137
-  "Your host is %s, running version %s": "Your host is %s, running version %s",
138
+  "Your host is %[1]s, running version %[2]s": "Your host is %[1]s, running version %[2]s",
138
   "can speak these languages": "can speak these languages",
139
   "can speak these languages": "can speak these languages",
139
   "has client certificate fingerprint %s": "has client certificate fingerprint %s",
140
   "has client certificate fingerprint %s": "has client certificate fingerprint %s",
140
   "is a $bBot$b on %s": "is a $bBot$b on %s",
141
   "is a $bBot$b on %s": "is a $bBot$b on %s",
142
   "is logged in as": "is logged in as",
143
   "is logged in as": "is logged in as",
143
   "is using a secure connection": "is using a secure connection",
144
   "is using a secure connection": "is using a secure connection",
144
   "seconds idle, signon time": "seconds idle, signon time"
145
   "seconds idle, signon time": "seconds idle, signon time"
145
-}
146
+}

+ 5
- 5
languages/example.lang.yaml Bestand weergeven

1
-# language info file for our example language
1
+# translation info file for our example language
2
 #
2
 #
3
 # languages are made up of a few different files:
3
 # languages are made up of a few different files:
4
 #    <locale>.lang.yaml       - general info about the translation
4
 #    <locale>.lang.yaml       - general info about the translation
8
 # we split up translations in this way so that they can be displayed more nicely on CrowdIn
8
 # we split up translations in this way so that they can be displayed more nicely on CrowdIn
9
 
9
 
10
 # name - this is the 'nice' or 'full' name of the language
10
 # name - this is the 'nice' or 'full' name of the language
11
-name: "Example"
11
+name: "English"
12
 
12
 
13
 # code - this is what the language will be referred to in our list of languages
13
 # code - this is what the language will be referred to in our list of languages
14
-code: "example"
14
+code: "en"
15
 
15
 
16
-# maintainers - these are the maintainer details given
17
-maintainers: "Daniel Oaks <daniel@danieloaks.net>"
16
+# contributors - people who have contributed to this translation
17
+contributors: "Example Person <example@example.com>"
18
 
18
 
19
 # incomplete - whether to mark this language as incomplete
19
 # incomplete - whether to mark this language as incomplete
20
 incomplete: true
20
 incomplete: true

Laden…
Annuleren
Opslaan