summaryrefslogtreecommitdiff
path: root/source3/web
diff options
context:
space:
mode:
authorMotonobu Takahashi <monyo@samba.org>2001-09-24 15:55:09 +0000
committerMotonobu Takahashi <monyo@samba.org>2001-09-24 15:55:09 +0000
commit96db4b1ba3a48f50b80b2cfbf0b940e073b7843c (patch)
treebd8d1c25af214250053a84b71b668e81bef7ef5d /source3/web
parent63dba7abe04c1d33bbfa5e921e4aa967dc3966c3 (diff)
downloadsamba-96db4b1ba3a48f50b80b2cfbf0b940e073b7843c.tar.gz
samba-96db4b1ba3a48f50b80b2cfbf0b940e073b7843c.tar.bz2
samba-96db4b1ba3a48f50b80b2cfbf0b940e073b7843c.zip
Added SWAT i18n feature:
TO enable configure with --with-i18n-swat to support this gettext is integrated and a new directories name "po" and "intl" are created. now these languages are supported: en - English (default) ja - Japanese po - Polish tr - Turkish To add your language, to create ${your_language}.po by translating source/po/en.po into your language is needed. some of html and image files of various language version are not included yet, though message catalogue files are installed. you need to copy files manually under ${swatdir}/lang/$ln/{help,images,included,using_samba} And also added a option to intall manual pages: of various lang version To enable configure with --with-manlangs but manual pages themself are not included yet. (This used to be commit 486b79a6fc4ba20a751aab544bd0f7ccff2b3d19)
Diffstat (limited to 'source3/web')
-rw-r--r--source3/web/cgi.c20
-rw-r--r--source3/web/neg_lang.c378
-rw-r--r--source3/web/statuspage.c72
-rw-r--r--source3/web/swat.c235
4 files changed, 571 insertions, 134 deletions
diff --git a/source3/web/cgi.c b/source3/web/cgi.c
index 939b8f94cd..d2b30c49e9 100644
--- a/source3/web/cgi.c
+++ b/source3/web/cgi.c
@@ -20,6 +20,7 @@
#include "includes.h"
#include "smb.h"
+#include "webintl.h"
#define MAX_VARIABLES 10000
@@ -447,6 +448,7 @@ static void cgi_download(char *file)
char buf[1024];
int fd, l, i;
char *p;
+ int nLangDesc;
/* sanitise the filename */
for (i=0;file[i];i++) {
@@ -460,7 +462,11 @@ static void cgi_download(char *file)
cgi_setup_error("404 File Not Found","",
"The requested file was not found");
}
+#if I18N_SWAT
+ fd = sys_open(ln_get_pref_file(file, &st, &nLangDesc),O_RDONLY,0);
+#else
fd = sys_open(file,O_RDONLY,0);
+#endif
if (fd == -1) {
cgi_setup_error("404 File Not Found","",
"The requested file was not found");
@@ -478,7 +484,10 @@ static void cgi_download(char *file)
}
}
printf("Expires: %s\r\n", http_timestring(time(NULL)+EXPIRY_TIME));
-
+#if I18N_SWAT
+ if(ln_get_lang(nLangDesc))
+ printf("Content-Language: %s\r\n", ln_get_lang(nLangDesc));
+#endif
printf("Content-Length: %d\r\n\r\n", (int)st.st_size);
while ((l=read(fd,buf,sizeof(buf)))>0) {
fwrite(buf, 1, l, stdout);
@@ -509,6 +518,11 @@ void cgi_setup(char *rootdir, int auth_required)
/* Handle the possability we might be running as non-root */
sec_init();
+#if I18N_SWAT
+ if(getenv("HTTP_ACCEPT_LANGUAGE")) /* if running as a cgi program */
+ ln_negotiate_language(getenv("HTTP_ACCEPT_LANGUAGE"));
+#endif
+
/* maybe we are running under a web server */
if (getenv("CONTENT_LENGTH") || getenv("REQUEST_METHOD")) {
if (auth_required) {
@@ -543,6 +557,10 @@ void cgi_setup(char *rootdir, int auth_required)
authenticated = cgi_handle_authorization(&line[15]);
} else if (strncasecmp(line,"Content-Length: ", 16)==0) {
content_length = atoi(&line[16]);
+#if I18N_SWAT
+ } else if (strncasecmp(line,"Accept-Language: ", 17)==0) {
+ ln_negotiate_language(&line[17]);
+#endif
}
/* ignore all other requests! */
}
diff --git a/source3/web/neg_lang.c b/source3/web/neg_lang.c
new file mode 100644
index 0000000000..8cb41a34ec
--- /dev/null
+++ b/source3/web/neg_lang.c
@@ -0,0 +1,378 @@
+/*
+ Unix SMB/Netbios implementation.
+ Version 1.9.
+ Samba Web Administration Tool
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+ Created by Ryo Kawahara <rkawa@lbe.co.jp>
+*/
+
+#include "includes.h"
+/* #include "config.h" */
+#include "webintl.h"
+
+#if I18N_SWAT
+/* constants. */
+/* it is ok to make them bigger.*/
+#define LN_PREFLANG_MAX 10
+#define LN_LNAME_LENGTH 8+1+8
+
+#define LN_DEFAULT_LANG I18N_DEFAULT_LANG
+#define LN_LANGDESC_DEFAULT -1
+#define LN_NO_AVAILABLE_LANG -1
+
+/* ******************************************************************
+ * macros for debugging.
+ ***************************************************************** */
+#ifdef LN_R_NODEBUG
+
+#else
+/*
+ *#define LN_DEBUG_LOG "/tmp/lndebug.log"
+ *void ln_debug_error(const char *info, int nLine)
+ *{
+ * FILE* fp;
+ * fp = sys_fopen(LN_DEBUG_LOG, "a");
+ * fprintf(fp, "%s at %d.\n", info, nLine);
+ * fclose(fp);
+ *}
+ *void rassert_help(BOOL b, int l)
+ *{
+ * if(!b)
+ * {
+ * ln_debug_error("language negotiation error.", l);
+ * exit(1);
+ * }
+ *}
+ */
+#endif /* LN_R_NODEBUG */
+
+/* ****************************************************************
+ LNNegotiator struct. It contains...
+ [aPrefLang]
+ the array of strings. each string is the name of
+ languages ("ja", "ko"...), given by web browser.
+ [nPrefLang]
+ the number of the languages in aPrefLang.
+ [lOriginalLang]
+ == "en": indicates what language the default(original) files
+ are written with.
+**************************************************************** */
+typedef char lnstring[LN_LNAME_LENGTH + 1];
+#define lnstrcpy(d,s) safe_strcpy((d),(s),sizeof(lnstring)-1)
+
+typedef struct tagLNNegotiator
+{
+ lnstring aPrefLang[LN_PREFLANG_MAX];
+ int nPrefLang;
+ lnstring lOriginalLang;
+}LNNegotiator;
+
+/* **************************************************************
+ * some access functions & macros for LNNegotiator struct.
+ * ************************************************************ */
+#define ln_getPreflangCount(pLn) ((pLn)->nPrefLang)
+#define ln_getOriginalLang(pLn) ((pLn)->lOriginalLang)
+#define ln_getDefaultPrefLang(pLn) ((pLn)->lDefaultPrefLang)
+
+/* make it inline-expanded (or macro) to get better performance */
+static const char* ln_getPreflang(LNNegotiator* pLn, int i)
+{
+ rassert(i == LN_LANGDESC_DEFAULT
+ || (0 <= i && i < ln_getPreflangCount(pLn)));
+
+ if(i == LN_LANGDESC_DEFAULT)
+ return NULL;
+ if(0 <= i && i < ln_getPreflangCount(pLn))
+ return pLn->aPrefLang[i];
+ return NULL;
+}
+/* initialize structures */
+static void ln_resetln(LNNegotiator* pLn)
+{
+ pLn->nPrefLang = 0;
+ /* using fixed memory.*/
+}
+static BOOL ln_addPreflang(LNNegotiator* pLn, const char* pLang)
+{
+ int nPref = ln_getPreflangCount(pLn);
+
+ if(nPref >= LN_PREFLANG_MAX)
+ return False;
+
+ lnstrcpy(pLn->aPrefLang[nPref], pLang);
+ (pLn->nPrefLang)++;
+ return True;
+}
+static void ln_initln_help(LNNegotiator* pLn)
+{
+ ln_resetln(pLn);
+ lnstrcpy(pLn->lOriginalLang, I18N_ORIGINAL_LANG);
+ /* I18N_ORIGINAL_LANG = "en" is hardcoded in
+ webintl.h. */
+ if (I18N_DEFAULT_PREF_LANG[0] != '\0')
+ ln_addPreflang(pLn, I18N_DEFAULT_PREF_LANG);
+
+ /* this entry is used only when web browser didn't send
+ ACCEPT-LANGUAGE header. */
+}
+/* ****************************************************************
+ * store acceptable languages into LNNegotiator object.
+ * [pstrLangarray] The arguments of "accept-language" http header,
+ * which is like "en-GB, es;q=0.5, ja". "q=0.5" is called quality value,
+ * but it is ignored now. wiled card "*" is also ignored.
+ ***************************************************************** */
+static BOOL ln_negotiate_language_help( LNNegotiator* pLn, const char* pstrLangarray )
+{
+ char* pToken;
+ const char* pDelim = " \n\r\t,;";
+ pstring strBuffer;
+
+ rassert(pstrLangarray);
+ rassert(pLn);
+
+ ln_resetln(pLn);
+ pstrcpy(strBuffer, pstrLangarray);
+ pToken = strtok(strBuffer, pDelim);
+ while(pToken != NULL)
+ {
+ if(strncmp(pToken, "q=", strlen("q=")) == 0)
+ {
+ pToken = strtok(NULL, pDelim);
+ continue;
+ }
+ if(!ln_addPreflang(pLn, pToken))
+ break;
+ pToken = strtok(NULL, pDelim);
+ }
+ rassert(ln_getPreflangCount(pLn) != 0);
+ return (ln_getPreflangCount(pLn) != 0);
+}
+/* parse catalog file header and get encoding information.*/
+static BOOL parse_po_header(const char* pheader, pstring pencoding_name)
+{
+ const char *ap_i_v = "Project-Id-Version:";
+ const char *acharset = "charset=";
+ char* penc;
+ int nenc;
+
+ if(pencoding_name == NULL) return False;
+ if(pheader == NULL || *pheader == '\0')
+ {
+ /* error or catalog is not available. */
+ pstrcpy(pencoding_name,"");
+ return False;
+ }
+ penc = strstr(pheader, acharset);
+ if(strncmp(pheader, ap_i_v, strlen(ap_i_v)) != 0 || penc == NULL)
+ {
+ /* catalog file exists, but header is not good.*/
+ pstrcpy(pencoding_name, "");
+ return True;
+ }
+ nenc = strcspn(penc + strlen(acharset), "\n");
+ strncpy(pencoding_name,
+ penc + strlen(acharset), nenc);
+ return True;
+}
+/* ad-hoc mime charset -> samba encoding name converter.
+ character conversion is done when internal samba data,
+ such as paramters, open files, share names, are going to be displayed.
+ it is only valid for japanese encodings because samba-2.0.7 only has
+ these three character convertors.
+ so other .po file(catalog file) should be encoded with one which
+ samba can deal with (i.e same as DOS codepage).
+
+ display-time conversion is deleted on this version because
+ all catalog files are encoded with samba internal encoding (DOS codepage).
+
+ THIS FUNCTION is ALREADY obsolated and maybe removed soon, -- monyo
+*/
+#define LN_SAMBA_ENCODINGS 3
+static const char* get_samba_enc(const char* penc)
+{
+ int i;
+ static const fstring fdefault = "";
+ static const fstring fmimeenc[LN_SAMBA_ENCODINGS] =
+ {
+ "EUC-JP", "Shift_JIS", "ISO-2022-JP"
+ };
+ static const fstring fsambaenc[LN_SAMBA_ENCODINGS] =
+ {
+ "euc", "sjis", "jis"
+ };
+ for(i = 0; i < LN_SAMBA_ENCODINGS; i++)
+ {
+ if(strcasecmp(penc, fmimeenc[i]) == 0)
+ return fsambaenc[i];
+ }
+ return fdefault;
+}
+/* ************************************************************
+ find a better language.
+ if the language specified by web browser matches to a language
+ which is supported by the swat server, this function returns it.
+ *********************************************************** */
+static void set_a_language(const char* planguage)
+{
+ /* included gettext source is affected by
+ these env.variables without locale settings.
+ */
+ /*
+ putenv(env) will not duplicate env argument
+ but smbw_setenv() does this.
+ */
+ FILE *file;
+ smbw_setenv("LANGUAGE", planguage);
+ smbw_setenv("LANG", planguage);
+ bindtextdomain(I18N_PACKAGE, I18N_LOCALEDIR);
+ textdomain(I18N_PACKAGE);
+}
+static int ln_set_pref_language(LNNegotiator* pLn)
+{
+ int j;
+ pstring enc_name;
+
+ for(j = 0; j < ln_getPreflangCount(pLn); j++)
+ {
+ set_a_language(ln_getPreflang(pLn, j));
+ /* then check for _("") special entry which has
+ a lot of information about .po file. */
+ if(parse_po_header(_(""), enc_name))
+ {
+ /* the catalog file must exist and may have
+ encoding information .*/
+ /*
+ but in this version, catalog files must be
+ written with samba-internal encoding (i.e.
+ dos encoding, dos codepage)
+ so there is no need to convert.
+ //ln_init_swat_encoding(get_samba_enc(enc_name));
+ ln_init_swat_encoding(enc_name);
+ */
+ return j;
+ }
+ }
+ return LN_NO_AVAILABLE_LANG;
+ /* no available or return the default? */
+}
+/* **************************************************************
+ initialize gettext. Before this, cgi_setup() should be done.
+ cgi_setup() calls ln_negotiate_language() if the user specifies
+ languages in web browser. Then, ln_set_pref_language() will work.
+ ************************************************************* */
+static BOOL ln_init_lang_env_help(LNNegotiator* pLn)
+{
+#if I18N_GETTEXT
+ int nLang;
+
+ nLang = ln_set_pref_language(pLn);
+ rstrace(getenv("LANGUAGE"));
+#endif /* I18N_GETTEXT */
+ return True;
+}
+/* *****************************************************************
+ * This function searches for the "PrefLang" version of pFile.
+ * if not available, returns pFile.
+ * [pFile] the filename.
+ * [pst] the address of a struct. it will be filled with the information
+ * of the file.
+ * [pLangDesc] The address of an integer. a value which indicates the
+ * language of the returned value is written to the address. the value
+ * is used in ln_get_lang().
+ * [return value] address of the name of the language version of the file.
+ * It is static object so it will be destroyed at the time ln_get_pref_file()
+ * is called.
+ **************************************************************** */
+static void ln_make_filename( pstring afname, const char* pFile, const char* pAdd )
+{
+#if LANG_PREFIX
+ /* LANG_PREFIX is already undefined, maybe removed soon */
+ /* maybe, foo.html.ja */
+ pstrcpy(afname, pFile);
+ pstrcat(afname, ".");
+ pstrcat(afname, pAdd);
+#else
+ /* maybe, lang/ja/foo.html */
+ pstrcpy(afname, "lang/");
+ pstrcat(afname, pAdd);
+ pstrcat(afname, "/");
+ pstrcat(afname, pFile);
+#endif
+}
+static const char* ln_get_pref_file_help(
+ LNNegotiator* pLn, const char* pFile,
+ SMB_STRUCT_STAT* pst, int* pLangDesc)
+{
+ static pstring afname;
+ int i;
+
+ for(i = 0; i < ln_getPreflangCount(pLn); i++)
+ {
+ if(strcmp(ln_getPreflang(pLn, i), ln_getOriginalLang(pLn))
+ == 0)
+ break;
+ ln_make_filename(afname, pFile, ln_getPreflang(pLn, i));
+ if(file_exist(afname, pst))
+ {
+ *pLangDesc = i;
+ return afname;
+ }
+ }
+ pstrcpy(afname, pFile);
+ file_exist(afname, pst);
+ *pLangDesc = LN_LANGDESC_DEFAULT;
+ return afname;
+}
+/* *******************************************************************
+ * file scope variables. this variable is not locked.
+ * (not multithread-safe)
+ ******************************************************************** */
+static LNNegotiator lnLanguagenegotiator;
+
+/* *******************************************************************
+ * interfaces to the outside of this file.
+ ******************************************************************** */
+void ln_initln(void)
+{
+ ln_initln_help(&lnLanguagenegotiator);
+}
+BOOL ln_init_lang_env(void)
+{
+ return ln_init_lang_env_help(&lnLanguagenegotiator);
+}
+const char* ln_get_lang(int nLangDesc)
+{
+ return ln_getPreflang(&lnLanguagenegotiator, nLangDesc);
+}
+const char* ln_get_pref_file(const char* pFile,
+ SMB_STRUCT_STAT* pst, int* pLangDesc)
+{
+ return ln_get_pref_file_help(
+ &lnLanguagenegotiator, pFile, pst, pLangDesc);
+}
+BOOL ln_negotiate_language(const char* pstrLangarray)
+{
+ return ln_negotiate_language_help(
+ &lnLanguagenegotiator, pstrLangarray);
+}
+const char* ln_get_pref_file_n_o(const char* pFile)
+{
+ SMB_STRUCT_STAT st;
+ int nLangDesc;
+ return ln_get_pref_file(pFile, &st, &nLangDesc);
+}
+#endif /* I18N_SWAT */
diff --git a/source3/web/statuspage.c b/source3/web/statuspage.c
index e930629eee..61bbf67a13 100644
--- a/source3/web/statuspage.c
+++ b/source3/web/statuspage.c
@@ -20,6 +20,7 @@
*/
#include "includes.h"
+#include "webintl.h"
static pid_t smbd_pid;
@@ -36,19 +37,19 @@ static void print_share_mode(share_mode_entry *e, char *fname)
printf("<tr><td>%d</td>",(int)e->pid);
printf("<td>");
switch ((e->share_mode>>4)&0xF) {
- case DENY_NONE: printf("DENY_NONE"); break;
- case DENY_ALL: printf("DENY_ALL "); break;
- case DENY_DOS: printf("DENY_DOS "); break;
- case DENY_READ: printf("DENY_READ "); break;
- case DENY_WRITE:printf("DENY_WRITE "); break;
+ case DENY_NONE: printf(_("DENY_NONE")); break;
+ case DENY_ALL: printf(_("DENY_ALL ")); break;
+ case DENY_DOS: printf(_("DENY_DOS ")); break;
+ case DENY_READ: printf(_("DENY_READ ")); break;
+ case DENY_WRITE:printf(_("DENY_WRITE ")); break;
}
printf("</td>");
printf("<td>");
switch (e->share_mode&0xF) {
- case 0: printf("RDONLY "); break;
- case 1: printf("WRONLY "); break;
- case 2: printf("RDWR "); break;
+ case 0: printf(_("RDONLY ")); break;
+ case 1: printf(_("WRONLY ")); break;
+ case 2: printf(_("RDWR ")); break;
}
printf("</td>");
@@ -56,15 +57,15 @@ static void print_share_mode(share_mode_entry *e, char *fname)
if((e->op_type &
(EXCLUSIVE_OPLOCK|BATCH_OPLOCK)) ==
(EXCLUSIVE_OPLOCK|BATCH_OPLOCK))
- printf("EXCLUSIVE+BATCH ");
+ printf(_("EXCLUSIVE+BATCH "));
else if (e->op_type & EXCLUSIVE_OPLOCK)
- printf("EXCLUSIVE ");
+ printf(_("EXCLUSIVE "));
else if (e->op_type & BATCH_OPLOCK)
- printf("BATCH ");
+ printf(_("BATCH "));
else if (e->op_type & LEVEL_II_OPLOCK)
- printf("LEVEL_II ");
+ printf(_("LEVEL_II "));
else
- printf("NONE ");
+ printf(_("NONE "));
printf("</td>");
printf("<td>%s</td><td>%s</td></tr>\n",
@@ -107,7 +108,7 @@ static int traverse_fn2(TDB_CONTEXT *tdb, TDB_DATA kbuf, TDB_DATA dbuf, void* st
printf("<tr><td>%d</td><td>%s</td><td>%s</td><td>%s</td>\n",
(int)crec.pid,
- crec.machine,crec.addr,
+ crec.machine, crec.addr,
tstring(crec.start));
if (geteuid() == 0) {
printf("<td><input type=submit value=\"X\" name=\"kill_%d\"></td>\n",
@@ -190,18 +191,18 @@ void status_page(void)
tdb = tdb_open_log(lock_path("connections.tdb"), 0, TDB_DEFAULT, O_RDONLY, 0);
if (tdb) tdb_traverse(tdb, traverse_fn1, NULL);
- printf("<H2>Server Status</H2>\n");
+ printf("<H2>%s</H2>\n", _("Server Status"));
printf("<FORM method=post>\n");
if (!autorefresh) {
- printf("<input type=submit value=\"Auto Refresh\" name=autorefresh>\n");
- printf("<br>Refresh Interval: ");
+ printf("<input type=submit value=\"%s\" name=autorefresh>\n", _("Auto Refresh"));
+ printf("<br>%s", _("Refresh Interval: "));
printf("<input type=text size=2 name=\"refresh_interval\" value=%d>\n",
refresh_interval);
} else {
- printf("<input type=submit value=\"Stop Refreshing\" name=norefresh>\n");
- printf("<br>Refresh Interval: %d\n", refresh_interval);
+ printf("<input type=submit value=\"%s\" name=norefresh>\n", _("Stop Refreshing"));
+ printf("<br>%s%d\n", _("Refresh Interval: "), refresh_interval);
printf("<input type=hidden name=refresh value=1>\n");
}
@@ -215,40 +216,40 @@ void status_page(void)
printf("<table>\n");
- printf("<tr><td>version:</td><td>%s</td></tr>",VERSION);
+ printf("<tr><td>%s</td><td>%s</td></tr>", _("version:"), VERSION);
fflush(stdout);
- printf("<tr><td>smbd:</td><td>%srunning</td>\n",smbd_running()?"":"not ");
+ printf("<tr><td>%s</td><td>%s</td>\n", _("smbd:"), smbd_running()?_("running"):_("not running"));
if (geteuid() == 0) {
if (smbd_running()) {
- printf("<td><input type=submit name=\"smbd_stop\" value=\"Stop smbd\"></td>\n");
+ printf("<td><input type=submit name=\"smbd_stop\" value=\"%s\"></td>\n", _("Stop smbd"));
} else {
- printf("<td><input type=submit name=\"smbd_start\" value=\"Start smbd\"></td>\n");
+ printf("<td><input type=submit name=\"smbd_start\" value=\"%s\"></td>\n", _("Start smbd"));
}
- printf("<td><input type=submit name=\"smbd_restart\" value=\"Restart smbd\"></td>\n");
+ printf("<td><input type=submit name=\"smbd_restart\" value=\"%s\"></td>\n", _("Restart smbd"));
}
printf("</tr>\n");
fflush(stdout);
- printf("<tr><td>nmbd:</td><td>%srunning</td>\n",nmbd_running()?"":"not ");
+ printf("<tr><td>%s</td><td>%s</td>\n", _("nmbd:"), nmbd_running()?_("running"):_("not running"));
if (geteuid() == 0) {
if (nmbd_running()) {
- printf("<td><input type=submit name=\"nmbd_stop\" value=\"Stop nmbd\"></td>\n");
+ printf("<td><input type=submit name=\"nmbd_stop\" value=\"%s\"></td>\n", _("Stop nmbd"));
} else {
- printf("<td><input type=submit name=\"nmbd_start\" value=\"Start nmbd\"></td>\n");
+ printf("<td><input type=submit name=\"nmbd_start\" value=\"%s\"></td>\n", _("Start nmbd"));
}
- printf("<td><input type=submit name=\"nmbd_restart\" value=\"Restart nmbd\"></td>\n");
+ printf("<td><input type=submit name=\"nmbd_restart\" value=\"%s\"></td>\n", _("Restart nmbd"));
}
printf("</tr>\n");
printf("</table>\n");
fflush(stdout);
- printf("<p><h3>Active Connections</h3>\n");
+ printf("<p><h3>%s</h3>\n", _("Active Connections"));
printf("<table border=1>\n");
- printf("<tr><th>PID</th><th>Client</th><th>IP address</th><th>Date</th>\n");
+ printf("<tr><th>%s</th><th>%s</th><th>%s</th><th>%s</th>\n", _("PID"), _("Client"), _("IP address"), _("Date"));
if (geteuid() == 0) {
- printf("<th>Kill</th>\n");
+ printf("<th>%s</th>\n", _("Kill"));
}
printf("</tr>\n");
@@ -256,17 +257,18 @@ void status_page(void)
printf("</table><p>\n");
- printf("<p><h3>Active Shares</h3>\n");
+ printf("<p><h3>%s</h3>\n", _("Active Shares"));
printf("<table border=1>\n");
- printf("<tr><th>Share</th><th>User</th><th>Group</th><th>PID</th><th>Client</th><th>Date</th></tr>\n\n");
+ printf("<tr><th>%s</th><th>%s</th><th>%s</th><th>%s</th><th>%s</th><th>%s</th></tr>\n\n",
+ _("Share"), _("User"), _("Group"), _("PID"), _("Client"), _("Date"));
if (tdb) tdb_traverse(tdb, traverse_fn3, NULL);
printf("</table><p>\n");
- printf("<h3>Open Files</h3>\n");
+ printf("<h3>%s</h3>\n", _("Open Files"));
printf("<table border=1>\n");
- printf("<tr><th>PID</th><th>Sharing</th><th>R/W</th><th>Oplock</th><th>File</th><th>Date</th></tr>\n");
+ printf("<tr><th>%s</th><th>%s</th><th>%s</th><th>%s</th><th>%s</th><th>%s</th></tr>\n", _("PID"), _("Sharing"), _("R/W"), _("Oplock"), _("File"), _("Date"));
locking_init(1);
share_mode_forall(print_share_mode);
diff --git a/source3/web/swat.c b/source3/web/swat.c
index 9a7658e94f..664780995e 100644
--- a/source3/web/swat.c
+++ b/source3/web/swat.c
@@ -25,6 +25,7 @@
#include "includes.h"
#include "smb.h"
+#include "webintl.h"
#define GLOBALS_SNUM -1
@@ -109,12 +110,14 @@ static char *make_parm_name(char *label)
****************************************************************************/
static int include_html(char *fname)
{
- FILE *f = sys_fopen(fname,"r");
+ FILE *f;
char buf[1024];
int ret;
+ f = sys_fopen((char*)LN_(fname), "r");
+
if (!f) {
- d_printf("ERROR: Can't open %s\n", fname);
+ d_printf(_("ERROR: Can't open %s\n"), fname);
return 0;
}
@@ -144,6 +147,38 @@ static void print_header(void)
}
}
+/* *******************************************************************
+ show parameter label with translated name in the following form
+ because showing original and translated label in one line looks
+ too long, and showing translated label only is unusable for
+ heavy users.
+ -------------------------------
+ HELP security [combo box][button]
+ SECURITY
+ -------------------------------
+ (capital words are translated by gettext.)
+ if no translation is available, then same form as original is
+ used.
+ "i18n_translated_parm" class is used to change the color of the
+ translated parameter with CSS.
+ **************************************************************** */
+static const char* get_parm_translated(
+ const char* pAnchor, const char* pHelp, const char* pLabel)
+{
+ const char* pTranslated = _(pLabel);
+ static pstring output;
+ if(strcmp(pLabel, pTranslated) != 0)
+ {
+ snprintf(output, sizeof(output),
+ "<A HREF=\"/swat/help/smb.conf.5.html#%s\" target=\"docs\"> %s</A>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; %s <br><span class=\"i18n_translated_parm\">%s</span>",
+ pAnchor, pHelp, pLabel, pTranslated);
+ return output;
+ }
+ snprintf(output, sizeof(output),
+ "<A HREF=\"/swat/help/smb.conf.5.html#%s\" target=\"docs\"> %s</A>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; %s",
+ pAnchor, pHelp, pLabel);
+ return output;
+}
/****************************************************************************
finish off the page
****************************************************************************/
@@ -167,17 +202,13 @@ static void show_parameter(int snum, struct parm_struct *parm)
ptr = lp_local_ptr(snum, ptr);
}
- str = stripspace(parm->label);
- strupper (str);
- d_printf("<tr><td><A HREF=\"/swat/help/smb.conf.5.html#%s\" target=\"docs\">Help</A>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; %s</td><td>",
- str, parm->label);
-
+ printf("<tr><td>%s</td><td>", get_parm_translated(stripspace(parm->label), _("Help"), parm->label));
switch (parm->type) {
case P_CHAR:
d_printf("<input type=text size=2 name=\"parm_%s\" value=\"%c\">",
make_parm_name(parm->label), *(char *)ptr);
- d_printf("<input type=button value=\"Set Default\" onClick=\"swatform.parm_%s.value=\'%c\'\">",
- make_parm_name(parm->label),(char)(parm->def.cvalue));
+ d_printf("<input type=button value=\"%s\" onClick=\"swatform.parm_%s.value=\'%c\'\">",
+ _("Set Default"), make_parm_name(parm->label),(char)(parm->def.cvalue));
break;
case P_LIST:
@@ -190,8 +221,8 @@ static void show_parameter(int snum, struct parm_struct *parm)
}
}
d_printf("\">");
- d_printf("<input type=button value=\"Set Default\" onClick=\"swatform.parm_%s.value=\'",
- make_parm_name(parm->label));
+ d_printf("<input type=button value=\"%s\" onClick=\"swatform.parm_%s.value=\'",
+ _("Set Default"), make_parm_name(parm->label));
if (parm->def.lvalue) {
char **list = (char **)(parm->def.lvalue);
for (; *list; list++) {
@@ -205,16 +236,16 @@ static void show_parameter(int snum, struct parm_struct *parm)
case P_USTRING:
d_printf("<input type=text size=40 name=\"parm_%s\" value=\"%s\">",
make_parm_name(parm->label), *(char **)ptr);
- d_printf("<input type=button value=\"Set Default\" onClick=\"swatform.parm_%s.value=\'%s\'\">",
- make_parm_name(parm->label),fix_backslash((char *)(parm->def.svalue)));
+ d_printf("<input type=button value=\"%s\" onClick=\"swatform.parm_%s.value=\'%s\'\">",
+ _("Set Default"), make_parm_name(parm->label),fix_backslash((char *)(parm->def.svalue)));
break;
case P_GSTRING:
case P_UGSTRING:
d_printf("<input type=text size=40 name=\"parm_%s\" value=\"%s\">",
make_parm_name(parm->label), (char *)ptr);
- d_printf("<input type=button value=\"Set Default\" onClick=\"swatform.parm_%s.value=\'%s\'\">",
- make_parm_name(parm->label),fix_backslash((char *)(parm->def.svalue)));
+ d_printf("<input type=button value=\"%s\" onClick=\"swatform.parm_%s.value=\'%s\'\">",
+ _("Set Default"), make_parm_name(parm->label),fix_backslash((char *)(parm->def.svalue)));
break;
case P_BOOL:
@@ -222,8 +253,8 @@ static void show_parameter(int snum, struct parm_struct *parm)
d_printf("<option %s>Yes", (*(BOOL *)ptr)?"selected":"");
d_printf("<option %s>No", (*(BOOL *)ptr)?"":"selected");
d_printf("</select>");
- d_printf("<input type=button value=\"Set Default\" onClick=\"swatform.parm_%s.selectedIndex=\'%d\'\">",
- make_parm_name(parm->label),(BOOL)(parm->def.bvalue)?0:1);
+ d_printf("<input type=button value=\"%s\" onClick=\"swatform.parm_%s.selectedIndex=\'%d\'\">",
+ _("Set Default"), make_parm_name(parm->label),(BOOL)(parm->def.bvalue)?0:1);
break;
case P_BOOLREV:
@@ -231,20 +262,20 @@ static void show_parameter(int snum, struct parm_struct *parm)
d_printf("<option %s>Yes", (*(BOOL *)ptr)?"":"selected");
d_printf("<option %s>No", (*(BOOL *)ptr)?"selected":"");
d_printf("</select>");
- d_printf("<input type=button value=\"Set Default\" onClick=\"swatform.parm_%s.selectedIndex=\'%d\'\">",
- make_parm_name(parm->label),(BOOL)(parm->def.bvalue)?1:0);
+ d_printf("<input type=button value=\"%s\" onClick=\"swatform.parm_%s.selectedIndex=\'%d\'\">",
+ _("Set Default"), make_parm_name(parm->label),(BOOL)(parm->def.bvalue)?1:0);
break;
case P_INTEGER:
d_printf("<input type=text size=8 name=\"parm_%s\" value=%d>", make_parm_name(parm->label), *(int *)ptr);
- d_printf("<input type=button value=\"Set Default\" onClick=\"swatform.parm_%s.value=\'%d\'\">",
- make_parm_name(parm->label),(int)(parm->def.ivalue));
+ d_printf("<input type=button value=\"%s\" onClick=\"swatform.parm_%s.value=\'%d\'\">",
+ _("Set Default"), make_parm_name(parm->label),(int)(parm->def.ivalue));
break;
case P_OCTAL:
d_printf("<input type=text size=8 name=\"parm_%s\" value=%s>", make_parm_name(parm->label), octal_string(*(int *)ptr));
- d_printf("<input type=button value=\"Set Default\" onClick=\"swatform.parm_%s.value=\'%s\'\">",
- make_parm_name(parm->label),
+ d_printf("<input type=button value=\"%s\" onClick=\"swatform.parm_%s.value=\'%s\'\">",
+ _("Set Default"), make_parm_name(parm->label),
octal_string((int)(parm->def.ivalue)));
break;
@@ -256,8 +287,8 @@ static void show_parameter(int snum, struct parm_struct *parm)
}
}
d_printf("</select>");
- d_printf("<input type=button value=\"Set Default\" onClick=\"swatform.parm_%s.selectedIndex=\'%d\'\">",
- make_parm_name(parm->label),enum_index((int)(parm->def.ivalue),parm->enum_list));
+ d_printf("<input type=button value=\"%s\" onClick=\"swatform.parm_%s.selectedIndex=\'%d\'\">",
+ _("Set Default"), make_parm_name(parm->label),enum_index((int)(parm->def.ivalue),parm->enum_list));
break;
case P_SEP:
break;
@@ -335,7 +366,7 @@ static void show_parameters(int snum, int allparameters, int advanced, int print
if (printers && !(parm->flags & FLAG_PRINT)) continue;
}
if (heading && heading != last_heading) {
- d_printf("<tr><td></td></tr><tr><td><b><u>%s</u></b></td></tr>\n", heading);
+ d_printf("<tr><td></td></tr><tr><td><b><u>%s</u></b></td></tr>\n", _(heading));
last_heading = heading;
}
show_parameter(snum, parm);
@@ -460,20 +491,20 @@ static void show_main_buttons(void)
char *p;
if ((p = cgi_user_name()) && strcmp(p, "root")) {
- d_printf("Logged in as <b>%s</b><p>\n", p);
+ d_printf(_("Logged in as <b>%s</b><p>\n"), p);
}
- image_link("Home", "", "images/home.gif");
+ image_link(_("Home"), "", "images/home.gif");
if (have_write_access) {
- image_link("Globals", "globals", "images/globals.gif");
- image_link("Shares", "shares", "images/shares.gif");
- image_link("Printers", "printers", "images/printers.gif");
+ image_link(_("Globals"), "globals", "images/globals.gif");
+ image_link(_("Shares"), "shares", "images/shares.gif");
+ image_link(_("Printers"), "printers", "images/printers.gif");
}
if (have_read_access) {
- image_link("Status", "status", "images/status.gif");
- image_link("View Config", "viewconfig","images/viewconfig.gif");
+ image_link(_("Status"), "status", "images/status.gif");
+ image_link(_("View Config"), "viewconfig", "images/viewconfig.gif");
}
- image_link("Password Management", "passwd", "images/passwd.gif");
+ image_link(_("Password Management"), "passwd", "images/passwd.gif");
d_printf("<HR>\n");
}
@@ -497,13 +528,13 @@ static void viewconfig_page(void)
full_view = 1;
}
- d_printf("<H2>Current Config</H2>\n");
+ d_printf("<H2>%s</H2>\n", _("Current Config"));
d_printf("<form method=post>\n");
if (full_view) {
- d_printf("<input type=submit name=\"normal_view\" value=\"Normal View\">\n");
+ d_printf("<input type=submit name=\"normal_view\" value=\"%s\">\n", _("Normal View"));
} else {
- d_printf("<input type=submit name=\"full_view\" value=\"Full View\">\n");
+ d_printf("<input type=submit name=\"full_view\" value=\"%s\">\n", _("Full View"));
}
d_printf("<p><pre>");
@@ -519,7 +550,7 @@ static void globals_page(void)
{
int advanced = 0;
- d_printf("<H2>Global Variables</H2>\n");
+ d_printf("<H2>%s</H2>\n", _("Global Variables"));
if (cgi_variable("Advanced") && !cgi_variable("Basic"))
advanced = 1;
@@ -532,14 +563,16 @@ static void globals_page(void)
d_printf("<FORM name=\"swatform\" method=post>\n");
if (have_write_access) {
- d_printf("<input type=submit name=\"Commit\" value=\"Commit Changes\">\n");
+ d_printf("<input type=submit name=\"Commit\" value=\"%s\">\n",
+ _("Commit Changes"));
}
- d_printf("<input type=reset name=\"Reset Values\" value=\"Reset Values\">\n");
+ d_printf("<input type=reset name=\"Reset Values\" value=\"%s\">\n",
+ _("Reset Values"));
if (advanced == 0) {
- d_printf("<input type=submit name=\"Advanced\" value=\"Advanced View\">\n");
+ d_printf("<input type=submit name=\"Advanced\" value=\"%s\">\n", _("Advanced View"));
} else {
- d_printf("<input type=submit name=\"Basic\" value=\"Basic View\">\n");
+ d_printf("<input type=submit name=\"Basic\" value=\"%s\">\n", _("Basic View"));
}
d_printf("<p>\n");
@@ -562,14 +595,14 @@ static void shares_page(void)
{
char *share = cgi_variable("share");
char *s;
- int snum=-1;
+ int snum = -1;
int i;
int advanced = 0;
if (share)
snum = lp_servicenumber(share);
- d_printf("<H2>Share Parameters</H2>\n");
+ d_printf("<H2>%s</H2>\n", _("Share Parameters"));
if (cgi_variable("Advanced") && !cgi_variable("Basic"))
advanced = 1;
@@ -598,7 +631,7 @@ static void shares_page(void)
d_printf("<table>\n");
d_printf("<tr>\n");
- d_printf("<td><input type=submit name=selectshare value=\"Choose Share\"></td>\n");
+ d_printf("<td><input type=submit name=selectshare value=\"%s\"></td>\n", _("Choose Share"));
d_printf("<td><select name=share>\n");
if (snum < 0)
d_printf("<option value=\" \"> \n");
@@ -612,14 +645,14 @@ static void shares_page(void)
}
d_printf("</select></td>\n");
if (have_write_access) {
- d_printf("<td><input type=submit name=\"Delete\" value=\"Delete Share\"></td>\n");
+ d_printf("<td><input type=submit name=\"Delete\" value=\"%s\"></td>\n", _("Delete Share"));
}
d_printf("</tr>\n");
d_printf("</table>");
d_printf("<table>");
if (have_write_access) {
d_printf("<tr>\n");
- d_printf("<td><input type=submit name=createshare value=\"Create Share\"></td>\n");
+ d_printf("<td><input type=submit name=createshare value=\"%s\"></td>\n", _("Create Share"));
d_printf("<td><input type=text size=30 name=newshare></td></tr>\n");
}
d_printf("</table>");
@@ -627,14 +660,14 @@ static void shares_page(void)
if (snum >= 0) {
if (have_write_access) {
- d_printf("<input type=submit name=\"Commit\" value=\"Commit Changes\">\n");
+ d_printf("<input type=submit name=\"Commit\" value=\"%s\">\n", _("Commit Changes"));
}
- d_printf("<input type=reset name=\"Reset Values\" value=\"Reset Values\">\n");
+ d_printf("<input type=reset name=\"Reset Values\" value=\"%s\">\n", _("Reset Values"));
if (advanced == 0) {
- d_printf("<input type=submit name=\"Advanced\" value=\"Advanced View\">\n");
+ d_printf("<input type=submit name=\"Advanced\" value=\"%s\">\n", _("Advanced View"));
} else {
- d_printf("<input type=submit name=\"Basic\" value=\"Basic View\">\n");
+ d_printf("<input type=submit name=\"Basic\" value=\"%s\">\n", _("Basic View"));
}
d_printf("<p>\n");
}
@@ -664,7 +697,7 @@ static BOOL change_password(const char *remote_machine, char *user_name,
pstring msg_str;
if (demo_mode) {
- d_printf("password change in demo mode rejected\n<p>");
+ d_printf("%s<p>", _("password change in demo mode rejected\n"));
return False;
}
@@ -703,7 +736,7 @@ static void chg_passwd(void)
/* Make sure users name has been specified */
if (strlen(cgi_variable(SWAT_USER)) == 0) {
- d_printf("<p> Must specify \"User Name\" \n");
+ d_printf("<p>%s", _(" Must specify \"User Name\" \n"));
return;
}
@@ -719,26 +752,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("<p> Must specify \"Old Password\" \n");
+ d_printf("<p>%s", _(" Must specify \"Old Password\" \n"));
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("<p> Must specify \"Remote Machine\" \n");
+ d_printf("<p>%s", _(" Must specify \"Remote Machine\" \n"));
return;
}
/* Make sure new passwords have been specified */
if ((strlen( cgi_variable(NEW_PSWD)) <= 0) ||
(strlen( cgi_variable(NEW2_PSWD)) <= 0)) {
- d_printf("<p> Must specify \"New, and Re-typed Passwords\" \n");
+ d_printf("<p>%s", _(" Must specify \"New, and Re-typed Passwords\" \n"));
return;
}
/* Make sure new passwords was typed correctly twice */
if (strcmp(cgi_variable(NEW_PSWD), cgi_variable(NEW2_PSWD)) != 0) {
- d_printf("<p> Re-typed password didn't match new password\n");
+ d_printf("<p>%s", _(" Re-typed password didn't match new password\n"));
return;
}
}
@@ -766,10 +799,11 @@ static void chg_passwd(void)
local_flags);
if(local_flags == 0) {
+ d_printf("<p>");
if (rslt == True) {
- d_printf("<p> The passwd for '%s' has been changed. \n", cgi_variable(SWAT_USER));
+ d_printf(_(" The passwd for '%s' has been changed. \n"), cgi_variable(SWAT_USER));
} else {
- d_printf("<p> The passwd for '%s' has NOT been changed. \n",cgi_variable(SWAT_USER));
+ d_printf(_(" The passwd for '%s' has NOT been changed. \n"), cgi_variable(SWAT_USER));
}
}
@@ -793,7 +827,7 @@ static void passwd_page(void)
if (!new_name) new_name = "";
- d_printf("<H2>Server Password Management</H2>\n");
+ d_printf("<H2>%s</H2>\n", _("Server Password Management"));
d_printf("<FORM name=\"swatform\" method=post>\n");
@@ -802,32 +836,32 @@ static void passwd_page(void)
/*
* Create all the dialog boxes for data collection
*/
- d_printf("<tr><td> User Name : </td>\n");
+ d_printf("<tr><td>%s</td>\n", _(" User Name : "));
d_printf("<td><input type=text size=30 name=%s value=%s></td></tr> \n", SWAT_USER, new_name);
if (!am_root()) {
- d_printf("<tr><td> Old Password : </td>\n");
+ d_printf("<tr><td>%s</td>\n", _(" Old Password : "));
d_printf("<td><input type=password size=30 name=%s></td></tr> \n",OLD_PSWD);
}
- d_printf("<tr><td> New Password : </td>\n");
+ d_printf("<tr><td>%s</td>\n", _(" New Password : "));
d_printf("<td><input type=password size=30 name=%s></td></tr>\n",NEW_PSWD);
- d_printf("<tr><td> Re-type New Password : </td>\n");
+ d_printf("<tr><td>%s</td>\n", _(" Re-type New Password : "));
d_printf("<td><input type=password size=30 name=%s></td></tr>\n",NEW2_PSWD);
d_printf("</table>\n");
/*
* Create all the control buttons for requesting action
*/
- d_printf("<input type=submit name=%s value=\"Change Password\">\n",
- CHG_S_PASSWD_FLAG);
+ d_printf("<input type=submit name=%s value=\"%s\">\n",
+ CHG_S_PASSWD_FLAG, _("Change Password"));
if (demo_mode || am_root()) {
- d_printf("<input type=submit name=%s value=\"Add New User\">\n",
- ADD_USER_FLAG);
- d_printf("<input type=submit name=%s value=\"Delete User\">\n",
- DELETE_USER_FLAG);
- d_printf("<input type=submit name=%s value=\"Disable User\">\n",
- DISABLE_USER_FLAG);
- d_printf("<input type=submit name=%s value=\"Enable User\">\n",
- ENABLE_USER_FLAG);
+ d_printf("<input type=submit name=%s value=\"%s\">\n",
+ ADD_USER_FLAG, _("Add New User"));
+ d_printf("<input type=submit name=%s value=\"%s\">\n",
+ DELETE_USER_FLAG, _("Delete User"));
+ d_printf("<input type=submit name=%s value=\"%s\">\n",
+ DISABLE_USER_FLAG, _("Disable User"));
+ d_printf("<input type=submit name=%s value=\"%s\">\n",
+ ENABLE_USER_FLAG, _("Enable User"));
}
d_printf("<p></FORM>\n");
@@ -840,7 +874,7 @@ static void passwd_page(void)
chg_passwd();
}
- d_printf("<H2>Client/Server Password Management</H2>\n");
+ d_printf("<H2>%s</H2>\n", _("Client/Server Password Management"));
d_printf("<FORM name=\"swatform\" method=post>\n");
@@ -849,15 +883,15 @@ static void passwd_page(void)
/*
* Create all the dialog boxes for data collection
*/
- d_printf("<tr><td> User Name : </td>\n");
+ d_printf("<tr><td>%s</td>\n", _(" User Name : "));
d_printf("<td><input type=text size=30 name=%s value=%s></td></tr>\n",SWAT_USER, new_name);
- d_printf("<tr><td> Old Password : </td>\n");
+ d_printf("<tr><td>%s</td>\n", _(" Old Password : "));
d_printf("<td><input type=password size=30 name=%s></td></tr>\n",OLD_PSWD);
- d_printf("<tr><td> New Password : </td>\n");
+ d_printf("<tr><td>%s</td>\n", _(" New Password : "));
d_printf("<td><input type=password size=30 name=%s></td></tr>\n",NEW_PSWD);
- d_printf("<tr><td> Re-type New Password : </td>\n");
+ d_printf("<tr><td>%s</td>\n", _(" Re-type New Password : "));
d_printf("<td><input type=password size=30 name=%s></td></tr>\n",NEW2_PSWD);
- d_printf("<tr><td> Remote Machine : </td>\n");
+ d_printf("<tr><td>%s</td>\n", _(" Remote Machine : "));
d_printf("<td><input type=text size=30 name=%s></td></tr>\n",RHOST);
d_printf("</table>");
@@ -865,8 +899,8 @@ static void passwd_page(void)
/*
* Create all the control buttons for requesting action
*/
- d_printf("<input type=submit name=%s value=\"Change Password\">",
- CHG_R_PASSWD_FLAG);
+ d_printf("<input type=submit name=%s value=\"%s\">",
+ CHG_R_PASSWD_FLAG, _("Change Password"));
d_printf("<p></FORM>\n");
@@ -895,13 +929,13 @@ static void printers_page(void)
if (share)
snum = lp_servicenumber(share);
- d_printf("<H2>Printer Parameters</H2>\n");
-
- d_printf("<H3>Important Note:</H3>\n");
- d_printf("Printer names marked with [*] in the Choose Printer drop-down box ");
- d_printf("are autoloaded printers from ");
- d_printf("<A HREF=\"/swat/help/smb.conf.5.html#PRINTCAPNAME\" target=\"docs\">Printcap Name</A>.\n");
- d_printf("Attempting to delete these printers from SWAT will have no effect.\n");
+ d_printf("<H2>%s</H2>\n", _("Printer Parameters"));
+
+ d_printf("<H3>%s</H3>\n", _("Important Note:"));
+ d_printf(_("Printer names marked with [*] in the Choose Printer drop-down box "));
+ d_printf(_("are autoloaded printers from "));
+ d_printf("<A HREF=\"/swat/help/smb.conf.5.html#printcapname\" target=\"docs\">%s</A>\n", _("Printcap Name"));
+ d_printf(_("Attempting to delete these printers from SWAT will have no effect.\n"));
if (cgi_variable("Advanced") && !cgi_variable("Basic"))
advanced = 1;
@@ -934,7 +968,7 @@ static void printers_page(void)
d_printf("<FORM name=\"swatform\" method=post>\n");
d_printf("<table>\n");
- d_printf("<tr><td><input type=submit name=selectshare value=\"Choose Printer\"></td>\n");
+ d_printf("<tr><td><input type=submit name=selectshare value=\"%s\"></td>\n", _("Choose Printer"));
d_printf("<td><select name=share>\n");
if (snum < 0 || !lp_print_ok(snum))
d_printf("<option value=\" \"> \n");
@@ -953,14 +987,14 @@ static void printers_page(void)
}
d_printf("</select></td>");
if (have_write_access) {
- d_printf("<td><input type=submit name=\"Delete\" value=\"Delete Printer\"></td>\n");
+ d_printf("<td><input type=submit name=\"Delete\" value=\"%s\"></td>\n", _("Delete Printer"));
}
d_printf("</tr>");
d_printf("</table>\n");
if (have_write_access) {
d_printf("<table>\n");
- d_printf("<tr><td><input type=submit name=createshare value=\"Create Printer\"></td>\n");
+ d_printf("<tr><td><input type=submit name=createshare value=\"%s\"></td>\n", _("Create Printer"));
d_printf("<td><input type=text size=30 name=newshare></td></tr>\n");
d_printf("</table>");
}
@@ -968,13 +1002,13 @@ static void printers_page(void)
if (snum >= 0) {
if (have_write_access) {
- d_printf("<input type=submit name=\"Commit\" value=\"Commit Changes\">\n");
+ d_printf("<input type=submit name=\"Commit\" value=\"%s\">\n", _("Commit Changes"));
}
- d_printf("<input type=reset name=\"Reset Values\" value=\"Reset Values\">\n");
+ d_printf("<input type=reset name=\"Reset Values\" value=\"%s\">\n", _("Reset Values"));
if (advanced == 0) {
- d_printf("<input type=submit name=\"Advanced\" value=\"Advanced View\">\n");
+ d_printf("<input type=submit name=\"Advanced\" value=\"%s\">\n", _("Advanced View"));
} else {
- d_printf("<input type=submit name=\"Basic\" value=\"Basic View\">\n");
+ d_printf("<input type=submit name=\"Basic\" value=\"%s\">\n", _("Basic View"));
}
d_printf("<p>\n");
}
@@ -1038,10 +1072,16 @@ static void printers_page(void)
iNumNonAutoPrintServices = lp_numservices();
load_printers();
+#if I18N_SWAT
+ ln_initln();
+ cgi_setup(SWATDIR, !demo_mode);
+ ln_init_lang_env();
+#else
cgi_setup(SWATDIR, !demo_mode);
+#endif
print_header();
-
+
cgi_load_variables();
if (!file_exist(servicesf, NULL)) {
@@ -1057,7 +1097,6 @@ static void printers_page(void)
have_read_access = (access(servicesf,R_OK) == 0);
}
-
show_main_buttons();
page = cgi_pathinfo();