From 635dff752869d8284386d9c4b84a87840868ecd6 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Fri, 3 Oct 2003 01:42:53 +0000 Subject: Moving towards better i18n support in SWAT. This commit contains a bunch of updates to bug 413 from Monyo: 1) pick up proper strings to call msg strings for example to add strings in wizard menu in web/swat.c, web/statuspage.c and param/loadparm.c. 2) define N_() macro in include/intl.h to pick up some strings in param/loadparm.c 3) quote all name and value tag with '"' For example in swat.c:720 the "Edit Parameter Values" string is displayd only as "Edit" because value tag is not quoted like: value=Edit Parameter Values These tags should be quoted though it sometimes works well without quotation. 4) modify the msg strings not to contain HTML tags or other non-message strings. For example dprintf(_("test\n")); is modified to dprintf("%s\n", _("test")); (This used to be commit 351d16956d8125bc689ca84adcb71e0a57d6b7cc) --- source3/web/swat.c | 139 +++++++++++++++++++++++++++-------------------------- 1 file changed, 72 insertions(+), 67 deletions(-) (limited to 'source3/web/swat.c') diff --git a/source3/web/swat.c b/source3/web/swat.c index 2b2686cc5a..f4046b46a2 100644 --- a/source3/web/swat.c +++ b/source3/web/swat.c @@ -114,7 +114,8 @@ static int include_html(const char *fname) fd = web_open(fname, O_RDONLY, 0); if (fd == -1) { - d_printf("ERROR: Can't open %s\n", fname); + d_printf(_("ERROR: Can't open %s"), fname); + d_printf("\n"); return 0; } @@ -261,7 +262,7 @@ static void show_parameter(int snum, struct parm_struct *parm) break; case P_INTEGER: - d_printf("", make_parm_name(parm->label), *(int *)ptr); + d_printf("", make_parm_name(parm->label), *(int *)ptr); d_printf("", _("Set Default"), make_parm_name(parm->label),(int)(parm->def.ivalue)); break; @@ -404,7 +405,8 @@ static int save_reload(int snum) f = sys_fopen(dyn_CONFIGFILE,"w"); if (!f) { - d_printf("failed to open %s for writing\n", dyn_CONFIGFILE); + d_printf(_("failed to open %s for writing"), dyn_CONFIGFILE); + d_printf("\n"); return 0; } @@ -426,7 +428,8 @@ static int save_reload(int snum) lp_killunused(NULL); if (!load_config(False)) { - d_printf("Can't reload %s\n", dyn_CONFIGFILE); + d_printf(_("Can't reload %s"), dyn_CONFIGFILE); + d_printf("\n"); return 0; } iNumNonAutoPrintServices = lp_numservices(); @@ -495,7 +498,8 @@ static void show_main_buttons(void) char *p; if ((p = cgi_user_name()) && strcmp(p, "root")) { - d_printf(_("Logged in as %s

\n"), p); + d_printf(_("Logged in as %s"), p); + d_printf("

\n"); } image_link(_("Home"), "", "images/home.gif"); @@ -519,10 +523,10 @@ static void show_main_buttons(void) ****************************************************************************/ static void ViewModeBoxes(int mode) { - d_printf("

%s\n", _("Current View Is:  \n")); - d_printf("Basic\n", (mode == 0) ? "checked" : ""); - d_printf("Advanced\n", (mode == 1) ? "checked" : ""); - d_printf("
%s\n", _("Change View To: ")); + d_printf("

%s: \n", _("Current View Is")); + d_printf("%s\n", ((mode == 0) ? "checked" : ""), _("Basic")); + d_printf("%s\n", ((mode == 1) ? "checked" : ""), _("Advanced")); + d_printf("
%s: \n", _("Change View To")); d_printf("\n", _("Basic")); d_printf("\n", _("Advanced")); d_printf("


\n"); @@ -572,7 +576,7 @@ static void wizard_params_page(void) /* Here we first set and commit all the parameters that were selected in the previous screen. */ - d_printf("

Wizard Parameter Edit Page

\n"); + d_printf("

%s

\n", _("Wizard Parameter Edit Page")); if (cgi_variable("Commit")) { commit_parameters(GLOBAL_SECTION_SNUM); @@ -601,7 +605,7 @@ static void rewritecfg_file(void) { commit_parameters(GLOBAL_SECTION_SNUM); save_reload(0); - d_printf("

Note: smb.conf %s

\n", _("file has been read and rewritten")); + d_printf("

%s

\n", _("Note: smb.conf file has been read and rewritten")); } /**************************************************************************** @@ -709,37 +713,36 @@ static void wizard_page(void) role = lp_server_role(); /* Here we go ... */ - d_printf("

Samba Configuration Wizard

\n"); + d_printf("

%s

\n", _("Samba Configuration Wizard")); d_printf("
\n"); if (have_write_access) { - d_printf(_("The \"Rewrite smb.conf file\" button will clear the smb.conf file of all default values and of comments.\n")); - d_printf(_("The same will happen if you press the commit button.")); - d_printf("

"); + d_printf("%s\n", _("The \"Rewrite smb.conf file\" button will clear the smb.conf file of all default values and of comments.")); + d_printf("%s", _("The same will happen if you press the commit button.")); + d_printf("

\n"); d_printf("
"); - d_printf("   ",_("Rewrite smb.conf file")); - d_printf("   ",_("Commit")); - d_printf("", _("Edit Parameter Values")); - d_printf("
"); + d_printf("   ",_("Rewrite smb.conf file")); + d_printf("   ",_("Commit")); + d_printf("", _("Edit Parameter Values")); + d_printf("\n"); } d_printf("
"); d_printf("
"); - d_printf("\n", "Server Type: "); - d_printf("", (role == ROLE_STANDALONE) ? "checked" : ""); - d_printf("", (role == ROLE_DOMAIN_MEMBER) ? "checked" : ""); - d_printf("", (role == ROLE_DOMAIN_PDC) ? "checked" : ""); - d_printf(""); + d_printf("\n", _("Server Type")); + d_printf("", ((role == ROLE_STANDALONE) ? "checked" : ""), _("Stand Alone")); + d_printf("", ((role == ROLE_DOMAIN_MEMBER) ? "checked" : ""), _("Domain Member")); + d_printf("", ((role == ROLE_DOMAIN_PDC) ? "checked" : ""), _("Domain Controller")); + d_printf("\n"); if (role == ROLE_DOMAIN_BDC) { - d_printf(""); + d_printf("\n", _("Unusual Type in smb.conf - Please Select New Mode")); } - d_printf("\n", "Configure WINS As: "); - d_printf("", (winstype == 0) ? "checked" : ""); - d_printf("", (winstype == 1) ? "checked" : ""); - d_printf("", (winstype == 2) ? "checked" : ""); - d_printf("\n"); - - d_printf("\n", _("Configure WINS As")); + d_printf("", ((winstype == 0) ? "checked" : ""), _("Not Used")); + d_printf("", ((winstype == 1) ? "checked" : ""), _("Server for client use")); + d_printf("", ((winstype == 2) ? "checked" : ""), _("Client of another WINS server")); + d_printf("\n"); + d_printf(""); + d_printf("\">\n"); if (winstype == 3) { - d_printf(""); - d_printf(""); + d_printf("\n", _("Error: WINS Server Mode and WINS Support both set in smb.conf")); + d_printf("\n", _("Please Select desired WINS mode above.")); } - d_printf("\n","Expose Home Directories: "); - d_printf("", (have_home == -1) ? "" : "checked "); - d_printf("", (have_home == -1 ) ? "checked" : ""); - d_printf(""); + d_printf("\n", _("Expose Home Directories")); + d_printf("", (have_home == -1) ? "" : "checked "); + d_printf("", (have_home == -1 ) ? "checked" : ""); + d_printf("\n"); /* Enable this when we are ready .... - * d_printf("\n","Is Print Server: "); - * d_printf(""); - * d_printf(""); - * d_printf(""); + * d_printf("\n", _("Is Print Server")); + * d_printf(""); + * d_printf(""); + * d_printf("\n"); */ d_printf("
%s Stand Alone  Domain Member  Domain Controller 
%s:  %s  %s  %s 
Unusual Type in smb.conf - Please Select New Mode
%s
%s Not Used  Server for client use  Client of another WINS server 
Remote WINS Server %s:  %s  %s  %s 
%s 
Error: WINS Server Mode and WINS Support both set in smb.conf
Please Select desired WINS mode above.
%s
%s
%s Yes No
%s:  Yes No
%s Yes No
%s:  Yes No
"); d_printf("
"); - d_printf(_("The above configuration options will set multiple parameters and will generally assist with rapid Samba deployment.\n")); + d_printf("%s\n", _("The above configuration options will set multiple parameters and will generally assist with rapid Samba deployment.")); d_printf("
\n"); } @@ -938,7 +941,7 @@ static BOOL change_password(const char *remote_machine, const char *user_name, pstring msg_str; if (demo_mode) { - d_printf("%s

", _("password change in demo mode rejected\n")); + d_printf("%s\n

", _("password change in demo mode rejected")); return False; } @@ -951,7 +954,7 @@ static BOOL change_password(const char *remote_machine, const char *user_name, } if(!initialize_password_db(True)) { - d_printf("Can't setup password database vectors.\n

"); + d_printf("%s\n

", _("Can't setup password database vectors.")); return False; } @@ -977,7 +980,7 @@ static void chg_passwd(void) /* Make sure users name has been specified */ if (strlen(cgi_variable(SWAT_USER)) == 0) { - d_printf("

%s", _(" Must specify \"User Name\" \n")); + d_printf("

%s\n", _(" Must specify \"User Name\" ")); return; } @@ -993,26 +996,26 @@ static void chg_passwd(void) */ if (((!am_root()) && (strlen( cgi_variable(OLD_PSWD)) <= 0)) || ((cgi_variable(CHG_R_PASSWD_FLAG)) && (strlen( cgi_variable(OLD_PSWD)) <= 0))) { - d_printf("

%s", _(" Must specify \"Old Password\" \n")); + d_printf("

%s\n", _(" Must specify \"Old Password\" ")); return; } /* If changing a users password on a remote hosts we have to know what host */ if ((cgi_variable(CHG_R_PASSWD_FLAG)) && (strlen( cgi_variable(RHOST)) <= 0)) { - d_printf("

%s", _(" Must specify \"Remote Machine\" \n")); + d_printf("

%s\n", _(" Must specify \"Remote Machine\" ")); return; } /* Make sure new passwords have been specified */ if ((strlen( cgi_variable(NEW_PSWD)) <= 0) || (strlen( cgi_variable(NEW2_PSWD)) <= 0)) { - d_printf("

%s", _(" Must specify \"New, and Re-typed Passwords\" \n")); + d_printf("

%s\n", _(" Must specify \"New, and Re-typed Passwords\" ")); return; } /* Make sure new passwords was typed correctly twice */ if (strcmp(cgi_variable(NEW_PSWD), cgi_variable(NEW2_PSWD)) != 0) { - d_printf("

%s", _(" Re-typed password didn't match new password\n")); + d_printf("

%s\n", _(" Re-typed password didn't match new password ")); return; } } @@ -1042,9 +1045,11 @@ static void chg_passwd(void) if(local_flags == 0) { d_printf("

"); if (rslt == True) { - d_printf(_(" The passwd for '%s' has been changed. \n"), cgi_variable(SWAT_USER)); + d_printf(_(" The passwd for '%s' has been changed."), cgi_variable(SWAT_USER)); + d_printf("\n"); } else { - d_printf(_(" The passwd for '%s' has NOT been changed. \n"), cgi_variable(SWAT_USER)); + d_printf(_(" The passwd for '%s' has NOT been changed."), cgi_variable(SWAT_USER)); + d_printf("\n"); } } @@ -1077,15 +1082,15 @@ static void passwd_page(void) /* * Create all the dialog boxes for data collection */ - d_printf("%s\n", _(" User Name : ")); + d_printf(" %s : \n", _("User Name")); d_printf(" \n", SWAT_USER, new_name); if (!am_root()) { - d_printf("%s\n", _(" Old Password : ")); + d_printf(" %s : \n", _("Old Password")); d_printf(" \n",OLD_PSWD); } - d_printf("%s\n", _(" New Password : ")); + d_printf(" %s : \n", _("New Password")); d_printf("\n",NEW_PSWD); - d_printf("%s\n", _(" Re-type New Password : ")); + d_printf(" %s : \n", _("Re-type New Password")); d_printf("\n",NEW2_PSWD); d_printf("\n"); @@ -1124,15 +1129,15 @@ static void passwd_page(void) /* * Create all the dialog boxes for data collection */ - d_printf("%s\n", _(" User Name : ")); + d_printf(" %s : \n", _("User Name")); d_printf("\n",SWAT_USER, new_name); - d_printf("%s\n", _(" Old Password : ")); + d_printf(" %s : \n", _("Old Password")); d_printf("\n",OLD_PSWD); - d_printf("%s\n", _(" New Password : ")); + d_printf(" %s : \n", _("New Password")); d_printf("\n",NEW_PSWD); - d_printf("%s\n", _(" Re-type New Password : ")); + d_printf(" %s : \n", _("Re-type New Password")); d_printf("\n",NEW2_PSWD); - d_printf("%s\n", _(" Remote Machine : ")); + d_printf(" %s : \n", _("Remote Machine")); d_printf("\n",RHOST); d_printf(""); @@ -1177,7 +1182,7 @@ static void printers_page(void) d_printf(_("Printer names marked with [*] in the Choose Printer drop-down box ")); d_printf(_("are autoloaded printers from ")); d_printf("%s\n", _("Printcap Name")); - d_printf(_("Attempting to delete these printers from SWAT will have no effect.\n")); + d_printf("%s\n", _("Attempting to delete these printers from SWAT will have no effect.")); if (cgi_variable("Commit") && snum >= 0) { commit_parameters(snum); @@ -1223,8 +1228,8 @@ static void printers_page(void) break; } d_printf("\n"); - d_printf("\n", _("Choose Printer")); - d_printf("\n", _("Choose Printer")); + d_printf("\n", _("Create Printer")); - d_printf("\n"); + d_printf("\n", _("Create Printer")); + d_printf("\n"); d_printf("
"); } -- cgit