Ver código fonte

vcc: translated

intirain 4 anos atrás
pai
commit
69ed4e4049
12 arquivos alterados com 404 adições e 90 exclusões
  1. 37 37
      cmd.c
  2. 6 5
      crypt.c
  3. 5 2
      include/vcc/plugin.h
  4. 2 2
      include/vcc/version.h
  5. 7 11
      main.c
  6. 10 10
      plugins.c
  7. 1 1
      plugins/hello/hello.c
  8. 1 1
      plugins/m4/m4.c
  9. 1 1
      plugins/script/script.c
  10. 323 11
      po/zh_CN.po
  11. 4 3
      pretty.c
  12. 7 6
      vcc.c

+ 37 - 37
cmd.c

@@ -207,7 +207,7 @@ int do_cmd_help(int argc, char **argv) {
 	(void) argv;
 
 	if (argc != 1) {
-		fprintf(stderr, "usage: -help\n");
+		fprintf(stderr, _("usage: -help\n"));
 
 		return 1;
 	}
@@ -225,12 +225,12 @@ int do_cmd_quit(int argc, char **argv) {
 	(void) argv;
 
 	if (argc != 1) {
-		fprintf(stderr, "usage: -quit\n");
+		fprintf(stderr, _("usage: -quit\n"));
 
 		return 1;
 	}
 
-	printf("bye. \n");
+	printf(_("bye. \n"));
 	exit(0);
 
 	return 0;
@@ -241,7 +241,7 @@ int do_cmd_ls(int argc, char **argv) {
 	(void) argv;
 
 	if (argc != 1) {
-		fprintf(stderr, "usage -ls\n");
+		fprintf(stderr, _("usage -ls\n"));
 
 		return 1;
 	}
@@ -278,7 +278,7 @@ int do_cmd_lsse(int argc, char **argv) {
 	(void) argv;
 
 	if (argc != 1) {
-		fprintf(stderr, "usage: -lsse\n");
+		fprintf(stderr, _("usage: -lsse\n"));
 
 		return 1;
 	}
@@ -316,7 +316,7 @@ int do_cmd_newse(int argc, char **argv) {
 
 	switch (argc) {
 	case 1:
-		fprintf(stderr, "Name of new session: ");
+		fprintf(stderr, _("Name of new session: "));
 		scanf("%s", sname);
 
 		vcc_create_session(sname);
@@ -327,11 +327,11 @@ int do_cmd_newse(int argc, char **argv) {
 		break;
 
 	default:
-		fprintf(stderr, "usage: -newse [session-name]\n");
+		fprintf(stderr, _("usage: -newse [session-name]\n"));
 		return 1;
 	}
 
-	printf("Session create request sent. \n");
+	printf(_("Session create request sent. \n"));
 
 	return 0;
 }
@@ -341,12 +341,12 @@ int do_cmd_currs(int argc, char **argv) {
 	(void) argv;
 
 	if (argc != 1) {
-		fprintf(stderr, "usage: -currs\n");
+		fprintf(stderr, _("usage: -currs\n"));
 
 		return 1;
 	}
 
-	printf("Current session id: %d\n", current_sid);
+	printf(_("Current session id: %d\n"), current_sid);
 
 	return 0;
 }
@@ -357,8 +357,8 @@ int do_cmd_swtch(int argc, char **argv) {
 
 	switch (argc) {
 	case 1:
-		printf("Old session id: %d\n", current_sid);
-		fprintf(stderr, "New session id: ");
+		printf(_("Old session id: %d\n"), current_sid);
+		fprintf(stderr, _("New session id: "));
 		scanf("%d", &sid);
 
 		break;
@@ -367,7 +367,7 @@ int do_cmd_swtch(int argc, char **argv) {
 		break;
 
 	default:
-		fprintf(stderr, "usage: -swtch [session-number]\n");
+		fprintf(stderr, _("usage: -swtch [session-number]\n"));
 		return 1;
 	}
 
@@ -384,14 +384,14 @@ int do_cmd_uinfo(int argc, char **argv) {
 	char name[USRNAME_SIZE];
 
 	if (argc > 2) {
-		fprintf(stderr, "usage: -uinfo [user-name]\n");
+		fprintf(stderr, _("usage: -uinfo [user-name]\n"));
 
 		return 1;
 	}
 
 	if (!lself) {
 		if (argc == 1) {
-			fprintf(stderr, "username: ");
+			fprintf(stderr, _("username: "));
 			scanf("%s", name);
 
 			get_user_info(name);
@@ -425,7 +425,7 @@ int do_cmd_uinfo_bh(struct vcc_request *req) {
 	clear_line();
 
 	if (ntohl(req->uid) == -1u) {
-		printf("user not found. \n");
+		printf(_("user not found. \n"));
 		pretty_prompt(usrname);
 
 		return 1;
@@ -435,12 +435,12 @@ int do_cmd_uinfo_bh(struct vcc_request *req) {
 		lself = 0;
 		self_level = ntohl(u->level);
 
-		printf("Level of yourself: %d\n", self_level);
+		printf(_("Level of yourself: %d\n"), self_level);
 	}
 
 	else {
-		printf("%s's info: \n", u->usrname);
-		printf("\tscore\tlevel\n");
+		printf(_("%s's info: \n"), u->usrname);
+		printf(_("\tscore\tlevel\n"));
 		printf("\t%5d\t%d\n", ntohl(u->score), ntohl(u->level));
 	}
 
@@ -453,7 +453,7 @@ int do_cmd_lself(int argc, char **argv) {
 	(void) argv;
 
 	if (argc != 1) {
-		fprintf(stderr, "usage: -lself\n");
+		fprintf(stderr, _("usage: -lself\n"));
 
 		return 1;
 	}
@@ -470,10 +470,10 @@ int do_cmd_incr(int argc, char **argv) {
 
 	switch (argc) {
 	case 1:
-		fprintf(stderr, "username: ");
+		fprintf(stderr, _("username: "));
 		scanf("%s", name);
 
-		fprintf(stderr, "increment: ");
+		fprintf(stderr, _("increment: "));
 		scanf("%d", &incr);
 
 		incr_score(name, incr);
@@ -482,7 +482,7 @@ int do_cmd_incr(int argc, char **argv) {
 
 	case 3:
 		if (!sscanf(argv[2], "%d", &incr)) {
-			fprintf(stderr, "argv[2] should be a number. \n");
+			fprintf(stderr, _("argv[2] should be a number. \n"));
 
 			return 1;
 		}
@@ -492,7 +492,7 @@ int do_cmd_incr(int argc, char **argv) {
 		break;
 
 	default:
-		fprintf(stderr, "usage: -incr [usrname] && [increment]\n");
+		fprintf(stderr, _("usage: -incr [usrname] && [increment]\n"));
 
 		return 1;
 	}
@@ -505,7 +505,7 @@ int do_cmd_incr_bh(struct vcc_request *req) {
 	clear_line();
 
 	if (!ntohl(req->uid)) 
-		printf("Sucessfully. \n");
+		printf(_("Sucessfully. \n"));
 
 	else 
 		printf("*** failed. \n");
@@ -520,7 +520,7 @@ int do_cmd_cqd(int argc, char **argv) {
 	(void) argv;
 
 	if (argc != 1) {
-		fprintf(stderr, "usage: -cqd\n");
+		fprintf(stderr, _("usage: -cqd\n"));
 
 		return 1;
 	}
@@ -538,7 +538,7 @@ int do_cmd_ban(int argc, char **argv) {
 	
 	switch (argc) {
 	case 1:
-		fprintf(stderr, "Enter the user to ban: ");
+		fprintf(stderr, _("Enter the user to ban: "));
 		scanf("%s", people_arr);
 		people_name = strdup(people_arr);
 
@@ -550,14 +550,14 @@ int do_cmd_ban(int argc, char **argv) {
 		break;
 
 	default:
-		fprintf(stderr, "usage: -ban [user-name]\n");
+		fprintf(stderr, _("usage: -ban [user-name]\n"));
 
 		return 1;
 	}
 
 	for (i = banned_people.next; i != &banned_people; i = i->next) {
 		if (!strcmp(people_name, i->usrname)) {
-			fprintf(stderr, "User %s is already banned", people_name);
+			fprintf(stderr, _("User %s is already banned\n"), people_name);
 			free(people_name);
 
 			return 0;
@@ -585,7 +585,7 @@ int do_cmd_unban(int argc, char **argv) {
 	case 1:
 		people_name = malloc(USRNAME_SIZE + 1);
 
-		fprintf(stderr, "Enter the user to unban: ");
+		fprintf(stderr, _("Enter the user to unban: "));
 		scanf("%s", people_name);
 
 		break;
@@ -596,7 +596,7 @@ int do_cmd_unban(int argc, char **argv) {
 		break;
 
 	default:
-		fprintf(stderr, "usage: -unban [user-name]\n");
+		fprintf(stderr, _("usage: -unban [user-name]\n"));
 
 		return 1;
 	}
@@ -629,7 +629,7 @@ static char const warn_msg[] = {
 static int show_warn_msg(void) {
 	char c;
 
-	fprintf(stderr, "%s", warn_msg);
+	fprintf(stderr, "%s", _(warn_msg));
 
 	for (;;) {
 		read(0, &c, 1);
@@ -640,7 +640,7 @@ static int show_warn_msg(void) {
 		else if (c == 'n' || c == 'N') 
 			return 1;
 
-		printf("Please answer y / n\n");
+		printf(_("Please answer y / n\n"));
 	}
 
 	return 1;
@@ -662,7 +662,7 @@ int do_cmd_encry(int argc, char **argv) {
 	case 1:
 		memset(msg, 0, MSG_SIZE);
 
-		fprintf(stderr, "Message: ");
+		fprintf(stderr, _("Message: "));
 		scanf("%s", msg);
 		p = msg;
 
@@ -672,7 +672,7 @@ int do_cmd_encry(int argc, char **argv) {
 		break;
 
 	default:
-		fprintf(stderr, "usage: -encry [message]\n");
+		fprintf(stderr, _("usage: -encry [message]\n"));
 
 		return 1;
 	}
@@ -690,7 +690,7 @@ int do_cmd_ml(int argc, char **argv) {
 	(void) 	argv;
 
 	if (argc != 1) {
-		fprintf(stderr, "usage: -ml\n");
+		fprintf(stderr, _("usage: -ml\n"));
 
 		return 1;
 	}
@@ -701,7 +701,7 @@ int do_cmd_ml(int argc, char **argv) {
 		return 1;
 	}
 
-	printf("Type 'finish' at the starting of a line to finish. \n");
+	printf(_("Type 'finish' at the starting of a line to finish. \n"));
 
 	for (i = 0; i < (int) MSG_SIZE; i += size) {
 		size = read(0, p + i, 128);

+ 6 - 5
crypt.c

@@ -26,6 +26,7 @@
 #include <gcrypt.h>
 
 #include <vcc/vcc.h>
+#include <vcc/plugin.h>
 #include <vcc/version.h>
 #include <vcc/pretty.h>
 
@@ -65,9 +66,9 @@ int show_algo_info(void) {
 		return 1;
 	}
 
-	printf("key size: %d\n", keysize);
-	printf("block size: %d\n", blksize);
-	printf("maximum message size: %d\n", msgsize);
+	printf(_("key size: %d\n"), keysize);
+	printf(_("block size: %d\n"), blksize);
+	printf(_("maximum message size: %d\n"), msgsize);
 
 	return 0;
 }
@@ -106,7 +107,7 @@ int encrypt(char *msg) {
 	gcry_error_t err;
 
 	if (crypt_disabled) {
-		fprintf(stderr, "error: crypting disabled. \n");
+		fprintf(stderr, _("error: crypting disabled. \n"));
 
 		return 1;
 	}
@@ -125,7 +126,7 @@ int decrypt(char *msg) {
 	gcry_error_t err;
 
 	if (crypt_disabled) {
-		fprintf(stderr, "error: crypt disabled. \n");
+		fprintf(stderr, _("error: crypt disabled. \n"));
 
 		return 1;
 	}

+ 5 - 2
include/vcc/plugin.h

@@ -24,6 +24,7 @@
 
 #include <sys/types.h>
 #include <vcc/vcc.h>
+#include <libintl.h>
 
 /* a plugin can define their own commands in cmd.c, and must check 
  * it inserted, and abort command execution if it doesn't. */
@@ -56,10 +57,12 @@ struct plugin {
 /* plugin.c */
 extern struct plugin *plugins[];
 
+#define _(s) 			gettext(s)
+
 #define plg_check_enabled() ({	\
 	if (this_plg->state != PLG_INSERTED) { \
-		fprintf(stderr, "*** this plugin didn't insert. " \
-				"please insert it by -pins and try it again. \n"); \
+		fprintf(stderr, _("*** this plugin didn't insert. " \
+				"please insert it by -pins and try it again. \n")); \
 		return 1; \
 	} \
 })

+ 2 - 2
include/vcc/version.h

@@ -1,2 +1,2 @@
-#define VCC_VERSION "VCC 1.17.1 Sat May  7 22:17:53 CST 2022 root"
-#define VCC_SEMVER "vcc 1.17.1-rc "
+#define VCC_VERSION "VCC 1.18.0 2022年 05月 08日 星期日 16:00:03 CST root"
+#define VCC_SEMVER "vcc 1.18.0-rc "

+ 7 - 11
main.c

@@ -140,7 +140,7 @@ static struct option longopts[] = {
 
 
 static int usage(void) {
-	fputs(help_msg, stderr);
+	fputs(_(help_msg), stderr);
 	return 1;
 }
 
@@ -153,7 +153,7 @@ static int login(int got_usrname) {
 		scanf("%s", usrname);
 	}
 
-	passwd = getpass("password: ");
+	passwd = getpass(_("password: "));
 
 	vcc_login(usrname, passwd);
 	do_cmd_lself(1, NULL);
@@ -175,7 +175,7 @@ int vos_login(void) {
 	strcpy(usrname, name);
 
 	if (!(passwd = getenv("VOS_PASSWD"))) {
-		fprintf(stderr, "Password not specified. \n");
+		fprintf(stderr, _("Password not specified. \n"));
 
 		exit(EXIT_FAILURE);
 	}
@@ -188,7 +188,7 @@ int vos_login(void) {
 	/* crypt_init will copy that into a heap buffer */
 
 	if (!(key = getenv("VOS_KEY")) || !(iv = getenv("VOS_IV"))) {
-		fprintf(stderr, "warning: crypting disabled. \n");
+		fprintf(stderr, _("warning: crypting disabled. \n"));
 		crypt_disabled = 1;
 
 		return 1;
@@ -298,11 +298,7 @@ int main(int argc, char **argv) {
 
 	(void) argc;
 
-#ifdef _WIN32
 	setlocale(LC_ALL, "");
-#else
-	setlocale(LC_ALL, "");
-#endif
 
 	bindtextdomain("vcc", "lang");
 	textdomain("vcc");
@@ -312,7 +308,7 @@ int main(int argc, char **argv) {
 	got_usrname = parse_args(argc, argv, &port, &ip);
 	init_socket(ip, port);
 
-	printf("Connected to server. \n");
+	printf(_("Connected to server. \n"));
 
 	if (mode == MODE_ROBOT) 
 		return robot();
@@ -381,7 +377,7 @@ int main(int argc, char **argv) {
 			size = read(fd, req, REQ_SIZE);
 
 			if (unlikely(!size)) {
-				fprintf(stderr, "Server closed. \n");
+				fprintf(stderr, _("Server closed. \n"));
 
 				break;
 			}
@@ -419,7 +415,7 @@ int main(int argc, char **argv) {
 		}
 	}
 
-	printf("bye. \n");
+	printf(_("bye. \n"));
 
 	return 0;
 }

+ 10 - 10
plugins.c

@@ -57,7 +57,7 @@ int do_cmd_pls(int argc, char **argv) {
 	(void) argv;
 
 	if (argc != 1) {
-		fprintf(stderr, "usage: -pls\n");
+		fprintf(stderr, _("usage: -pls\n"));
 
 		return 1;
 	}
@@ -100,7 +100,7 @@ int do_cmd_prem(int argc, char **argv) {
 
 	switch (argc) {
 	case 1:
-		fprintf(stderr, "plugin: ");
+		fprintf(stderr, _("plugin: "));
 		scanf("%s", name);
 
 		s = name;
@@ -111,18 +111,18 @@ int do_cmd_prem(int argc, char **argv) {
 		break;
 
 	default:
-		fprintf(stderr, "usage: -prem [plugin-name]\n");
+		fprintf(stderr, _("usage: -prem [plugin-name]\n"));
 		break;
 	}
 
 	if (!(p = find_plg(s))) {
-		fprintf(stderr, "*** plugin not found. \n");
+		fprintf(stderr, _("*** plugin not found. \n"));
 
 		return 1;
 	}
 
 	if (p->state != PLG_INSERTED) {
-		fprintf(stderr, "*** plugin didn't insert. \n");
+		fprintf(stderr, _("*** plugin didn't insert. \n"));
 
 		return 1;
 	}
@@ -144,7 +144,7 @@ int do_cmd_pins(int argc, char **argv) {
 
 	switch (argc) {
 	case 1:
-		fprintf(stderr, "plugin: ");
+		fprintf(stderr, _("plugin: "));
 		scanf("%s", name);
 
 		s = name;
@@ -156,12 +156,12 @@ int do_cmd_pins(int argc, char **argv) {
 		break;
 
 	default:
-		fprintf(stderr, "usage: -pins [plugin-name]\n");
+		fprintf(stderr, _("usage: -pins [plugin-name]\n"));
 		return 1;
 	}
 
 	if (!(p = find_plg(s))) {
-		fprintf(stderr, "*** plugin not found. \n");
+		fprintf(stderr, _("*** plugin not found. \n"));
 
 		return 1;
 	}
@@ -179,7 +179,7 @@ int register_msghook(hookfn_t hook, struct plugin *plg) {
 	/* unlike other things, we can have only one hook at the same moment. */
 
 	if (msg_hook) 
-		fprintf(stderr, "warning: the old hook removed. \n");
+		fprintf(stderr, _("warning: the old hook removed. \n"));
 		
 	plg->msg_hook = msg_hook = hook;
 	return 0;
@@ -188,7 +188,7 @@ int register_msghook(hookfn_t hook, struct plugin *plg) {
 
 int register_recvhook(hookfn_t hook, struct plugin *plg) {	
 	if (recv_hook) 
-		fprintf(stderr, "warning: the old hook removed. \n");
+		fprintf(stderr, _("warning: the old hook removed. \n"));
 		
 	plg->recv_hook = recv_hook = hook;
 	return 0;

+ 1 - 1
plugins/hello/hello.c

@@ -52,7 +52,7 @@ int do_cmd_hello(int argc, char **argv) {
 	plg_check_enabled();
 
 	if (argc != 1) {
-		fprintf(stderr, "usage: -hello\n");
+		fprintf(stderr, _("usage: -hello\n"));
 
 		return 1;
 	}

+ 1 - 1
plugins/m4/m4.c

@@ -63,7 +63,7 @@ int do_cmd_m4def(int argc, char **argv) {
 	plg_check_enabled();
 
 	if (argc != 1) {
-		fprintf(stderr, "usage: -m4def\n");
+		fprintf(stderr, _("usage: -m4def\n"));
 
 		return 1;
 	}

+ 1 - 1
plugins/script/script.c

@@ -93,7 +93,7 @@ int do_cmd_if(int argc, char **argv) {
 	plg_check_enabled();
 
 	if (argc < 4) {
-		fprintf(stderr, "usage: if condition then ... [else] [...]\n");
+		fprintf(stderr, _("usage: -if condition then ... else ...\n"));
 
 		return 1;
 	}

+ 323 - 11
po/zh_CN.po

@@ -1,22 +1,334 @@
-# Simplified Chinese translation for vcc. 
-# This file is distributed under the same license as the vcc package. 
-# Ruiyang Peng (aka intirain) <intirain@163.com>, 2022
-# 
-
+# Simplified Chinese translation for vcc.
+# This file is distributed under the same license as the vcc package.
+# Ruiyang Peng (AKA intirain) <intirain@163.com>, 2022.
+#
+#, fuzzy
 msgid ""
 msgstr ""
-"Project-Id-Version: vcc 1.17.1\n"
-"Report-Msgid-Bugs-To: intirain@163.com\n"
-"POT-Creation-Date: 2022-05-07 22:05\n"
-"PO-Revision-Date: 2022-05-07 22:05\n"
-"Last-Translator: Ruiyang Peng (intirain) <intirain@163.com>\n"
+"Project-Id-Version: vcc 1.18.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2022-05-08 15:46+0800\n"
+"PO-Revision-Date: 2022-05-08 15:46+0800\n"
+"Last-Translator: Ruiyang Peng <intirain@163.com>\n"
 "Language-Team: Chinese (simplified) <intirain@163.com>\n"
 "Language: zh_CN\n"
-"X-Bugs: Report translation errors to the Language-Team address. \n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=UTF-8\n"
 "Content-Transfer-Encoding: 8bit\n"
 
+#: cmd.c:210
+#, c-format
+msgid "usage: -help\n"
+msgstr "用法:-help\n"
+
+#: cmd.c:228
+#, c-format
+msgid "usage: -quit\n"
+msgstr "用法:-quit\n"
+
+#: cmd.c:233 main.c:418
+#, c-format
+msgid "bye. \n"
+msgstr "拜\n"
+
+#: cmd.c:244
+#, c-format
+msgid "usage -ls\n"
+msgstr "用法:-ls\n"
+
+#: cmd.c:281
+#, c-format
+msgid "usage: -lsse\n"
+msgstr "用法:-lsse\n"
+
+#: cmd.c:319
+#, c-format
+msgid "Name of new session: "
+msgstr "新会话名:"
+
+#: cmd.c:330
+#, c-format
+msgid "usage: -newse [session-name]\n"
+msgstr "用法:-newse [会话名]\n"
+
+#: cmd.c:334
+#, c-format
+msgid "Session create request sent. \n"
+msgstr "会话创建请求已发送\n"
+
+#: cmd.c:344
+#, c-format
+msgid "usage: -currs\n"
+msgstr "用法:-currs\n"
+
+#: cmd.c:349
+#, c-format
+msgid "Current session id: %d\n"
+msgstr "当前会话 ID:%d\n"
+
+#: cmd.c:360
+#, c-format
+msgid "Old session id: %d\n"
+msgstr "旧会话 ID: %d\n"
+
+#: cmd.c:361
+#, c-format
+msgid "New session id: "
+msgstr "新会话 ID:"
+
+#: cmd.c:370
+#, c-format
+msgid "usage: -swtch [session-number]\n"
+msgstr "用法:-swtch [会话 ID]\n"
+
+#: cmd.c:387
+#, c-format
+msgid "usage: -uinfo [user-name]\n"
+msgstr "用法:-uinfo [用户名]\n"
+
+#: cmd.c:394 cmd.c:473
+#, c-format
+msgid "username: "
+msgstr "用户名:"
+
+#: cmd.c:428
+#, c-format
+msgid "user not found. \n"
+msgstr "查无此人\n"
+
+#: cmd.c:438
+#, c-format
+msgid "Level of yourself: %d\n"
+msgstr "你的等级:%d\n"
+
+#: cmd.c:442
+#, c-format
+msgid "%s's info: \n"
+msgstr "%s 的信息:\n"
+
+#: cmd.c:443
+#, c-format
+msgid "\tscore\tlevel\n"
+msgstr "\t分数\t等级\n"
+
+#: cmd.c:456
+#, c-format
+msgid "usage: -lself\n"
+msgstr "用法:-lself\n"
+
+#: cmd.c:476
+#, c-format
+msgid "increment: "
+msgstr "增量:"
+
+#: cmd.c:485
+#, c-format
+msgid "argv[2] should be a number. \n"
+msgstr "argv[2] 应为整数\n"
+
+#: cmd.c:495
+#, c-format
+msgid "usage: -incr [usrname] && [increment]\n"
+msgstr "用法:-incr [用户名] [增量] 且两者同存或不存在\n"
+
+#: cmd.c:508
+#, c-format
+msgid "Sucessfully. \n"
+msgstr "成功\n"
+
+#: cmd.c:523
+#, c-format
+msgid "usage: -cqd\n"
+msgstr "用法:-cqd\n"
+
+#: cmd.c:541
+#, c-format
+msgid "Enter the user to ban: "
+msgstr "要办的用户名:"
+
+#: cmd.c:553
+#, c-format
+msgid "usage: -ban [user-name]\n"
+msgstr "用法:-ban [用户名]\n"
+
+#: cmd.c:560
+#, c-format
+msgid "User %s is already banned\n"
+msgstr "%s 已被办\n"
+
+#: cmd.c:588
+#, c-format
+msgid "Enter the user to unban: "
+msgstr "要取办的用户名:"
+
+#: cmd.c:599
+#, c-format
+msgid "usage: -unban [user-name]\n"
+msgstr "用法:-unban [用户名]\n"
+
+#: cmd.c:643
+#, c-format
+msgid "Please answer y / n\n"
+msgstr "请回答 y / n\n"
+
+#: cmd.c:665
+#, c-format
+msgid "Message: "
+msgstr "信息:"
+
+#: cmd.c:675
+#, c-format
+msgid "usage: -encry [message]\n"
+msgstr "用法:-encry [信息]\n"
+
+#: cmd.c:693
+#, c-format
+msgid "usage: -ml\n"
+msgstr "用法:-ml\n"
+
+#: cmd.c:704
+#, c-format
+msgid "Type 'finish' at the starting of a line to finish. \n"
+msgstr "在行首输入 'finish' 来结束多行输入。\n"
+
+#: include/vcc/plugin.h:64
+#, c-format
+msgid ""
+"*** this plugin didn't insert. please insert it by -pins and try it again. \n"
+msgstr "该插件未安装。请使用 -pins 安装后重试。\n"
+
+#: plugins/hello/hello.c:55
+#, c-format
+msgid "usage: -hello\n"
+msgstr "用法:-hello\n"
+
+#: plugins/script/script.c:96
+#, c-format
+msgid "usage: -if condition then ... else ...\n"
+msgstr "用法:-if 条件 then ... else ...\n"
+
+#: plugins/m4/m4.c:66
+#, c-format
+msgid "usage: -m4def\n"
+msgstr "用法:-m4def\n"
+
+#: plugins.c:60
+#, c-format
+msgid "usage: -pls\n"
+msgstr "用法:-pls\n"
+
+#: plugins.c:103 plugins.c:147
+#, c-format
+msgid "plugin: "
+msgstr "插件名:"
+
+#: plugins.c:114
+#, c-format
+msgid "usage: -prem [plugin-name]\n"
+msgstr "用法:-prem [插件名]\n"
+
+#: plugins.c:119 plugins.c:164
+#, c-format
+msgid "*** plugin not found. \n"
+msgstr "*** 无此插件\n"
+
+#: plugins.c:125
+#, c-format
+msgid "*** plugin didn't insert. \n"
+msgstr "*** 插件并未安装\n"
+
+#: plugins.c:159
+#, c-format
+msgid "usage: -pins [plugin-name]\n"
+msgstr "用法:-pins [插件名]\n"
+
+#: plugins.c:182 plugins.c:191
+#, c-format
+msgid "warning: the old hook removed. \n"
+msgstr "警告:旧钩子已被覆盖\n"
+
+#: crypt.c:69
+#, c-format
+msgid "key size: %d\n"
+msgstr "密钥长度:%d\n"
+
+#: crypt.c:70
+#, c-format
+msgid "block size: %d\n"
+msgstr "块长度:%d\n"
+
+#: crypt.c:71
+#, c-format
+msgid "maximum message size: %d\n"
+msgstr "最长信息:%d 字节\n"
+
+#: crypt.c:110
+#, c-format
+msgid "error: crypting disabled. \n"
+msgstr "错误:加密已禁用\n"
+
+#: crypt.c:129
+#, c-format
+msgid "error: crypt disabled. \n"
+msgstr "错误:加密已禁用\n"
+
+#: pretty.c:186
+#, c-format
+msgid "unknown command: "
+msgstr "无效命令:"
+
+#: pretty.c:218
+#, c-format
+msgid " %s sent CQD. \n"
+msgstr "%s 发送求救\n"
+
+#: vcc.c:83
+#, c-format
+msgid "invalid ip address. leave blank if you want to connect the default server. \n"
+msgstr "无效地址。如果要连接到默认服务器,请留空。\n"
+
+#: vcc.c:233
+#, c-format
+msgid "ready. \n"
+msgstr "就绪\n"
+
+#: vcc.c:236
+#, c-format
+msgid "login failed: wrong password or user doesn't exists. \n"
+msgstr "登录失败:密码错误或用户不存在。\n"
+
+#: vcc.c:237
+#, c-format
+msgid ""
+"if you haven't got an account on this server, ask the administrator and you "
+"can get one. \n"
+msgstr "如你没有这台服务器上的账号,请从管理员处获取一个。\n"
+
+#: main.c:152
+#, c-format
 msgid "login as: "
 msgstr "登录为:"
 
+#: main.c:156
+msgid "password: "
+msgstr "密码:"
+
+#: main.c:178
+#, c-format
+msgid "Password not specified. \n"
+msgstr "密码未指定。\n"
+
+#: main.c:191
+#, c-format
+msgid "warning: crypting disabled. \n"
+msgstr "警告:加密已禁用\n"
+
+#: main.c:311
+#, c-format
+msgid "Connected to server. \n"
+msgstr "已连接到服务器\n"
+
+#: main.c:380
+#, c-format
+msgid "Server closed. \n"
+msgstr "服务器断开\n"

+ 4 - 3
pretty.c

@@ -27,6 +27,7 @@
 #include <vcc/vcc.h>
 #include <vcc/version.h>
 #include <vcc/pretty.h>
+#include <vcc/plugin.h>
 
 extern int current_sid;
 extern char *usrname;
@@ -182,7 +183,7 @@ int pretty_prompt(char *usrname) {
 
 
 int pretty_unknown_cmd(char *s) {
-	fprintf(stderr, "unknown command: ");
+	fprintf(stderr, _("unknown command: "));
 
 	setcolor(stderr, curr_errmsg);
 	fputs(s, stderr);
@@ -198,7 +199,7 @@ int pretty_cmd_help(char *cmdname, char *descr) {
 	printf("%s:", cmdname);
 
 	setcolor(stdout, curr_helpmsg);
-	printf("\t%s\n", descr);
+	printf("\t%s\n", _(descr));
 
 	ansi_csi_ed(stdout);
 
@@ -214,7 +215,7 @@ int pretty_cqd(char *username) {
 
 	ansi_csi_ed(stdout);
 
-	printf(" %s sent CQD. \n", username);
+	printf(_(" %s sent CQD. \n"), username);
 
 	return 0;
 }

+ 7 - 6
vcc.c

@@ -36,6 +36,7 @@
 
 #include <klist.h>
 #include <vcc/vcc.h>
+#include <vcc/plugin.h>
 #include <vcc/version.h>
 
 #define clear_req(req) 	memset(req, 0, REQ_SIZE)
@@ -79,8 +80,8 @@ int init_socket(const char *server_addr, int server_port) {
 	server.sin_port = htons(server_port);
 
 	if (unlikely(!inet_aton(server_addr, &server.sin_addr))) {
-		fprintf(stderr, "invalid ip address. "
-				"leave blank if you want to connect the default server. \n");
+		fprintf(stderr, _("invalid ip address. "
+				"leave blank if you want to connect the default server. \n"));
 
 		exit(1);
 	}
@@ -229,12 +230,12 @@ int vcc_login_bh(struct vcc_request *req) {
 	}
 
 	if (ntohl(req->uid)) 
-		printf("ready. \n");
+		printf(_("ready. \n"));
 
 	else {
-		fprintf(stderr, "login failed: wrong password or user doesn't exists. \n");
-		fprintf(stderr, "if you haven't got an account on this server, ask the administrator " 
-				"and you can get one. \n");
+		fprintf(stderr, _("login failed: wrong password or user doesn't exists. \n"));
+		fprintf(stderr, _("if you haven't got an account on this server, ask the administrator " 
+				"and you can get one. \n"));
 
 		exit(1);
 	}