$Log$
+Revision 621.29 2005/08/22 21:22:00 ajc
+* vcard_edit.c webcit.c webserver.c who.c : i18n
+* This should complete the internationalization of the entire WebCit
+ package. Testing must be done, and then of course we must have someone
+ do a translation so we can see if this thing works.
+
Revision 621.28 2005/08/22 20:27:26 ajc
* userlist.c: i18n
* vcard.c: minor change to comments in code
1998-12-03 Nathan Bryant <bryant@cs.usm.maine.edu>
* webserver.c: warning fix
+
/*
* $Id$
*
- * Handles editing of vCard objects.
+ * Handles on-screen editing of vCard objects.
*
*/
#include "webcit.h"
#include "vcard.h"
-
/* Edit the vCard component of a MIME message. Supply the message number
* and MIME part number to fetch. Or, specify -1 for the message number
* to start with a blank card.
serv_puts(buf);
serv_getln(buf, sizeof buf);
if (buf[0] != '1') {
- convenience_page("770000", "Error", &buf[4]);
+ convenience_page("770000", _("Error"), &buf[4]);
return;
}
while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
wprintf("<div id=\"banner\">\n"
"<TABLE WIDTH=100%% BORDER=0 BGCOLOR=\"#444455\"><TR><TD>"
"<SPAN CLASS=\"titlebar\">"
- "<img src=\"/static/savecontact_48x.gif\">"
- "Edit contact information"
- "</SPAN>"
+ "<img src=\"/static/savecontact_48x.gif\">");
+ wprintf(_("Edit contact information"));
+ wprintf("</SPAN>"
"</TD></TR></TABLE>\n"
"</div>\n<div id=\"content\">\n"
);
"<table border=0 width=100%% bgcolor=\"#ffffff\"><tr><td>\n");
wprintf("<TABLE border=0><TR>"
- "<TD>Prefix</TD>"
- "<TD>First</TD>"
- "<TD>Middle</TD>"
- "<TD>Last</TD>"
- "<TD>Suffix</TD></TR>\n");
+ "<TD>%s</TD>"
+ "<TD>%s</TD>"
+ "<TD>%s</TD>"
+ "<TD>%s</TD>"
+ "<TD>%s</TD></TR>\n",
+ _("Prefix"), _("First"), _("Middle"), _("Last"), _("Suffix")
+ );
wprintf("<TR><TD><INPUT TYPE=\"text\" NAME=\"prefix\" "
"VALUE=\"%s\" MAXLENGTH=\"5\" SIZE=\"5\"></TD>",
prefix);
wprintf("<table border=0 width=100%% bgcolor=\"#dddddd\">");
wprintf("<tr><td>");
- wprintf("Title:<br>"
+ wprintf(_("Title:"));
+ wprintf("<br>"
"<INPUT TYPE=\"text\" NAME=\"title\" "
"VALUE=\"%s\" MAXLENGTH=\"40\"><br><br>\n",
title
);
- wprintf("Organization:<br>"
+ wprintf(_("Organization:"));
+ wprintf("<br>"
"<INPUT TYPE=\"text\" NAME=\"org\" "
"VALUE=\"%s\" MAXLENGTH=\"40\"><br><br>\n",
org
wprintf("</td><td>");
wprintf("<table border=0>");
- wprintf("<tr><td>PO box:</td><td>"
+ wprintf("<tr><td>");
+ wprintf(_("PO box:"));
+ wprintf("</td><td>"
"<INPUT TYPE=\"text\" NAME=\"pobox\" "
"VALUE=\"%s\" MAXLENGTH=\"29\"></td></tr>\n",
pobox);
- wprintf("<tr><td>Address:</td><td>"
+ wprintf("<tr><td>");
+ wprintf(_("Address:"));
+ wprintf("</td><td>"
"<INPUT TYPE=\"text\" NAME=\"extadr\" "
"VALUE=\"%s\" MAXLENGTH=\"29\"></td></tr>\n",
extadr);
"<INPUT TYPE=\"text\" NAME=\"street\" "
"VALUE=\"%s\" MAXLENGTH=\"29\"></td></tr>\n",
street);
- wprintf("<tr><td>City:</td><td>"
+ wprintf("<tr><td>");
+ wprintf(_("City:"));
+ wprintf("</td><td>"
"<INPUT TYPE=\"text\" NAME=\"city\" "
"VALUE=\"%s\" MAXLENGTH=\"29\"></td></tr>\n",
city);
- wprintf("<tr><td>State:</td><td>"
+ wprintf("<tr><td>");
+ wprintf(_("State:"));
+ wprintf("</td><td>"
"<INPUT TYPE=\"text\" NAME=\"state\" "
"VALUE=\"%s\" MAXLENGTH=\"2\"></td></tr>\n",
state);
- wprintf("<tr><td>ZIP code:</td><td>"
+ wprintf("<tr><td>");
+ wprintf(_("ZIP code:"));
+ wprintf("</td><td>"
"<INPUT TYPE=\"text\" NAME=\"zipcode\" "
"VALUE=\"%s\" MAXLENGTH=\"10\"></td></tr>\n",
zipcode);
- wprintf("<tr><td>Country:</td><td>"
+ wprintf("<tr><td>");
+ wprintf(_("Country:"));
+ wprintf("</td><td>"
"<INPUT TYPE=\"text\" NAME=\"country\" "
"VALUE=\"%s\" MAXLENGTH=\"29\" WIDTH=\"5\"></td></tr>\n",
country);
wprintf("</table>\n");
- wprintf("<TABLE BORDER=0><TR><TD>Home telephone:</TD>"
+ wprintf("<TABLE BORDER=0><TR><TD>");
+ wprintf(_("Home telephone:"));
+ wprintf("</TD>"
"<TD><INPUT TYPE=\"text\" NAME=\"hometel\" "
"VALUE=\"%s\" MAXLENGTH=\"29\"></TD>\n",
hometel);
- wprintf("<TD>Work telephone:</TD>"
+ wprintf("<TD>");
+ wprintf(_("Work telephone:"));
+ wprintf("</TD>"
"<TD><INPUT TYPE=\"text\" NAME=\"worktel\" "
"VALUE=\"%s\" MAXLENGTH=\"29\"></TD></TR></TABLE>\n",
worktel);
wprintf("<tr><td>");
wprintf("<TABLE border=0><TR>"
- "<TD VALIGN=TOP>Primary Internet e-mail address<br />"
+ "<TD VALIGN=TOP>");
+ wprintf(_("Primary Internet e-mail address"));
+ wprintf("<br />"
"<INPUT TYPE=\"text\" NAME=\"primary_inetemail\" "
"SIZE=40 MAXLENGTH=40 VALUE=\"");
escputs(primary_inetemail);
wprintf("\"><br />"
- "</TD><TD VALIGN=TOP>"
- "Internet e-mail aliases<br />"
+ "</TD><TD VALIGN=TOP>");
+ wprintf(_("Internet e-mail aliases"));
+ wprintf("<br />"
"<TEXTAREA NAME=\"other_inetemail\" ROWS=5 COLS=40 WIDTH=40>");
escputs(other_inetemail);
wprintf("</TEXTAREA></TD></TR></TABLE>\n");
wprintf("\">\n");
wprintf("<CENTER>\n"
- "<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"OK\">"
+ "<INPUT TYPE=\"submit\" NAME=\"ok_button\" VALUE=\"%s\">"
" "
- "<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Cancel\">"
- "</CENTER></FORM>\n"
+ "<INPUT TYPE=\"submit\" NAME=\"cancel_button\" VALUE=\"%s\">"
+ "</CENTER></FORM>\n",
+ _("Save changes"),
+ _("Cancel")
);
wprintf("</td></tr></table></div>\n");
char buf[SIZ];
int i;
- if (strcmp(bstr("sc"), "OK")) {
+ if (strlen(bstr("ok_button")) == 0) {
readloop("readnew");
return;
}
wprintf("Location: %s\r\n", whichpage);
wprintf("URI: %s\r\n", whichpage);
wprintf("Content-type: text/html; charset=utf-8\r\n\r\n");
- wprintf("<html><body>\n");
- wprintf("you really want to be <A HREF=\"%s\">here</A> now\n",
- whichpage);
+ wprintf("<html><body>");
+ wprintf("Go <A HREF=\"%s\">here</A>.", whichpage);
wprintf("</body></html>\n");
}
free(xferbuf);
} else {
-
/* Instead of an ugly 404, send a 1x1 transparent GIF
* when there's no such image on the server.
*/
output_static("blank.gif");
-
- /*
- wprintf("HTTP/1.0 404 %s\n", &buf[4]);
- output_headers(0, 0, 0, 0, 0, 0, 0);
- wprintf("Content-Type: text/plain\r\n"
- "\r\n"
- "Error retrieving image: %s\n",
- &buf[4]
- );
- */
-
}
}
/*
+ * Generic function to output an arbitrary MIME part from an arbitrary
+ * message number on the server.
*/
void output_mimepart()
{
output_headers(0, 0, 0, 0, 0, 0, 0);
wprintf("Content-Type: text/plain\r\n");
wprintf("\r\n");
- wprintf("Error retrieving part: %s\n", &buf[4]);
+ wprintf(_("An error occurred while retrieving this part: %s\n"), &buf[4]);
}
}
void offer_start_page(void) {
wprintf("<A HREF=\"/change_start_page?startpage=");
urlescputs(WC->this_page);
- wprintf("\">"
- "<FONT SIZE=-2 COLOR=\"#AAAAAA\">Make this my start page</FONT>"
- "</A>"
- );
+ wprintf("\"><FONT SIZE=-2 COLOR=\"#AAAAAA\">");
+ wprintf(_("Make this my start page"));
+ wprintf("</FONT></A>");
}
if (bstr("startpage") == NULL) {
safestrncpy(WC->ImportantMessage,
- "startpage set to null",
+ _("You no longer have a start page selected."),
sizeof WC->ImportantMessage);
display_main_menu();
return;
wprintf("HTTP/1.0 401 Authorization Required\r\n");
wprintf("WWW-Authenticate: Basic realm=\"\"\r\n", serv_info.serv_humannode);
wprintf("Content-Type: text/html\r\n\r\n");
- wprintf("<h1>Authorization Required</h1>\r\n");
- wprintf("The resource you requested requires a valid username and password.");
- wprintf("I could not log you in: %s\n", message);
+ wprintf("<h1>");
+ wprintf(_("Authorization Required"));
+ wprintf("</h1>\r\n");
+ wprintf(_("The resource you requested requires a valid username and password. "
+ "You could not be logged in: %s\n"), message);
wDumpContent(0);
}
locate_host(browser_host, WC->http_sock);
get_serv_info(browser_host, user_agent);
if (serv_info.serv_rev_level < MINIMUM_CIT_VERSION) {
- wprintf("You are connected to a Citadel "
- "server running Citadel %d.%02d;\nin "
- "order to run this version of WebCit "
+ wprintf(_("You are connected to a Citadel "
+ "server running Citadel %d.%02d. \n"
+ "In order to run this version of WebCit "
"you must also have Citadel %d.%02d or"
- " newer.\n\n\n",
+ " newer.\n\n\n"),
serv_info.serv_rev_level / 100,
serv_info.serv_rev_level % 100,
MINIMUM_CIT_VERSION / 100,
} else if (!strcasecmp(action, "editroom")) {
editroom();
} else if (!strcasecmp(action, "display_editinfo")) {
- display_edit("Room info", "EINF 0", "RINF", "/editinfo", 1);
+ display_edit(_("Room info"), "EINF 0", "RINF", "/editinfo", 1);
} else if (!strcasecmp(action, "editinfo")) {
- save_edit("Room info", "EINF 1", 1);
+ save_edit(_("Room info"), "EINF 1", 1);
} else if (!strcasecmp(action, "display_editbio")) {
sprintf(buf, "RBIO %s", WC->wc_username);
- display_edit("Your bio", "NOOP", buf, "editbio", 3);
+ display_edit(_("Your bio"), "NOOP", buf, "editbio", 3);
} else if (!strcasecmp(action, "editbio")) {
- save_edit("Your bio", "EBIO", 0);
+ save_edit(_("Your bio"), "EBIO", 0);
} else if (!strcasecmp(action, "confirm_move_msg")) {
confirm_move_msg();
} else if (!strcasecmp(action, "delete_room")) {
} else if (!strcasecmp(action, "validate")) {
validate();
} else if (!strcasecmp(action, "display_editpic")) {
- display_graphics_upload("your photo",
+ display_graphics_upload(_("your photo"),
"UIMG 0|_userpic_",
"/editpic");
} else if (!strcasecmp(action, "editpic")) {
do_graphics_upload("UIMG 1|_userpic_");
} else if (!strcasecmp(action, "display_editroompic")) {
- display_graphics_upload("the icon for this room",
+ display_graphics_upload(_("the icon for this room"),
"UIMG 0|_roompic_",
"/editroompic");
} else if (!strcasecmp(action, "editroompic")) {
} else if (!strcasecmp(action, "display_editfloorpic")) {
sprintf(buf, "UIMG 0|_floorpic_|%s",
bstr("which_floor"));
- display_graphics_upload("the icon for this floor",
+ display_graphics_upload(_("the icon for this floor"),
buf,
"/editfloorpic");
} else if (!strcasecmp(action, "editfloorpic")) {
set_preferences();
} else if (!strcasecmp(action, "diagnostics")) {
output_headers(1, 1, 1, 0, 0, 0, 0);
-
- wprintf("You're in session %d<hr />\n", WC->wc_session);
+ wprintf("Session: %d<hr />\n", WC->wc_session);
wprintf("Command: <br /><PRE>\n");
escputs(cmd);
wprintf("</PRE><hr />\n");
}
/* Tell 'em who's in da house */
lprintf(1, SERVER "\n");
- lprintf(1, _("Copyright (C) 1996-2005 by the Citadel development team.\n"
+ lprintf(1, "Copyright (C) 1996-2005 by the Citadel development team.\n"
"This software is distributed under the terms of the "
- "GNU General Public License.\n\n")
+ "GNU General Public License.\n\n"
);
- lprintf(9, _("Changing directory to %s\n"), webcitdir);
+ lprintf(9, "Changing directory to %s\n", webcitdir);
if (chdir(webcitdir) != 0) {
perror("chdir");
}
wprintf("<table border=\"0\" cellspacing=\"0\" width=\"100%%\" bgcolor=\"#FFFFFF\">"
"<tr>\n");
wprintf("<th colspan=\"3\"> </th>\n");
- wprintf("<th>User Name</th>\n");
- wprintf("<th>Room</th>");
- wprintf("<th>From host</th>\n</tr>\n");
+ wprintf("<th>%s</th>\n", _("User name"));
+ wprintf("<th>%s</th>", _("Room"));
+ wprintf("<th>%s</th>\n</tr>\n", _("From host"));
serv_puts("TIME");
serv_getln(buf, sizeof buf);
if ((WC->is_aide) &&
(sess != WC->ctdl_pid)) {
wprintf(" <a href=\"/terminate_session?which_session=%d", sess);
- wprintf("\" onClick=\"return ConfirmKill();\" "
- ">[kill]</a>");
+ wprintf("\" onClick=\"return ConfirmKill();\">%s</a>", _("(kill)"));
}
if (sess == WC->ctdl_pid) {
- wprintf(" <a href=\"/edit_me\" "
- ">[edit]</a>");
+ wprintf(" <a href=\"/edit_me\">%s</a>", _("(edit)"));
}
wprintf("</td>");
wprintf(" "
"<img align=\"middle\" "
"src=\"/static/inactiveuser_24x.gif\" "
- "alt=\"[idle]\" border=\"0\" />");
+ "alt=\"(idle)\" border=\"0\" />");
}
else {
wprintf(" "
"<img align=\"middle\" "
"src=\"/static/activeuser_24x.gif\" "
- "alt=\"[active]\" border=\"0\" />");
+ "alt=\"(active)\" border=\"0\" />");
}
wprintf("</td>\n<td>");
*/
void who(void)
{
- /*
- output_headers(1, 1, 2, 0, 1, 0, 0); old refresh30 version
- */
+ char title[256];
+
output_headers(1, 1, 2, 0, 0, 0, 0);
wprintf("<script type=\"text/javascript\">\n"
"function ConfirmKill() { \n"
- "return confirm('Do you really want to kill this session?');\n"
+ "return confirm('%s');\n"
"}\n"
- "</script>\n"
+ "</script>\n", _("Do you really want to kill this session?")
);
wprintf("<div id=\"banner\">\n");
"ALIGN=MIDDLE "
">");
/* "onLoad=\"javascript:bodyOnLoad()\" " */
- wprintf("<SPAN CLASS=\"titlebar\"> Users currently on ");
- escputs(serv_info.serv_humannode);
+ wprintf("<SPAN CLASS=\"titlebar\"> ");
+
+ snprintf(title, sizeof title, _("Users currently on %s"), serv_info.serv_humannode);
+ escputs(title);
+
wprintf("</SPAN></TD><TD ALIGN=RIGHT>");
offer_start_page();
wprintf("</TD></TR></TABLE>\n");
who_inner_div(); /* Actual data handled by another function */
wprintf("</div>\n");
- wprintf("<div id=\"instructions\" align=center>"
- "Click on a name to read user info. Click on "
- "<IMG ALIGN=MIDDLE SRC=\"/static/citadelchat_16x.gif\" "
- "ALT=\"(p)\" BORDER=0>"
- " to send an instant message to that user.</div>\n");
+ wprintf("<div id=\"instructions\" align=center>");
+ wprintf(_("Click on a name to read user info. Click on %s "
+ "to send an instant message to that user."),
+ "<img align=\"middle\" src=\"/static/citadelchat_16x.gif\" alt=\"(p)\" border=\"0\">"
+ );
+ wprintf("</div>\n");
/* JavaScript to make the ajax refresh happen:
* 1. Register the request 'getWholist' which calls the WebCit action 'who_inner_html'
* 2. Register the 'fix_scrollbar_bug' div as one we're interested in ajaxifying
* 3. setInterval to make the ajax refresh happen every 30 seconds. The random number
- * in the request is there to prevent IE from caching the XML even though it's been
- * told not to. Die, Microsoft, Die.
+ * in the request is there to prevent the eternally moronic Internet Explorer from
+ * caching the XML even though it's been told not to.
*/
wprintf(
-" \n"
-" <script type=\"text/javascript\"> \n"
-" ajaxEngine.registerRequest('getWholist', 'who_inner_html');\n"
-" ajaxEngine.registerAjaxElement('fix_scrollbar_bug'); \n"
-" setInterval(\"ajaxEngine.sendRequest('getWholist', 'junk='+Math.random());\", 30000); \n"
-"</script>\n"
+ "<script type=\"text/javascript\"> \n"
+ " ajaxEngine.registerRequest('getWholist', 'who_inner_html'); \n"
+ " ajaxEngine.registerAjaxElement('fix_scrollbar_bug'); \n"
+ " setInterval(\"ajaxEngine.sendRequest('getWholist', 'junk='+Math.random());\", 30000); \n"
+ "</script> \n"
);
-
wDumpContent(1);
}
{
char buf[SIZ];
- if (!strcasecmp(bstr("sc"), "Change room name")) {
+ if (strlen(bstr("change_room_name_button")) > 0) {
serv_printf("RCHG %s", bstr("fake_roomname"));
serv_getln(buf, sizeof buf);
http_redirect("/who");
- } else if (!strcasecmp(bstr("sc"), "Change host name")) {
+ } else if (strlen(bstr("change_host_name_button")) > 0) {
serv_printf("HCHG %s", bstr("fake_hostname"));
serv_getln(buf, sizeof buf);
http_redirect("/who");
- } else if (!strcasecmp(bstr("sc"), "Change user name")) {
+ } else if (strlen(bstr("change_user_name_button")) > 0) {
serv_printf("UCHG %s", bstr("fake_username"));
serv_getln(buf, sizeof buf);
http_redirect("/who");
- } else if (!strcasecmp(bstr("sc"), "Cancel")) {
+ } else if (strlen(bstr("cancel_button")) > 0) {
http_redirect("/who");
} else {
-
output_headers(1, 1, 0, 0, 0, 0, 0);
wprintf("<div id=\"banner\">\n");
wprintf("<TABLE WIDTH=100%% BORDER=0 BGCOLOR=\"#444455\"><TR><TD>");
wprintf("<SPAN CLASS=\"titlebar\">");
- wprintf("Edit your session display");
+ wprintf(_("Edit your session display"));
wprintf("</SPAN></TD></TR></TABLE>\n");
wprintf("</div>\n<div id=\"content\">\n");
- wprintf("This screen allows you to change the way your\n");
- wprintf("session appears in the 'Who is online' listing.\n");
- wprintf("To turn off any 'fake' name you've previously\n");
- wprintf("set, simply click the appropriate 'change' button\n");
- wprintf("without typing anything in the corresponding box.\n");
+ wprintf(_("This screen allows you to change the way your "
+ "session appears in the 'Who is online' listing. "
+ "To turn off any 'fake' name you've previously "
+ "set, simply click the appropriate 'change' button "
+ "without typing anything in the corresponding box. "));
wprintf("<br />\n");
wprintf("<FORM METHOD=\"POST\" ACTION=\"/edit_me\">\n");
wprintf("<TABLE border=0 width=100%%>\n");
- wprintf("<TR><TD><B>Room name:</B></TD>\n<TD>");
+ wprintf("<TR><TD><B>");
+ wprintf(_("Room name:"));
+ wprintf("</B></TD>\n<TD>");
wprintf("<INPUT TYPE=\"text\" NAME=\"fake_roomname\" MAXLENGTH=\"64\">\n");
wprintf("</TD>\n<TD ALIGN=center>");
- wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Change room name\">");
+ wprintf("<INPUT TYPE=\"submit\" NAME=\"change_room_name_button\" VALUE=\"%s\">",
+ _("Change room name"));
wprintf("</TD>\n</TR>\n");
- wprintf("<TR><TD><B>Host name:</B></TD><TD>");
+ wprintf("<TR><TD><B>");
+ wprintf(_("Host name:"));
+ wprintf("</B></TD><TD>");
wprintf("<INPUT TYPE=\"text\" NAME=\"fake_hostname\" MAXLENGTH=\"64\">\n");
wprintf("</TD>\n<TD ALIGN=center>");
- wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Change host name\">");
+ wprintf("<INPUT TYPE=\"submit\" NAME=\"change_host_name_button\" VALUE=\"%s\">",
+ _("Change host name"));
wprintf("</TD>\n</TR>\n");
if (WC->is_aide) {
- wprintf("<TR><TD><B>User name:</B></TD><TD>");
+ wprintf("<TR><TD><B>");
+ wprintf(_("User name:"));
+ wprintf("</B></TD><TD>");
wprintf("<INPUT TYPE=\"text\" NAME=\"fake_username\" MAXLENGTH=\"64\">\n");
wprintf("</TD>\n<TD ALIGN=center>");
- wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Change user name\">");
+ wprintf("<INPUT TYPE=\"submit\" NAME=\"change_user_name_button\" VALUE=\"%s\">",
+ _("Change user name"));
wprintf("</TD>\n</TR>\n");
}
wprintf("<TR><TD> </TD><TD> </TD><TD ALIGN=center>");
- wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Cancel\">");
+ wprintf("<INPUT TYPE=\"submit\" NAME=\"cancel_button\" VALUE=\"%s\">",
+ _("Cancel"));
wprintf("</TD></TR></TABLE>\n");
wprintf("</FORM></CENTER>\n");
wDumpContent(1);