]> git.ipfire.org Git - thirdparty/HylaFAX.git/commitdiff
String markups for i18N (gettext) support.
authorPatrice Fournier <pfournier@ifax.com>
Fri, 9 Nov 2007 22:23:57 +0000 (22:23 +0000)
committerPatrice Fournier <pfournier@ifax.com>
Fri, 9 Nov 2007 22:23:57 +0000 (22:23 +0000)
All markup used are noop; the programs are still English-only

42 files changed:
config.h.in
faxalter/faxalter.c++
faxcover/faxcover.c++
faxd/choptest.c++
faxd/cqtest.c++
faxd/faxQCleanApp.c++
faxd/tagtest.c++
faxd/tsitest.c++
faxmail/MIMEState.c++
faxmail/MsgFmt.c++
faxmail/faxmail.c++
faxrm/faxrm.c++
faxstat/faxstat.c++
sendfax/sendfax.c++
sendpage/sendpage.c++
util/AtSyntax.c++
util/Class2Params.c++
util/DialRules.c++
util/FaxClient.c++
util/FaxConfig.c++
util/FaxDB.c++
util/InetTransport.c++
util/Obj.c++
util/PageSize.c++
util/SNPPClient.c++
util/SendFaxClient.c++
util/SendFaxJob.c++
util/Sequence.c++
util/Str.c++
util/TextFormat.c++
util/Transport.c++
util/Transport.h
util/TypeRules.c++
util/Types.h
util/UnixTransport.c++
util/dialtest.c++
util/faxfetch.c++
util/faxinfo.c++
util/faxwatch.c++
util/textfmt.c++
util/tiffcheck.c++
util/typetest.c++

index fe37392888a8c8938ee2f9fe45d348a3f0796360..58150e352625d2c1a9aa6cc6a9683c84a7ef8fa9 100644 (file)
 @HAVE_JBIG@
 @HAVE_JBIGTIFF@
 
+/*
+ * i18n support
+ */
+#define _(String) (String)
+#define N_(String) String
+#define textdomain(Domain) do {} while(0)
+#define bindtextdomain(Package, Directory) do {} while(0)
+#define ngettext(s1, s2, n) (n==1?s1:s2)
+
 #endif
index 1dada26439d5b9727ebecea986b2c2da13e9ab20..e213930a694129d46d657f4f11922c40415f8d87 100644 (file)
@@ -232,7 +232,7 @@ faxAlterApp::run(int argc, char** argv)
     if (optind >= argc)
        usage();
     if (script == "" && !resubmit)
-       fxFatal("No job parameters specified for alteration.");
+       fxFatal(_("No job parameters specified for alteration."));
     if (callServer(emsg)) {
        if (login(NULL, emsg) &&
            (!useadmin || admin(NULL, emsg))) {
@@ -253,7 +253,7 @@ faxAlterApp::run(int argc, char** argv)
                        }
                        const char* old_job = jobid;
                        jobid = getCurrentJob();
-                       printf("Job %s: duplicated as job %s.\n", old_job, jobid);
+                       printf(_("Job %s: duplicated as job %s.\n"), old_job, jobid);
                    } else if (! jobSuspend(jobid)) {
                        emsg = getLastResponse();
                        printError("%s", (const char*) emsg);
@@ -280,7 +280,7 @@ faxAlterApp::run(int argc, char** argv)
                        else
                            continue;
                    }
-                   printf("Job %s: done.\n", jobid);
+                   printf(_("Job %s: done.\n"), jobid);
                } else {
                    emsg = getLastResponse();
                    printError("%s", (const char*) emsg);
@@ -306,7 +306,7 @@ faxAlterApp::run(int argc, char** argv)
 void
 faxAlterApp::usage()
 {
-    fxFatal("usage: faxalter [-C]"
+    fxFatal(_("usage: faxalter [-C]"
       " [-h server-host]"
       " [-a time]"
       " [-d number]"
@@ -321,7 +321,7 @@ faxAlterApp::usage()
       " [-r]"
       " [-v]"
       " [-DQR]"
-      " jobID...");
+      " jobID..."));
 }
 
 int
index 656db583b3544fb4559962b7b614f296cdbba588..debc8b8b583ea7afaebd3792497b9a428eefb57e 100644 (file)
@@ -178,7 +178,7 @@ faxCoverApp::setupPageSize(const char* name)
 {
     PageSizeInfo* info = PageSizeInfo::getPageSizeByName(name);
     if (!info)
-       fxFatal("Unknown page size \"%s\"", name);
+       fxFatal(_("Unknown page size \"%s\""), name);
     pageWidth = info->width();
     pageLength = info->height();
     delete info;
@@ -195,7 +195,7 @@ faxCoverApp::open()
 void
 faxCoverApp::usage()
 {
-    fxFatal("usage: %s"
+    fxFatal(_("usage: %s"
        " [-t to]"
        " [-c comments]"
        " [-p #pages]"
@@ -213,7 +213,7 @@ faxCoverApp::usage()
        " [-X from-company]"
        " [-s pagesize]"
        " -f from"
-       " -n fax-number"
+       " -n fax-number")
        , (const char*) appName);
 }
 
@@ -318,7 +318,7 @@ faxCoverApp::makeCoverSheet()
     } else
        fd = Sys::open(cover, O_RDONLY);
     if (fd < 0) {
-       printError( "Could not locate prototype cover sheet \"%s\"",
+       printError(_("Could not locate prototype cover sheet \"%s\""),
            (const char*) cover);
        return;
     }
@@ -450,7 +450,7 @@ faxCoverApp::tildeExpand(const fxStr& filename)
         path.remove(0);
         struct passwd* pwd = getpwuid(getuid());
         if (!pwd) {
-            fxFatal("Can not figure out who you are.");
+            fxFatal(_("Can not figure out who you are."));
         }
         char* cp = pwd->pw_dir;
            path.insert(cp);
index db16d63a24aabfe89d405cfdec63595aa37769d6..b95c37409508dd987e3aacdd94d2bed8e591847b 100644 (file)
@@ -39,7 +39,7 @@ const char* appName;
 void
 usage()
 {
-    fprintf(stderr, "usage: %s [-a] [-t threshold] input.tif\n", appName);
+    fprintf(stderr, _("usage: %s [-a] [-t threshold] input.tif\n"), appName);
     exit(-1);
 }
 
@@ -82,11 +82,11 @@ main(int argc, char* argv[])
        usage();
     TIFF* tif = TIFFOpen(argv[optind], "r");
     if (!tif)
-       fatal("%s: Cannot open, or not a TIFF file", argv[optind]);
+       fatal(_("%s: Cannot open, or not a TIFF file"), argv[optind]);
     uint16 comp;
     TIFFGetField(tif, TIFFTAG_COMPRESSION, &comp);
     if (comp != COMPRESSION_CCITTFAX3 && comp != COMPRESSION_CCITTFAX4)
-       fatal("%s: Not a Group 3 or Group 4-encoded TIFF file", argv[optind]);
+       fatal(_("%s: Not a Group 3 or Group 4-encoded TIFF file"), argv[optind]);
 
     Class2Params params;
     params.vr = VR_NORMAL;
@@ -94,8 +94,9 @@ main(int argc, char* argv[])
     params.ln = LN_INF;
     params.df = DF_1DMH;
 
-    printf("Chop %s >=%.2g\" of white space at the bottom.\n"
-       , doAll ? "all pages with" : "last page if"
+    printf((doAll 
+       ? _("Chop all pages with >=%.2g\" of white space at the bottom.\n")
+       : _("Chop last page if >=%.2g\" of white space at the bottom.\n"))
        , minChop
     );
 
@@ -128,13 +129,13 @@ main(int argc, char* argv[])
                    dec.scanPageForBlanks(fillorder, params);
                    if (dec.getLastBlanks() > minRows) {
                        printf(
-                           "Chop %u rows, strip was %lu bytes, need only %lu\n"
+                           _("Chop %u rows, strip was %lu bytes, need only %lu\n")
                            , dec.getLastBlanks()
                            , (u_long) totbytes
                            , (u_long) (dec.getEndOfPage() - data)
                        );
                    } else {
-                       printf("Don't chop, found %u rows, need %u rows\n"
+                       printf(_("Don't chop, found %u rows, need %u rows\n")
                            , dec.getLastBlanks()
                            , minRows
                        );
index a3d19fb624285120f97848846967bbfc9f2ac868..fb43e87a00095ed0c6277b5a1a4a7aa1bc114e8c 100644 (file)
@@ -164,7 +164,7 @@ CQDecoder::recvPageDLEData(TIFF* tif, bool checkQuality,
     recvStrip = 0;                             // TIFF strip number
     if (EOFraised()) {
        abortPageRecv();
-       emsg = "Missing EOL after 5 seconds";
+       emsg = _("Missing EOL after 5 seconds");
        recvTrace("%s", (const char*) emsg);
        return (false);
     }
@@ -255,7 +255,7 @@ CQDecoder::recvPageDLEData(TIFF* tif, bool checkQuality,
             * Adjust everything to reflect the location
             * at which RTC was found in the data stream.
             */
-           copyQualityTrace("Adjusting for RTC found at row %u", getRTCRow());
+           copyQualityTrace(_("Adjusting for RTC found at row %u"), getRTCRow());
                                                // # EOL's in recognized RTC
            u_int n = (u_int) (recvEOLCount - getRTCRow());
            if ((recvRow -= n*rowSize) < buf)
@@ -269,13 +269,13 @@ CQDecoder::recvPageDLEData(TIFF* tif, bool checkQuality,
             * readable and/or is followed by line noise or random
             * junk from the sender.
             */
-           copyQualityTrace("adjusting for trailing noise (%lu run)", cblc);
+           copyQualityTrace(_("adjusting for trailing noise (%lu run)"), cblc);
            recvEOLCount -= cblc;
            recvBadLineCount -= cblc;
            if ((recvRow -= cblc*rowSize) < buf)
                recvRow = buf;
        }
-       recvTrace("%lu total lines, %lu bad lines, %lu consecutive bad lines"
+       recvTrace(_("%lu total lines, %lu bad lines, %lu consecutive bad lines")
            , recvEOLCount
            , recvBadLineCount
            , recvConsecutiveBadLineCount
@@ -346,7 +346,7 @@ CQDecoder::recvPageDLEData(TIFF* tif, bool checkQuality,
             * Adjust the received line count to reflect the
             * location at which RTC was found in the data stream.
             */
-           copyQualityTrace("Adjusting for RTC found at row %u", getRTCRow());
+           copyQualityTrace(_("Adjusting for RTC found at row %u"), getRTCRow());
            recvEOLCount = getRTCRow();
        }
     }
@@ -358,7 +358,7 @@ CQDecoder::flushEncodedData(TIFF* tif, tstrip_t strip, u_char* buf, u_int cc)
 {
     TIFFSetField(tif, TIFFTAG_IMAGELENGTH, recvEOLCount);
     if (TIFFWriteEncodedStrip(tif, strip, buf, cc) == -1)
-       serverTrace("RECV: %s: write error", TIFFFileName(tif));
+       serverTrace(_("RECV: %s: write error"), TIFFFileName(tif));
 }
 
 /*
@@ -369,7 +369,7 @@ CQDecoder::flushRawData(TIFF* tif, tstrip_t strip, u_char* buf, u_int cc)
 {
     recvTrace("%u bytes of data, %lu total lines", cc, recvEOLCount);
     if (TIFFWriteRawStrip(tif, strip, buf, cc) == -1)
-       serverTrace("RECV: %s: write error", TIFFFileName(tif));
+       serverTrace(_("RECV: %s: write error"), TIFFFileName(tif));
 }
 
 /*
@@ -393,7 +393,7 @@ CQDecoder::isQualityOK(const Class2Params& params)
     if (percentGoodLines != 0 && recvEOLCount != 0) {
        u_long percent = 100 * (recvEOLCount - recvBadLineCount) / recvEOLCount;
        if (percent < percentGoodLines) {
-           serverTrace("RECV: REJECT page quality, %u%% good lines (%u%% required)",
+           serverTrace(_("RECV: REJECT page quality, %u%% good lines (%u%% required)"),
                percent, percentGoodLines);
            return (false);
        }
@@ -403,7 +403,7 @@ CQDecoder::isQualityOK(const Class2Params& params)
        if (params.vr == VR_FINE)
            cblc *= 2;
        if (recvConsecutiveBadLineCount > cblc) {
-           serverTrace("RECV: REJECT page quality, %u-line run (max %u)",
+           serverTrace(_("RECV: REJECT page quality, %u-line run (max %u)"),
                recvConsecutiveBadLineCount, cblc);
            return (false);
        }
@@ -431,7 +431,7 @@ CQDecoder::recvTrace(const char* fmt ...)
 {
     va_list ap;
     va_start(ap, fmt);
-    static const fxStr recv("RECV: ");
+    static const fxStr recv(_("RECV: "));
     vtraceStatus(FAXTRACE_PROTOCOL, recv | fmt, ap);
     va_end(ap);
 }
@@ -455,7 +455,7 @@ void
 CQDecoder::invalidCode(const char* type, int x)
 {
     if (!seenRTC())
-       copyQualityTrace("Invalid %s code word, row %u, x %d",
+       copyQualityTrace(_("Invalid %s code word, row %u, x %d"),
            type, getReferenceRow(), x);
 }
 
@@ -466,14 +466,14 @@ void
 CQDecoder::badPixelCount(const char* type, int got, int expected)
 {
     if (!seenRTC())
-       copyQualityTrace("Bad %s pixel count, row %u, got %d, expected %d",
+       copyQualityTrace(_("Bad %s pixel count, row %u, got %d, expected %d"),
            type, getReferenceRow(), got, expected);
 }
 
 void
 CQDecoder::badDecodingState(const char* type, int x)
 {
-    copyQualityTrace("Panic, bad %s decoding state, row %u, x %d",
+    copyQualityTrace(_("Panic, bad %s decoding state, row %u, x %d"),
        type, getReferenceRow(), x);
 }
 
@@ -485,7 +485,7 @@ CQDecoder::copyQualityTrace(const char* fmt ...)
 {
     va_list ap;
     va_start(ap, fmt);
-    static const fxStr cq("RECV/CQ: ");
+    static const fxStr cq(_("RECV/CQ: "));
     vtraceStatus(FAXTRACE_COPYQUALITY, cq | fmt, ap);
     va_end(ap);
 }
@@ -495,7 +495,7 @@ const char* appName;
 void
 usage()
 {
-    fprintf(stderr, "usage: %s [-m maxbad] [-p %%good] [-o output.tif] input.tif\n", appName);
+    fprintf(stderr, _("usage: %s [-m maxbad] [-p %%good] [-o output.tif] input.tif\n"), appName);
     _exit(-1);
 }
 
@@ -528,12 +528,12 @@ main(int argc, char* argv[])
        usage();
     TIFF* tif = TIFFOpen(argv[optind], "r");
     if (!tif) {
-       fprintf(stderr, "%s: Cannot open, or not a TIFF file\n", argv[optind]);
+       fprintf(stderr, _("%s: Cannot open, or not a TIFF file\n"), argv[optind]);
        return (-1);
     }
     TIFF* tifout = TIFFOpen(outFile, "w");
     if (!tifout) {
-       fprintf(stderr, "%s: Cannot create TIFF file\n", outFile);
+       fprintf(stderr, _("%s: Cannot create TIFF file\n"), outFile);
        return (-1);
     }
     Class2Params params;
@@ -576,7 +576,7 @@ main(int argc, char* argv[])
                    (void) cq.recvPageDLEData(tifout,
                        cq.checkQuality(), params, emsg);
                } else
-                   printf("Read error on strip %u\n", strip);
+                   printf(_("Read error on strip %u\n"), strip);
                delete data;
            }
        }
index 3f29ebea8c57a43c0118d5f5aeb0fa735975cca7..6be870a99647cc0e60b53618ed4afeef44915cda 100644 (file)
@@ -122,12 +122,12 @@ void
 faxQCleanApp::scanDirectory(void)
 {
     if (trace)
-       printf("Scan %s directory for jobs to remove+archive.\n",
+       printf(_("Scan %s directory for jobs to remove+archive.\n"),
            (const char*) doneDir);
 
     DIR* dir = Sys::opendir(doneDir);
     if (dir == NULL) {
-       printf("%s: Could not scan directory for jobs.\n",
+       printf(_("%s: Could not scan directory for jobs.\n"),
            (const char*) doneDir);
        return;
     }
@@ -140,7 +140,7 @@ faxQCleanApp::scanDirectory(void)
        struct stat sb;
        if (Sys::stat(filename, sb) < 0 || !S_ISREG(sb.st_mode)) {
            if (trace)
-               printf("%s: ignored (cannot stat or not a regular file)\n",
+               printf(_("%s: ignored (cannot stat or not a regular file)\n"),
                    (const char*) filename);
            continue;
        }
@@ -157,7 +157,7 @@ faxQCleanApp::scanDirectory(void)
                         * and forget it until later.
                         */
                        if (trace)
-                           printf("%s: job too new, ignored (for now).\n",
+                           printf(_("%s: job too new, ignored (for now).\n"),
                                (const char*) filename);
                        collectRefs(*req);
                    } else if (forceArchiving || archiving &&
@@ -167,19 +167,19 @@ faxQCleanApp::scanDirectory(void)
                         * value to the archive script for archiving.
                         */
                        if (verbose)
-                           printf("JOB %s: archive (%s)%s.\n"
+                           printf(_("JOB %s: archive (%s)%s.\n")
                                , (const char*) req->jobid
                                , (const char*) req->doneop
-                               , nowork ? " (not done)" : ""
+                               , nowork ? _(" (not done)") : ""
                            );
                        if (!nowork)
                            archiveJob(*req);
                    } else {
                        if (verbose)
-                           printf("JOB %s: remove (%s) %s.\n"
+                           printf(_("JOB %s: remove (%s) %s.\n")
                                , (const char*) req->jobid
                                , (const char*) req->doneop
-                               , nowork ? " (not done)" : ""
+                               , nowork ? _(" (not done)") : ""
                            );
                        if (!nowork)
                            Sys::unlink(req->qfile);
@@ -193,7 +193,7 @@ faxQCleanApp::scanDirectory(void)
                     * so therefore can be removed.
                     */
                    if (verbose)
-                       printf("%s: malformed queue file: remove\n",
+                       printf(_("%s: malformed queue file: remove\n"),
                            (const char*) filename);
                    if (!nowork)
                        Sys::unlink(filename);
@@ -209,7 +209,7 @@ faxQCleanApp::scanDirectory(void)
            printf("%s: open: %s\n", (const char*) filename, strerror(errno));
     }
     if (trace)
-       printf("Done scanning %s directory\n", (const char*) doneDir);
+       printf(_("Done scanning %s directory\n"), (const char*) doneDir);
     closedir(dir);
 }
 
@@ -231,7 +231,7 @@ faxQCleanApp::collectRefs(const FaxRequest& req)
        case FaxRequest::send_pcl:
        case FaxRequest::send_pcl_saved:
            if (trace)
-               printf("JOB %s: reference %s\n",
+               printf(_("JOB %s: reference %s\n"),
                    (const char*) req.jobid,
                    (const char*) fitem.item);
            docrefs[fitem.item]++;
@@ -263,12 +263,12 @@ void
 faxQCleanApp::expungeCruft(void)
 {
     if (trace)
-       printf("Scan %s directory and remove unreferenced documents.\n",
+       printf(_("Scan %s directory and remove unreferenced documents.\n"),
            (const char*) docDir);
 
     DIR* dir = Sys::opendir(docDir);
     if (dir == NULL) {
-       printf("%s: Could not scan directory for unreferenced documents.\n",
+       printf(_("%s: Could not scan directory for unreferenced documents.\n"),
            (const char*) docDir);
        return;
     }
@@ -290,7 +290,7 @@ faxQCleanApp::expungeCruft(void)
        struct stat sb;
        if (Sys::stat(file, sb) < 0 || !S_ISREG(sb.st_mode)) {
            if (trace)
-               printf("%s: ignored, cannot stat or not a regular file\n",
+               printf(_("%s: ignored, cannot stat or not a regular file\n"),
                    (const char*) file);
            continue;
        }
@@ -305,19 +305,19 @@ faxQCleanApp::expungeCruft(void)
         */
        if (sb.st_nlink > 1) {                  // can't be orphaned yet
            if (trace)
-               printf("%s: ignored, file has %u links\n",
+               printf(_("%s: ignored, file has %u links\n"),
                    (const char*) file, sb.st_nlink);
            continue;
        }
        if (docrefs.find(file)) {               // referenced from doneq
            if (trace)
-               printf("%s: ignored, file has %u references\n",
+               printf(_("%s: ignored, file has %u references\n"),
                    (const char*) file, docrefs[file]);
            continue;
        }
        if (now - sb.st_mtime < minDocAge) {    // not old enough
            if (trace)
-               printf("%s: ignored, file is too new to remove\n",
+               printf(_("%s: ignored, file is too new to remove\n"),
                    (const char*) file);
            continue;
        }
@@ -340,11 +340,11 @@ faxQCleanApp::expungeCruft(void)
            fxStr qfile = qFilePrefix | file.tail(file.length()-l);
            if (Sys::stat(qfile, sb) == 0) {
                if (trace)
-                   printf("%s: file looks to be referenced by job\n",
+                   printf(_("%s: file looks to be referenced by job\n"),
                        (const char*) file);
                continue;                       // skip, in use
            } else if (trace)
-               printf("%s: file has no matching %s\n"
+               printf(_("%s: file has no matching %s\n")
                    (const char*) file, (const char*)qfile);
        } else if ((l != 0 && l < file.length() && strcmp(&file[l], "cover") == 0) ||
                 (k == 0 && strncmp(&file[docDir.length()+1], "cover", 5) == 0)) {
@@ -362,7 +362,7 @@ faxQCleanApp::expungeCruft(void)
            fxStr qfile = qFilePrefix | file.extract(prefix, len-prefix);
            if (Sys::stat(qfile, sb) == 0) {
                if (trace)
-                   printf("%s: file looks to be referenced by job\n",
+                   printf(_("%s: file looks to be referenced by job\n"),
                        (const char*) file);
                continue;                       // skip, in use
            }
@@ -381,7 +381,7 @@ faxQCleanApp::expungeCruft(void)
            DIR        *dir1 = Sys::opendir(docDir);
 
            if(dir1 == 0) {
-               printf("%s: Could not scan directory for base file.\n",
+               printf(_("%s: Could not scan directory for base file.\n"),
                    (const char *) docDir);
                    continue;
            }
@@ -390,7 +390,7 @@ faxQCleanApp::expungeCruft(void)
                        ( strncmp(base, dp1->d_name, sl) == 0)) {
                    // Found match
                    if(trace)
-                       printf("%s: found match to base '%s', skipping.\n",
+                       printf(_("%s: found match to base '%s', skipping.\n"),
                            (const char *)file, dp1->d_name);
                    got_match = true;
                    break;
@@ -402,7 +402,7 @@ faxQCleanApp::expungeCruft(void)
                continue;
            }
            if(trace)
-               printf("%s: did not find base '%s' match.\n"
+               printf(_("%s: did not find base '%s' match.\n")
                    (const char *) file, base);
 
            free(base);
@@ -410,18 +410,18 @@ faxQCleanApp::expungeCruft(void)
 
        if (nowork || Sys::unlink(file) >= 0) {
            if (verbose)
-               printf("DOC %s: unreferenced document removed%s.\n"
+               printf(_("DOC %s: unreferenced document removed%s.\n")
                    , (const char*) file
-                   , nowork ? " (not done)" : ""
+                   , nowork ? _(" (not done)") : ""
                );
        } else {
            if (verbose)
-               printf("%s: error removing unreferenced document: %s.\n",
+               printf(_("%s: error removing unreferenced document: %s.\n"),
                    (const char*) file, strerror(errno));
        }
     }
     if (trace)
-       printf("Done scanning %s directory\n", (const char*) docDir);
+       printf(_("Done scanning %s directory\n"), (const char*) docDir);
     closedir(dir);
 }
 
@@ -429,7 +429,7 @@ static void
 usage(const char* appName)
 {
     fprintf(stderr,
-       "usage: %s [-a] [-j time] [-d time] [-q queue-directory]\n",
+       _("usage: %s [-a] [-j time] [-d time] [-q queue-directory]\n"),
        appName);
 }
 
@@ -461,7 +461,7 @@ main(int argc, char** argv)
        case '?': usage(appName);
        }
     if (Sys::chdir(queueDir) < 0) {
-       fprintf(stderr, "%s: Can not change directory: %s.\n",
+       fprintf(stderr, _("%s: Can not change directory: %s.\n"),
            (const char*) queueDir, strerror(errno));
        exit(-1);
     }
index 12f1374a1732fff7815e3a8c5f2e954be1402ccb..6351e23ea94ae531e8c66d603e821df31271773f 100644 (file)
@@ -381,7 +381,7 @@ void
 usage()
 {
     fprintf(stderr,
-       "usage: %s [-m format] [-o t.tif] [-f font.pcf] input.tif\n",
+       _("usage: %s [-m format] [-o t.tif] [-f font.pcf] input.tif\n"),
        appName);
     exit(-1);
 }
@@ -432,18 +432,18 @@ main(int argc, char* argv[])
        usage();
     TIFF* tif = TIFFOpen(argv[optind], "r");
     if (!tif)
-       fatal("%s: Cannot open, or not a TIFF file", argv[optind]);
+       fatal(_("%s: Cannot open, or not a TIFF file"), argv[optind]);
     uint16 comp;
     TIFFGetField(tif, TIFFTAG_COMPRESSION, &comp);
     if (comp != COMPRESSION_CCITTFAX3 && comp != COMPRESSION_CCITTFAX4)
-       fatal("%s: Not a Group 3 or Group 4-encoded TIFF file", argv[optind]);
+       fatal(_("%s: Not a Group 3 or Group 4-encoded TIFF file"), argv[optind]);
     setupTagLine();
     if (!tagLineFont->isReady())
-       fatal("%s: Problem reading font", (const char*) tagLineFontFile);
+       fatal(_("%s: Problem reading font"), (const char*) tagLineFontFile);
 
     TIFF* otif = TIFFOpen(output, "w");
     if (!otif)
-       fatal("%s: Cannot create output file", output);
+       fatal(_("%s: Cannot create output file"), output);
     for (totalPages = 1; TIFFReadDirectory(tif); totalPages++)
        ;
     TIFFSetDirectory(tif, 0);
@@ -547,7 +547,7 @@ main(int argc, char* argv[])
                    if (fillorder != FILLORDER_LSB2MSB)
                        TIFFReverseBits(dp, totbytes);
                    if (TIFFWriteRawStrip(otif, strip, dp, totbytes) == -1)
-                       fatal("%s: Write error at strip %u, writing %lu bytes"
+                       fatal(_("%s: Write error at strip %u, writing %lu bytes")
                            output, strip, (u_long) totbytes);
                }
                delete data;
index cbf599279febd43a48cca6a201cae86800bffcba..9cfdb06326dc1aa2cc8a7dbac2d9b913ff0e36c7 100644 (file)
@@ -91,7 +91,7 @@ readTSIPatterns(FILE* fd, REArray*& pats, fxBoolArray*& accept)
        if (re->getErrorCode() > REG_NOMATCH) {
            fxStr emsg;
            re->getError(emsg);
-           printf("Bad TSI pattern: %s: " | emsg | ".\n", re->pattern());
+           printf(_("Bad TSI pattern: %s: ") | emsg | ".\n", re->pattern());
        }
     }
 }
@@ -126,13 +126,13 @@ static    const char* appName;
 static void
 usage()
 {
-    fxFatal("usage: %s [-q] tsifile", appName);
+    fxFatal(_("usage: %s [-q] tsifile"), appName);
 }
 
 static int
 prompt()
 {
-    printf("ready> "); fflush(stdout);
+    printf(_("ready> ")); fflush(stdout);
     return (1);
 }
 
@@ -163,26 +163,27 @@ main(int argc, char* argv[])
        if (cp)
            *cp = '\0';
        if (verbose)
-           printf("input = \"%s\"\n", line);
+           printf(_("input = \"%s\"\n"), line);
        updateTSIPatterns();
        if (tsiPats != NULL) {
            u_int i;
            for (i = 0; i < tsiPats->length(); i++) {
                RE* pat = (*tsiPats)[i];
                if (verbose)
-                   printf("[check %s]\n", pat->pattern());
+                   printf(_("[check %s]\n"), pat->pattern());
                fxStr tsi(line);
                if (pat->Find(tsi)) {
-                   printf("%s (matched by %s)\n",
-                       (*acceptTSI)[i] ? "accept" : "reject",
+                   printf(((*acceptTSI)[i] ?
+                           _("accept (matched by %s)\n") :
+                           _("reject (matched by %s)\n")),
                        pat->pattern());
                    break;
                }
            }
            if (i == tsiPats->length())
-               printf("reject (no pattern match)\n");
+               printf(_("reject (no pattern match)\n"));
        } else
-           printf("reject (no patterns)\n");
+           printf(_("reject (no patterns)\n"));
     }
     return (0);
 }
index 70001a229f232a5e5408a664b33fa86e9d6fa468..25e44928be7780d25b59a75307c39a44543238b8 100644 (file)
@@ -142,7 +142,7 @@ MIMEState::parse(const MsgFmt& msg, fxStr& emsg)
            type.lowercase();
            subtype.lowercase();
        } else {
-           emsg = "Syntax error parsing MIME Content-Type: " | *s;
+           emsg = _("Syntax error parsing MIME Content-Type: ") | *s;
            type = "text";              // reset on parsing error
            return (false);
        }
@@ -357,7 +357,7 @@ MIMEState::getLine(FILE* fd, fxStackBuffer& buf)
     case ENC_BASE64:   return getBase64Line(fd, buf);
     case ENC_UUENCODE: return getUUDecodeLine(fd, buf);
     }
-    fxFatal("Internal error, unsupported Content-Transfer-Encoding %u", encode);
+    fxFatal(_("Internal error, unsupported Content-Transfer-Encoding %u"), encode);
     /*NOTREACHED*/
     return (false);
 }
index adc130b16d8e28ebafc802b50acb67b8f05dc90e..518b48f8eb086b20e19fb7e16140707f05eb736b 100644 (file)
@@ -159,7 +159,7 @@ MsgFmt::parseHeaders(FILE* fd, u_int& lineno)
                    ;
                headers.append(line.tail(len-l));
                if (verbose)
-                   fprintf(stderr, "HEADER %s: %s\n"
+                   fprintf(stderr, _("HEADER %s: %s\n")
                        , (const char*) fields[fields.length()-1]
                        , (const char*) headers[headers.length()-1]
                    );
@@ -167,7 +167,7 @@ MsgFmt::parseHeaders(FILE* fd, u_int& lineno)
        } else if (field != "")  {              // append continuation
            headers[headers.length()-1].append("\n" | line);
            if (verbose)
-               fprintf(stderr, "+HEADER %s: %s\n"
+               fprintf(stderr, _("+HEADER %s: %s\n")
                    , (const char*) field
                    , (const char*) line
                );
index 4825d923abaa3d87f4761db6329a009de3e53233..81d1cb7deb14c15e77414a05069aa3313177b5c5 100644 (file)
@@ -131,7 +131,7 @@ faxMailApp::faxMailApp()
     setTitle("HylaFAX-Mail");
 
     if (Sys::mkdtemp(&tmpDir[0]) == NULL)
-       fxFatal("Cannot create temp directory %s", (const char*) tmpDir);
+       fxFatal(_("Cannot create temp directory %s"), (const char*) tmpDir);
 }
 
 faxMailApp::~faxMailApp()
@@ -263,7 +263,7 @@ faxMailApp::run(int argc, char** argv)
     if ((s = findHeader("x-fax-dialstring")))  // dialstring in envelope
        job->setDialString(*s);
     if (job->getDialString() == "")
-       fxFatal("No Destination/Dialstring specified");
+       fxFatal(_("No Destination/Dialstring specified"));
 
     /*
      * Establish the sender's identity.
@@ -273,7 +273,7 @@ faxMailApp::run(int argc, char** argv)
     } else if ((s = findHeader("from"))) {
        client->setFromIdentity(*s);
     } else {
-       fxFatal("No From/Sender identity specified");
+       fxFatal(_("No From/Sender identity specified"));
     }
 
     if (pageSize != "")
@@ -372,7 +372,7 @@ faxMailApp::run(int argc, char** argv)
 
     if (version && stripComments(*version) == "1.0") {
        if (verbose)
-           fprintf(stderr, "faxmail: This is a MIME message\n");
+           fprintf(stderr, _("faxmail: This is a MIME message\n"));
        beginFile();
        withinFile = true;
        // We only format top-level headers if they are
@@ -384,7 +384,7 @@ faxMailApp::run(int argc, char** argv)
        withinFile = false;
     } else {
        if (verbose)
-           fprintf(stderr, "faxmail: This is not a MIME message\n");
+           fprintf(stderr, _("faxmail: This is not a MIME message\n"));
        beginFile();
        withinFile = true;
        // We only format top-level headers if they are
@@ -419,7 +419,7 @@ faxMailApp::run(int argc, char** argv)
            client->hangupServer();
        }
        if (!status)
-           fxFatal("unable to process message:\n\t%s", (const char*) emsg);
+           fxFatal(_("unable to process message:\n\t%s"), (const char*) emsg);
     }
 }
 
@@ -518,7 +518,7 @@ faxMailApp::formatMultipart(FILE* fd, MIMEState& mime, MsgFmt& msg)
        while (! last) {
            int c = getc(fd);
            if (c == EOF) {
-               error("Badly formatted MIME; premature EOF");
+               error(_("Badly formatted MIME; premature EOF"));
                break;
            }
            ungetc(c, fd);                      // push back read ahead
@@ -615,7 +615,7 @@ bool
 faxMailApp::formatWithExternal (FILE* fd, const fxStr& app, MIMEState& mime)
 {
     if (verbose)
-       fprintf(stderr, "CONVERT: run %s\n", (const char*) app);
+       fprintf(stderr, _("CONVERT: run %s\n"), (const char*) app);
 
     fxStr tmp = tmpDir | "/" | mimeid;
     tmps.append(tmp);
@@ -645,13 +645,13 @@ faxMailApp::formatDiscarded(MIMEState& mime)
        fxStackBuffer buf;
        buf.put("-----------------------------\n");
        if (mime.getDescription() != "")
-           buf.fput("DISCARDED %s (%s/%s) GOES HERE\n"
+           buf.fput(_("DISCARDED %s (%s/%s) GOES HERE\n")
                , (const char*) mime.getDescription()
                , (const char*) mime.getType()
                , (const char*) mime.getSubType()
            );
        else
-           buf.fput("DISCARDED %s/%s GOES HERE\n"
+           buf.fput(_("DISCARDED %s/%s GOES HERE\n")
                , (const char*) mime.getType()
                , (const char*) mime.getSubType()
            );
@@ -711,7 +711,7 @@ faxMailApp::copyPart(FILE* fd, MIMEState& mime, fxStr& tmpFile)
     if (ftmp >= 0) {
         /*
         if (!Sys::isRegularFile(tmpFile)) {
-            error("%s: is not a regular file", (const char*) tmpFile);
+            error(_("%s: is not a regular file"), (const char*) tmpFile);
             return(false);
         }
         */
@@ -724,10 +724,10 @@ faxMailApp::copyPart(FILE* fd, MIMEState& mime, fxStr& tmpFile)
             Sys::close(ftmp);
             return (true);
         }
-        error("%s: write error: %s", (const char*) tmpFile, strerror(errno));
+        error(_("%s: write error: %s"), (const char*) tmpFile, strerror(errno));
         Sys::close(ftmp);
     } else {
-           error("%s: Can not create temporary file", (const char*) tmpFile);
+           error(_("%s: Can not create temporary file"), (const char*) tmpFile);
     }
     discardPart(fd, mime);
     return (false);
@@ -742,7 +742,7 @@ faxMailApp::runConverter(const fxStr& app, const fxStr& input, const fxStr& outp
 {
     int fd = Sys::open(output, O_WRONLY | O_CREAT | O_EXCL, S_IWUSR | S_IRUSR);
     if (fd < 0)
-       fxFatal("Couldn't open output file: %s", (const char*)output);
+       fxFatal(_("Couldn't open output file: %s"), (const char*)output);
 
     const char* av[3];
     av[0] = strrchr(app, '/');
@@ -755,7 +755,7 @@ faxMailApp::runConverter(const fxStr& app, const fxStr& input, const fxStr& outp
     switch (pid) {
     case -1:                           // error
        close(fd);
-       error("Error converting %s/%s; could not fork subprocess: %s"
+       error(_("Error converting %s/%s; could not fork subprocess: %s")
            , (const char*) mime.getType()
            , (const char*) mime.getSubType()
            , strerror(errno)
@@ -772,7 +772,7 @@ faxMailApp::runConverter(const fxStr& app, const fxStr& input, const fxStr& outp
        close(fd);
        if (Sys::waitpid(pid, status) == pid && status == 0)
            return (true);
-       error("Error converting %s/%s; command was \"%s %s\"; exit status %x"
+       error(_("Error converting %s/%s; command was \"%s %s\"; exit status %x")
            , (const char*) mime.getType()
            , (const char*) mime.getSubType()
            , (const char*) app
@@ -938,7 +938,7 @@ fxFatal(const char* fmt ...)
 void
 faxMailApp::usage()
 {
-    fxFatal("usage: faxmail"
+    fxFatal(_("usage: faxmail"
        " [-b boldfont]"
        " [-H pageheight]"
        " [-i italicfont]"
@@ -950,6 +950,6 @@ faxMailApp::usage()
        " [-C covertemplate]"
        " [-t notify]"
        " [-u user]"
-       " [-12cnNrRTv]"
+       " [-12cnNrRTv]")
     );
 }
index e92fd553fe805a11bde845114aeb693856798b56..2e97b3def5c1be3359eca1327911112626b0985a 100644 (file)
@@ -93,7 +93,7 @@ faxRmApp::run(int argc, char** argv)
                        emsg = getLastResponse();
                        break;
                    }
-                   printf("%s removed.\n", id);
+                   printf(_("%s removed.\n"), id);
                }
            }
        }
@@ -107,12 +107,12 @@ bool
 faxRmApp::removeJob(const char* id, fxStr& emsg)
 {
     if (jobKill(id)) {
-       printf("Job %s removed.\n", id);
+       printf(_("Job %s removed.\n"), id);
        return (true);
     }
     emsg = getLastResponse();
     if (getLastCode() == 504 && jobDelete(id)) {
-       printf("Job %s removed (from doneq).\n", id);
+       printf(_("Job %s removed (from doneq).\n"), id);
        emsg = "";
        return (true);
     }
@@ -132,7 +132,7 @@ faxRmApp::deleteDoc(const char* id)
 void
 faxRmApp::usage()
 {
-    fxFatal("usage: faxrm [-h server-host] [-adv] id...");
+    fxFatal(_("usage: faxrm [-h server-host] [-adv] id..."));
 }
 
 int
index 89d2ac0efb682d176791e5e227aee00cd4ddb2b0..b4e0648baa8506cc767e0f14a7b83869ef78411b 100644 (file)
@@ -95,7 +95,7 @@ faxStatApp::run(int argc, char** argv)
            setVerbose(true);
            break;
        case '?':
-           fxFatal("usage: faxstat [-h server-host] [-adfgilrsv]");
+           fxFatal(_("usage: faxstat [-h server-host] [-adfgilrsv]"));
        }
     fxStr emsg;
     if (callServer(emsg)) {
@@ -142,7 +142,7 @@ faxStatApp::listWithHeader(const fxStr& dir, fxStr& emsg)
            return (getReply(false) == COMPLETE);
        }
        if (cc < 0) {
-           emsg = fxStr::format("Data Connection: %s", strerror(errno));
+           emsg = fxStr::format(_("Data Connection: %s"), strerror(errno));
            (void) getReply(false);
            break;
        }
index 04a55cda442c3812093f6c284f0fcf1fca2dd279..b9fbc0972de6252b67b45f8e4d2210a4106d12d5 100644 (file)
@@ -236,12 +236,12 @@ sendFaxApp::run(int argc, char** argv)
         }
     }
     if (getNumberOfJobs() == 0) {
-        fprintf(stderr, "%s: No destination specified.\n",
+        fprintf(stderr, _("%s: No destination specified.\n"),
             (const char*) appName);
         usage();
     }
     if (!optionsUsed) {
-       fprintf(stderr, "%s: Unused options after last destination.\n",
+       fprintf(stderr, _("%s: Unused options after last destination.\n"),
            (const char*) appName);
        usage();
     }
@@ -261,8 +261,8 @@ sendFaxApp::run(int argc, char** argv)
             && submitJobs(emsg);
         if (status && waitForJob) {
             if (getNumberOfJobs() > 1) {
-                printWarning("can only wait for one job (right now),"
-                    " waiting for job %s.", (const char*) getCurrentJob());
+                printWarning(_("can only wait for one job (right now),"
+                    " waiting for job %s."), (const char*) getCurrentJob());
             }
             jobWait(getCurrentJob());
         }
@@ -275,8 +275,8 @@ sendFaxApp::run(int argc, char** argv)
 void
 sendFaxApp::usage()
 {
-    fxFatal("usage: %s [options] [files]\n"
-        "(Read the manual page; it's too complicated)", (const char*) appName);
+    fxFatal(_("usage: %s [options] [files]\n"
+        "(Read the manual page; it's too complicated)"), (const char*) appName);
 }
 
 /*
@@ -315,14 +315,14 @@ sendFaxApp::addDestination(const char* cp)
         }
     }
     if (dest.length() == 0) {
-        fatal("Null destination for \"%s\"", cp);
+        fatal(_("Null destination for \"%s\""), cp);
     }
     SendFaxJob& job = addJob();
     job.setDialString(dest);
     job.setCoverName(recipient);
     job.setSubAddress(subaddress);
     if(job.getDesiredSpeed() > BR_14400 && job.getDesiredEC() == false) {
-        printWarning("ECM disabled, limiting job to 14400 bps.");
+        printWarning(_("ECM disabled, limiting job to 14400 bps."));
         job.setDesiredSpeed(BR_14400);
     }
 }
@@ -345,7 +345,7 @@ sendFaxApp::addDestinationsFromFile(const char* filename)
                addDestination(dest);
        }
     } else {
-       fatal("%s: no such file", filename);
+       fatal(_("%s: no such file"), filename);
     }
 }
 
@@ -361,14 +361,14 @@ sendFaxApp::copyToTemporary(int fin, fxStr& tmpl)
     tmpl = buff;
     delete [] buff;
     if (fd < 0) {
-        fatal("%s: Can not create temporary file", (const char*) tmpl);
+        fatal(_("%s: Can not create temporary file"), (const char*) tmpl);
     }
     int cc, total = 0;
     char buf[16*1024];
     while ((cc = Sys::read(fin, buf, sizeof (buf))) > 0) {
         if (Sys::write(fd, buf, cc) != cc) {
             Sys::unlink(tmpl);
-            fatal("%s: write error", (const char*) tmpl);
+            fatal(_("%s: write error"), (const char*) tmpl);
         }
         total += cc;
     }
@@ -376,7 +376,7 @@ sendFaxApp::copyToTemporary(int fin, fxStr& tmpl)
     if (total == 0) {
         Sys::unlink(tmpl);
         tmpl = "";
-        fatal("No input data; tranmission aborted");
+        fatal(_("No input data; transmission aborted"));
     }
 }
 
index c7dfb0e947779c16b878991a49b722ee0af73656..36660e4ca45374c6a0377c387a82d58894a5a73c 100644 (file)
@@ -86,7 +86,7 @@ sendPageApp::run(int argc, char** argv)
        switch (c) {
        case 'a':                       // time at which to transmit page
            if (!proto.setHoldTime(optarg, emsg)) {
-               printError("Invalid hold time \"%s\": %s",
+               printError(_("Invalid hold time \"%s\": %s"),
                    optarg, (const char*) emsg);
                exit(-1);
            }
@@ -140,7 +140,7 @@ sendPageApp::run(int argc, char** argv)
        }
 
     if (getNumberOfJobs() == 0) {
-       fprintf(stderr, "%s: No pager identification number (PIN) specified.\n",
+       fprintf(stderr, _("%s: No pager identification number (PIN) specified.\n"),
            (const char*) appName);
        usage();
     }
@@ -173,7 +173,7 @@ sendPageApp::run(int argc, char** argv)
 void
 sendPageApp::usage()
 {
-    fxFatal("usage: %s"
+    fxFatal(_("usage: %s"
        " -p PIN [-p PIN ...]\n"
        " [-a time-to-send]"
        " [-l service-level]"
@@ -186,7 +186,7 @@ sendPageApp::usage()
        " [-t max-tries]"
        " [-T max-dials]"
        " [-nqvDNR]"
-       " [msgs ...]",
+       " [msgs ...]"),
        (const char*) appName);
 }
 
@@ -212,7 +212,7 @@ sendPageApp::copyToTemporary(int fin, fxStr& tmpl)
     }
        Sys::close(fd);
     } else
-       fatal("%s: Can not create temporary file", (const char*) tmpl);
+       fatal(_("%s: Can not create temporary file"), (const char*) tmpl);
 }
 
 void
index 972d1f133b48a98c183578a9a869bc9c0e01dd0a..199bd54b1361f42300fd528100e32cdb8135f3fd 100644 (file)
@@ -101,20 +101,20 @@ parseAtSyntax(const char* s, const struct tm& ref, struct tm& at0, fxStr& emsg)
            if (isdigit(cp[1]) && isdigit(cp[2])) {
                int min = 10*(cp[1]-'0') + (cp[2]-'0');
                if (min >= 60) {
-                   _atError(emsg, "Illegal minutes value %u", min);
+                   _atError(emsg, _("Illegal minutes value %u"), min);
                    return (false);
                }
                v += min;
                cp += 3;
            } else {
-               _atSyntax(emsg, "expecting HH:MM");
+               _atSyntax(emsg, _("expecting HH:MM"));
                return (false);
            }
        }
        cp = whitespace(cp);
        if (streq(cp, "am", 2)) {
            if (v >= HALFDAY+HOUR) {
-               _atError(emsg, "%u:%02u is not an AM value", v/HOUR, v%HOUR);
+               _atError(emsg, _("%u:%02u is not an AM value"), v/HOUR, v%HOUR);
                return (false);
            }
            if (HALFDAY <= v && v < HALFDAY+HOUR)
@@ -122,7 +122,7 @@ parseAtSyntax(const char* s, const struct tm& ref, struct tm& at0, fxStr& emsg)
            cp += 2;
        } else if (streq(cp, "pm", 2)) {
            if (v >= HALFDAY+HOUR) {
-               _atError(emsg, "%u:%02u is not a PM value", v/HOUR, v%HOUR);
+               _atError(emsg, _("%u:%02u is not a PM value"), v/HOUR, v%HOUR);
                return (false);
            }
            if (v < HALFDAY)
@@ -143,12 +143,12 @@ parseAtSyntax(const char* s, const struct tm& ref, struct tm& at0, fxStr& emsg)
            v = at.tm_hour*HOUR + at.tm_min;
            cp += 4;
        } else {
-           _atSyntax(emsg, "unrecognized symbolic time \"%s\"", cp);
+           _atSyntax(emsg, _("unrecognized symbolic time \"%s\""), cp);
            return (false);
        }
     }
     if ((unsigned) v >= FULLDAY) {
-       _atError(emsg, "Illegal time value; out of range");
+       _atError(emsg, _("Illegal time value; out of range"));
        return (false);
     }
     at.tm_hour = v/HOUR;
@@ -172,7 +172,7 @@ parseAtSyntax(const char* s, const struct tm& ref, struct tm& at0, fxStr& emsg)
            at.tm_yday++;
            cp += 8;
        } else if (cp[0] != '\0' && cp[0] != '+') {
-           _atSyntax(emsg, "expecting \"+\" after time");
+           _atSyntax(emsg, _("expecting \"+\" after time"));
            return (false);
        }
        /*
@@ -188,7 +188,7 @@ parseAtSyntax(const char* s, const struct tm& ref, struct tm& at0, fxStr& emsg)
        return (false);
     fixup(at);
     if (at < ref) {
-       _atError(emsg, "Invalid date/time; time must be in the future");
+       _atError(emsg, _("Invalid date/time; time must be in the future"));
        return (false);
     }
     at0 = at;
@@ -314,7 +314,7 @@ parseMonthAndYear(const char*& cp, const struct tm& ref, struct tm& at, fxStr& e
     char* tp;
     at.tm_mday = (u_int) strtoul(cp, &tp, 10);
     if (tp == cp) {
-       _atSyntax(emsg, "missing or invalid day of month");
+       _atSyntax(emsg, _("missing or invalid day of month"));
        return (false);
     }
     at.tm_mday--;                      // tm_mday is [0..31]
@@ -323,11 +323,11 @@ parseMonthAndYear(const char*& cp, const struct tm& ref, struct tm& at, fxStr& e
        char* xp;
        u_int year = (u_int) strtoul(++tp, &xp, 10);
        if (tp == xp) {
-           _atSyntax(emsg, "missing year");
+           _atSyntax(emsg, _("missing year"));
            return (false);
        }
        if (year < TM_YEAR_BASE) {
-           _atError(emsg, "Sorry, cannot handle dates before %u",
+           _atError(emsg, _("Sorry, cannot handle dates before %u"),
                TM_YEAR_BASE);
            return (false);
        }
@@ -350,7 +350,7 @@ parseMonthAndYear(const char*& cp, const struct tm& ref, struct tm& at, fxStr& e
     }
     const int* days = daysInMonth[isLeapYear(at)];
     if (at.tm_mday > days[at.tm_mon]) {
-       _atError(emsg, "Invalid day of month, %s has only %u days",
+       _atError(emsg, _("Invalid day of month, %s has only %u days"),
            months[at.tm_mon], days[at.tm_mon]);
        return (false);
     }
@@ -366,7 +366,7 @@ parseMultiplier(const char* cp, struct tm& at, fxStr& emsg)
 {
     cp = whitespace(cp);
     if (!isdigit(cp[0])) {
-       _atSyntax(emsg, "expecting number after \"+\"");
+       _atSyntax(emsg, _("expecting number after \"+\""));
        return (false);
     }
     int v = 0;
@@ -374,7 +374,7 @@ parseMultiplier(const char* cp, struct tm& at, fxStr& emsg)
        v = v*10 + (*cp - '0');
     cp = whitespace(cp);
     if (*cp == '\0') {
-       _atSyntax(emsg, "\"+%u\" without unit", v);
+       _atSyntax(emsg, _("\"+%u\" without unit"), v);
        return (false);
     }
     if (streq(cp, "minute", 6))
@@ -393,7 +393,7 @@ parseMultiplier(const char* cp, struct tm& at, fxStr& emsg)
     } else if (streq(cp, "year", 4))
        at.tm_year += v;
     else {
-       _atError(emsg, "Unknown increment unit \"%s\"", cp);
+       _atError(emsg, _("Unknown increment unit \"%s\""), cp);
        return (false);
     }
     return (true);
@@ -447,7 +447,7 @@ _atSyntax(fxStr& emsg, const char* fmt, ...)
 {
     va_list ap;
     va_start(ap, fmt);
-    emsg = "Syntax error, " | fxStr::vformat(fmt, ap);
+    emsg = _("Syntax error, ") | fxStr::vformat(fmt, ap);
     va_end(ap);
 }
 
index 2b0e1e2008345cd958f56d1ef6f1510bef43fd59..bb375f20d002c77f0920868caea8e7b717772c54 100644 (file)
@@ -801,14 +801,14 @@ Class2Params::decodeCaps(u_int v)
  * Routines for printing some Class 2 capabilities.
  */
 const char* Class2Params::verticalResNames[65] = {
-    "3.85 line/mm",
-    "7.7 line/mm",
-    "15.4 line/mm", "",
-    "R16 x 15.4 line/mm", "", "", "",
-    "200 x 100 dpi", "", "", "", "", "", "", "",
-    "200 x 200 dpi", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
-    "200 x 400 dpi", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
-    "300 x 300 dpi"
+    N_("3.85 line/mm"),
+    N_("7.7 line/mm"),
+    N_("15.4 line/mm"), "",
+    N_("R16 x 15.4 line/mm"), "", "", "",
+    N_("200 x 100 dpi"), "", "", "", "", "", "", "",
+    N_("200 x 200 dpi"), "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
+    N_("200 x 400 dpi"), "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
+    N_("300 x 300 dpi")
 };
 
 const char* Class2Params::verticalResName() const
@@ -833,22 +833,22 @@ const char* Class2Params::bestVerticalResName() const
 
 
 const char* Class2Params::bitRateNames[16] = {
-    "2400 bit/s",              // BR_2400
-    "4800 bit/s",              // BR_4800
-    "7200 bit/s",              // BR_7200
-    "9600 bit/s",              // BR_9600
-    "12000 bit/s",             // BR_12000
-    "14400 bit/s",             // BR_14400
-    "16800 bit/s",             // BR_16800
-    "19200 bit/s",             // BR_19200
-    "21600 bit/s",             // BR_21600
-    "24000 bit/s",             // BR_24000
-    "26400 bit/s",             // BR_26400
-    "28800 bit/s",             // BR_28800
-    "31200 bit/s",             // BR_31200
-    "33600 bit/s",             // BR_33600
-    "0 bit/s",                 // 14 ???
-    "0 bit/s",                 // 15 ???
+    N_("2400 bit/s"),          // BR_2400
+    N_("4800 bit/s"),          // BR_4800
+    N_("7200 bit/s"),          // BR_7200
+    N_("9600 bit/s"),          // BR_9600
+    N_("12000 bit/s"),         // BR_12000
+    N_("14400 bit/s"),         // BR_14400
+    N_("16800 bit/s"),         // BR_16800
+    N_("19200 bit/s"),         // BR_19200
+    N_("21600 bit/s"),         // BR_21600
+    N_("24000 bit/s"),         // BR_24000
+    N_("26400 bit/s"),         // BR_26400
+    N_("28800 bit/s"),         // BR_28800
+    N_("31200 bit/s"),         // BR_31200
+    N_("33600 bit/s"),         // BR_33600
+    N_("0 bit/s"),             // 14 ???
+    N_("0 bit/s"),             // 15 ???
 };
 const char* Class2Params::bitRateName() const
     { return (bitRateNames[br&15]); }
@@ -877,13 +877,13 @@ Class2Params::bitRate() const
 }
 
 const char* Class2Params::dataFormatNames[7] = {
-    "1-D MH",                  // DF_1DMH
-    "2-D MR",                  // DF_2DMR
-    "2-D Uncompressed Mode",   // DF_2DMRUNCOMP
-    "2-D MMR",                 // DF_2DMMR
-    "JBIG",                    // DF_JBIG
-    "JPEG Greyscale",          // JP_GREY
-    "JPEG Full-Color"          // JP_COLOR
+    N_("1-D MH"),                      // DF_1DMH
+    N_("2-D MR"),                      // DF_2DMR
+    N_("2-D Uncompressed Mode"),       // DF_2DMRUNCOMP
+    N_("2-D MMR"),                     // DF_2DMMR
+    N_("JBIG"),                                // DF_JBIG
+    N_("JPEG Greyscale"),              // JP_GREY
+    N_("JPEG Full-Color")              // JP_COLOR
 };
 const char* Class2Params::dataFormatName() const
      { return (dataFormatNames[df+(jp > 0 && jp < (u_int) -1 ? jp + 4 : 0)]); }
@@ -891,59 +891,59 @@ const char* Class2Params::dataFormatName() const
 fxStr
 Class2Params::dataFormatsName()
 {
-    fxStr formats = "MH";
-    if (df & BIT(DF_2DMR)) formats.append(", MR");
-    if (df & BIT(DF_2DMMR)) formats.append(", MMR");
-    if (df & BIT(DF_JBIG)) formats.append(", JBIG");
+    fxStr formats = N_("MH");
+    if (df & BIT(DF_2DMR)) formats.append(N_(", MR"));
+    if (df & BIT(DF_2DMMR)) formats.append(N_(", MMR"));
+    if (df & BIT(DF_JBIG)) formats.append(N_(", JBIG"));
     // since color requires greyscale, just say one or the other
-    if (jp & BIT(JP_COLOR)) formats.append(", JPEG Full-Color");
-    else if (jp & BIT(JP_GREY))  formats.append(", JPEG Greyscale");
+    if (jp & BIT(JP_COLOR)) formats.append(N_(", JPEG Full-Color"));
+    else if (jp & BIT(JP_GREY))  formats.append(N_(", JPEG Greyscale"));
     return (formats);
 }
 
 const char* Class2Params::pageWidthNames[8] = {
-    "A4 page width (215 mm)",
-    "B4 page width (255 mm)",
-    "A3 page width (303 mm)",
-    "page width 151 mm",
-    "page width 107 mm",
-    "undefined page width (wd=5)",
-    "undefined page width (wd=6)",
-    "undefined page width (wd=7)",
+    N_("A4 page width (215 mm)"),
+    N_("B4 page width (255 mm)"),
+    N_("A3 page width (303 mm)"),
+    N_("page width 151 mm"),
+    N_("page width 107 mm"),
+    N_("undefined page width (wd=5)"),
+    N_("undefined page width (wd=6)"),
+    N_("undefined page width (wd=7)"),
 };
 const char* Class2Params::pageWidthName() const
     { return (pageWidthNames[wd&7]); }
 
 const char* Class2Params::pageLengthNames[4] = {
-    "A4 page length (297 mm)",
-    "B4 page length (364 mm)",
-    "unlimited page length",
-    "invalid page length (ln=3)",
+    N_("A4 page length (297 mm)"),
+    N_("B4 page length (364 mm)"),
+    N_("unlimited page length"),
+    N_("invalid page length (ln=3)"),
 };
 const char* Class2Params::pageLengthName() const
     { return (pageLengthNames[ln&3]); }
 
 const char* Class2Params::scanlineTimeNames[8] = {
-    "0 ms/scanline",
-    "5 ms/scanline",
-    "10 ms, 5 ms/scanline",
-    "10 ms/scanline",
-    "20 ms, 10 ms/scanline",
-    "20 ms/scanline",
-    "40 ms, 20 ms/scanline",
-    "40 ms/scanline",
+    N_("0 ms/scanline"),
+    N_("5 ms/scanline"),
+    N_("10 ms, 5 ms/scanline"),
+    N_("10 ms/scanline"),
+    N_("20 ms, 10 ms/scanline"),
+    N_("20 ms/scanline"),
+    N_("40 ms, 20 ms/scanline"),
+    N_("40 ms/scanline"),
 };
 const char* Class2Params::scanlineTimeName() const
     { return (scanlineTimeNames[st&7]); }
 const char* Class2Params::ecmNames[8] = {
-    "no ECM",
-    "T.30 Annex A, 64-byte ECM",
-    "T.30 Annex A, 256-byte ECM",
-    "T.30 Annex C, half duplex ECM",
-    "T.30 Annex C, full duplex ECM",
-    "undefined ECM",
-    "undefined ECM",
-    "undefined ECM"
+    N_("no ECM"),
+    N_("T.30 Annex A, 64-byte ECM"),
+    N_("T.30 Annex A, 256-byte ECM"),
+    N_("T.30 Annex C, half duplex ECM"),
+    N_("T.30 Annex C, full duplex ECM"),
+    N_("undefined ECM"),
+    N_("undefined ECM"),
+    N_("undefined ECM")
 };
 const char* Class2Params::ecmName() const
     { return (ecmNames[ec&7]); }
index c7fe28f6beee38479aa264e0ea0f0606625b0a20..7e4057cd372826ccb074a839397612a4cd5d2ebb 100644 (file)
@@ -93,7 +93,7 @@ DialStringRules::parse(bool shouldExist)
        ok = parseRules();
        fclose(fp);
     } else if (shouldExist)
-       parseError("Cannot open file \"%s\" for reading",
+       parseError(_("Cannot open file \"%s\" for reading"),
                (const char*) filename);
     return (ok);
 }
@@ -102,7 +102,7 @@ void
 DialStringRules::def(const fxStr& var, const fxStr& value)
 {
     if (verbose)
-       traceParse("Define %s = \"%s\"",
+       traceParse(_("Define %s = \"%s\""),
            (const char*) var, (const char*) value);
     (*vars)[var] = value;
 }
@@ -111,7 +111,7 @@ void
 DialStringRules::undef(const fxStr& var)
 {
     if (verbose)
-       traceParse("Undefine %s", (const char*) var);
+       traceParse(_("Undefine %s"), (const char*) var);
     vars->remove(var);
 }
 
@@ -123,7 +123,7 @@ DialStringRules::parseRules()
     while ((cp = nextLine(line, sizeof (line)))) {
        // collect token
        if (!isalpha(*cp)) {
-           parseError("Syntax error, expecting identifier");
+           parseError(_("Syntax error, expecting identifier"));
            return (false);
        }
        const char* tp = cp;
@@ -135,7 +135,7 @@ DialStringRules::parseRules()
        if (*cp == ':' && cp[1] == '=') {       // rule set definition
            for (cp += 2; *cp != '['; cp++)
                if (*cp == '\0') {
-                   parseError("Missing '[' while parsing rule set");
+                   parseError(_("Missing '[' while parsing rule set"));
                    return (false);
                }
            if (verbose)
@@ -154,17 +154,17 @@ DialStringRules::parseRules()
                return (false);
            def(var, value);
        } else {                                // an error
-           parseError("Missing '=' or ':=' after \"%s\"", (const char*) var);
+           parseError(_("Missing '=' or ':=' after \"%s\""), (const char*) var);
            return (false);
        }
     }
     if (verbose) {
        RuleArray* ra = (*rules)["CanonicalNumber"];
        if (ra == 0)
-           traceParse("Warning, no \"CanonicalNumber\" rules.");
+           traceParse(_("Warning, no \"CanonicalNumber\" rules."));
        ra = (*rules)["DialString"];
        if (ra == 0)
-           traceParse("Warning, no \"DialString\" rules.");
+           traceParse(_("Warning, no \"DialString\" rules."));
     }
     return (true);
 }
@@ -212,11 +212,11 @@ DialStringRules::parseToken(const char* cp, fxStr& v)
        tp = ++cp;
        for (;;) {
            if (*cp == '\0') {
-               parseError("String with unmatched '\"'");
+               parseError(_("String with unmatched '\"'"));
                return (NULL);
            }
            if (*cp == '\\' && cp[1] == '\0') {
-               parseError("Bad '\\' escape sequence");
+               parseError(_("Bad '\\' escape sequence"));
                return (NULL);
            }
            if (*cp == '"' && (cp == tp || cp[-1] != '\\'))
@@ -228,7 +228,7 @@ DialStringRules::parseToken(const char* cp, fxStr& v)
     } else {                           // token terminated by white space
        for (tp = cp; *cp != '\0'; cp++) {
            if (*cp == '\\' && cp[1] == '\0') {
-               parseError("Bad '\\' escape sequence");
+               parseError(_("Bad '\\' escape sequence"));
                return (NULL);
            }
            if (isspace(*cp) && (cp == tp || cp[-1] != '\\'))
@@ -243,7 +243,7 @@ DialStringRules::parseToken(const char* cp, fxStr& v)
             */
            u_int l = v.next(i, '}');
            if (l >= v.length()) {
-               parseError("Missing '}' for variable reference");
+               parseError(_("Missing '}' for variable reference"));
                return (NULL);
            }
            fxStr var = v.cut(i+2,l-(i+2));// variable name
@@ -290,7 +290,7 @@ DialStringRules::parseRuleSet(RuleArray& rules)
        char line[1024];
        const char* cp = nextLine(line, sizeof (line));
        if (!cp) {
-           parseError("Missing ']' while parsing rule set");
+           parseError(_("Missing ']' while parsing rule set"));
            return (false);
        }
        if (*cp == ']')
@@ -302,7 +302,7 @@ DialStringRules::parseRuleSet(RuleArray& rules)
        while (isspace(*cp))
            cp++;
        if (*cp != '=') {
-           parseError("Rule pattern without '='");
+           parseError(_("Rule pattern without '='"));
            return (false);
        }
        DialRule r;
@@ -338,7 +338,7 @@ fxStr
 DialStringRules::applyRules(const fxStr& name, const fxStr& s)
 {
     if (verbose)
-       traceRules("Apply %s rules to \"%s\"",
+       traceRules(_("Apply %s rules to \"%s\""),
            (const char*) name, (const char*) s);
     fxStr result(s);
     RuleArray* ra = (*rules)[name];
@@ -376,13 +376,13 @@ DialStringRules::applyRules(const fxStr& name, const fxStr& s)
                result.insert(replace, ix);
                off = ix + replace.length();    // skip replace when searching
                if (verbose)
-                   traceRules("--> match rule \"%s\", result now \"%s\"",
+                   traceRules(_("--> match rule \"%s\", result now \"%s\""),
                        rule.pat->pattern(), (const char*) result);
            }
        }
     }
     if (verbose)
-       traceRules("--> return result \"%s\"", (const char*) result);
+       traceRules(_("--> return result \"%s\""), (const char*) result);
     return result;
 }
 
@@ -393,7 +393,7 @@ DialStringRules::parseError(const char* fmt ...)
 {
     va_list ap;
     va_start(ap, fmt);
-    fprintf(stderr, "%s: line %u: ", (const char*) filename, lineno); 
+    fprintf(stderr, _("%s: line %u: "), (const char*) filename, lineno);
     vfprintf(stderr, fmt, ap);
     va_end(ap);
     putc('\n', stderr);
@@ -404,7 +404,7 @@ DialStringRules::traceParse(const char* fmt ...)
 {
     va_list ap;
     va_start(ap, fmt);
-    fprintf(stdout, "%s: line %u: ", (const char*) filename, lineno); 
+    fprintf(stdout, _("%s: line %u: "), (const char*) filename, lineno);
     vfprintf(stdout, fmt, ap);
     va_end(ap);
     putc('\n', stdout);
index 4ea185af8d52e67fe9d5d7b620bfc5adb7e9cf8a..cd156306b5f945c15d6b72d38ff7a971c643ed54 100644 (file)
@@ -113,7 +113,7 @@ FaxClient::printWarning(const char* fmt ...)
 void
 FaxClient::vprintWarning(const char* fmt, va_list ap)
 {
-    fprintf(stderr, "Warning, ");
+    fprintf(stderr, _("Warning, "));
     vfprintf(stderr, fmt, ap);
     fputs("\n", stderr);
 }
@@ -188,8 +188,8 @@ FaxClient::setupUserIdentity(fxStr& emsg)
        if (name)
            userName = name;
        else {
-           emsg = fxStr::format("Can not locate your password entry "
-               "(uid %lu): %s", (u_long) getuid(), strerror(errno));
+           emsg = fxStr::format(_("Can not locate your password entry "
+               "(uid %lu): %s"), (u_long) getuid(), strerror(errno));
            return (false);
        }
     }
@@ -214,8 +214,8 @@ FaxClient::setupUserIdentity(fxStr& emsg)
     } else
        senderName = userName;
     if (senderName.length() == 0) {
-       emsg = "Bad (null) user name; your password file entry"
-           " probably has bogus GECOS field information.";
+       emsg = _("Bad (null) user name; your password file entry"
+           " probably has bogus GECOS field information.");
        return (false);
     } else
        return (true);
@@ -381,7 +381,7 @@ FaxClient::login(const char* user, fxStr& emsg)
        user = userName;
     }
     if (*user == '\0') {
-       emsg = "Malformed (null) username";
+       emsg = _("Malformed (null) username");
        return (false);
     }
     int n = command("USER %s", user);
@@ -402,7 +402,7 @@ FaxClient::login(const char* user, fxStr& emsg)
        }
        return (true);
     } else {
-       emsg = "Login failed: " | lastResponse;
+       emsg = _("Login failed: ") | lastResponse;
        return (false);
     }
 }
@@ -423,7 +423,7 @@ bool
 FaxClient::admin(const char* pass, fxStr& emsg)
 {
     if (command("ADMIN %s", pass ? pass : getpass("Password:")) != COMPLETE) {
-       emsg = "Admin failed: " | lastResponse;
+       emsg = _("Admin failed: ") | lastResponse;
        return (false);
     } else
        return (true);
@@ -439,7 +439,7 @@ FaxClient::setCommon(FaxParam& parm, u_int v)
                return (false);
            }
        } else {
-           printError("Bad %s parameter value %u.", parm.cmd, v);
+           printError(_("Bad %s parameter value %u."), parm.cmd, v);
            return (false);
        }
        this->*parm.pv = v;
@@ -479,7 +479,7 @@ FaxClient::setTimeZone(u_int v)
             if (v == TZ_GMT) state &= ~FS_TZPEND;
             else state |= FS_TZPEND;
         } else {
-            printError("Bad time zone parameter value %u.", v);
+            printError(_("Bad time zone parameter value %u."), v);
             return (false);
         }
         return (true);
@@ -518,7 +518,7 @@ FaxClient::initDataConn(fxStr& emsg)
     if (transport) {
         if (!transport->initDataConn(emsg)) {
             if (emsg == "") {
-                emsg = "Unable to initialize data connection to server";
+                emsg = _("Unable to initialize data connection to server");
             }
             return (false);
         }
@@ -532,7 +532,7 @@ FaxClient::openDataConn(fxStr& emsg)
     if (transport) {
         if (!transport->openDataConn(emsg)) {
             if (emsg == "") {
-               emsg = "Unable to open data connection to server";
+               emsg = _("Unable to open data connection to server");
             }
                return (false);
         }
@@ -556,7 +556,7 @@ FaxClient::abortDataConn(fxStr& emsg)
         fflush(fdOut);
         if (!transport->abortCmd(emsg)) {
             if (emsg == "") {
-               emsg = "Unable to abort data connection to server";
+               emsg = _("Unable to abort data connection to server");
             }
                return (false);
         }
@@ -586,14 +586,14 @@ FaxClient::abortDataConn(fxStr& emsg)
 void
 FaxClient::lostServer(void)
 {
-    printError("Service not available, remote server closed connection");
+    printError(_("Service not available, remote server closed connection"));
     hangupServer();
 }
 
 void
 FaxClient::unexpectedResponse(fxStr& emsg)
 {
-    emsg = "Unexpected server response: " | lastResponse;
+    emsg = _("Unexpected server response: ") | lastResponse;
 }
 
 void
@@ -601,7 +601,7 @@ FaxClient::protocolBotch(fxStr& emsg, const char* fmt ...)
 {
     va_list ap;
     va_start(ap, fmt);
-    emsg = "Protocol botch" | fxStr::vformat(fmt, ap);
+    emsg = _("Protocol botch") | fxStr::vformat(fmt, ap);
     va_end(ap);
 }
 
@@ -636,7 +636,7 @@ FaxClient::vcommand(const char* fmt, va_list ap)
         } else {
            line = (char *)malloc(100);
            if (line == NULL)
-               printError("Memory allocation failed");
+               printError(_("Memory allocation failed"));
            else {
                vsnprintf(line, 100, fmt, ap);
                traceServer("-> %s", line);
@@ -644,7 +644,7 @@ FaxClient::vcommand(const char* fmt, va_list ap)
         }
     }
     if (fdOut == NULL) {
-        printError("No control connection for command");
+        printError(_("No control connection for command"));
         code = -1;
         return (0);
     }
@@ -779,14 +779,14 @@ FaxClient::extract(u_int& pos, const char* pattern, fxStr& result,
         l = lastResponse.find(pos, pat);
     }
     if (l == lastResponse.length()) {
-        protocolBotch(emsg, ": No \"%s\" in %s response: %s",
+        protocolBotch(emsg, _(": No \"%s\" in %s response: %s"),
             pattern, cmd, (const char*) lastResponse);
         return false;
     }
     l = lastResponse.skip(l+pat.length(), ' ');// skip white space
     result = lastResponse.extract(l, lastResponse.next(l, ' ')-l);
     if (result == "") {
-        protocolBotch(emsg, ": Null %s in %s response: %s",
+        protocolBotch(emsg, _(": Null %s in %s response: %s"),
             pattern, cmd, (const char*) lastResponse);
         return false;
     }
@@ -950,7 +950,7 @@ FaxClient::runScript(const char* filename, fxStr& emsg)
        ok = runScript(fd, filename, emsg);
        fclose(fd);
     } else
-       emsg = fxStr::format("Unable to open script file \"%s\".", filename);
+       emsg = fxStr::format(_("Unable to open script file \"%s\"."), filename);
     return (ok);
 }
 
@@ -969,7 +969,7 @@ FaxClient::runScript(FILE* fp, const char* filename, fxStr& emsg)
        if (Sys::read(fileno(fp), addr, (u_int) sb.st_size) == sb.st_size)
            ok = runScript(addr, sb.st_size, filename, emsg);
        else
-           emsg = fxStr::format("%s: Read error: %s",
+           emsg = fxStr::format(_("%s: Read error: %s"),
                filename, strerror(errno));
        delete [] addr;
 #if HAS_MMAP
@@ -994,7 +994,7 @@ FaxClient::runScript(const char* script, u_long scriptLen,
        u_int cmdLen = ep-script;
        if (cmdLen > 1) {
            if (command("%.*s", cmdLen, script) != COMPLETE) {
-               emsg = fxStr::format("%s: line %u: %s",
+               emsg = fxStr::format(_("%s: line %u: %s"),
                    filename, lineno, (const char*) lastResponse);
                return (false);
            }
@@ -1084,14 +1084,14 @@ FaxClient::sendRawData(void* buf, int cc, fxStr& emsg)
     for (int cnt, sent = 0; cc; sent += cnt, cc -= cnt) 
        if ((cnt = write(fdData, bp + sent, cc)) <= 0) {
            protocolBotch(emsg, errno == EPIPE ?
-               " (server closed connection)" : " (server write error: %s).",
+               _(" (server closed connection)") : _(" (server write error: %s)."),
                strerror(errno));
            return (false);
        }
 #else
     if (write(fdData, buf, cc) != cc) {
        protocolBotch(emsg, errno == EPIPE ?
-           " (server closed connection)" : " (server write error: %s).",
+           _(" (server closed connection)") : _(" (server write error: %s)."),
            strerror(errno));
        return (false);
     }
@@ -1113,7 +1113,7 @@ FaxClient::sendData(int fd,
     size_t cc;
     (void) Sys::fstat(fd, sb);
     if (getVerbose())
-       traceServer("SEND data, %lu bytes", (u_long) sb.st_size);
+       traceServer(_("SEND data, %lu bytes"), (u_long) sb.st_size);
     if (!initDataConn(emsg))
        goto bad;
     if (!setMode(MODE_S))
@@ -1131,7 +1131,7 @@ FaxClient::sendData(int fd,
            char buf[32*1024];                  // XXX better if page-aligned
            size_t n = fxmin(cc, sizeof (buf));
            if (read(fd, buf, n) != (ssize_t)n) {
-               protocolBotch(emsg, " (data read: %s).", strerror(errno));
+               protocolBotch(emsg, _(" (data read: %s)."), strerror(errno));
                goto bad;
            }
            if (!sendRawData(buf, n, emsg))
@@ -1182,7 +1182,7 @@ FaxClient::sendZData(int fd,
        size_t cc;
        Sys::fstat(fd, sb);
        if (getVerbose())
-           traceServer("SEND compressed data, %lu bytes", (u_long) sb.st_size);
+           traceServer(_("SEND compressed data, %lu bytes"), (u_long) sb.st_size);
        if (!initDataConn(emsg))
            goto bad;
        if (!setMode(MODE_Z))
@@ -1200,14 +1200,14 @@ FaxClient::sendZData(int fd,
                char buf[32*1024];
                int n = fxmin((size_t) cc, sizeof (buf));
                if (read(fd, buf, n) != n) {
-                   protocolBotch(emsg, " (data read: %s)", strerror(errno));
+                   protocolBotch(emsg, _(" (data read: %s)"), strerror(errno));
                    goto bad;
                }
                zstream.next_in = (Bytef*) buf;
                zstream.avail_in = n;
                do {
                    if (deflate(&zstream, Z_NO_FLUSH) != Z_OK) {
-                       emsg = fxStr::format("zlib compressor error: %s",
+                       emsg = fxStr::format(_("zlib compressor error: %s"),
                            zstream.msg);
                        goto bad;
                    }
@@ -1227,7 +1227,7 @@ FaxClient::sendZData(int fd,
            zstream.avail_in = (u_int) sb.st_size;
            do {
                if (deflate(&zstream, Z_NO_FLUSH) != Z_OK) {
-                   emsg = fxStr::format("zlib compressor error: %s",
+                   emsg = fxStr::format(_("zlib compressor error: %s"),
                        zstream.msg);
                    goto bad;
                }
@@ -1253,13 +1253,13 @@ FaxClient::sendZData(int fd,
                }
                break;
            default:
-               emsg = fxStr::format("zlib compressor error: %s",
+               emsg = fxStr::format(_("zlib compressor error: %s"),
                    zstream.msg);
                goto bad;
            }
        } while (dstate != Z_STREAM_END);
        if (getVerbose())
-           traceServer("SEND %lu bytes transmitted (%.1fx compression)",
+           traceServer(_("SEND %lu bytes transmitted (%.1fx compression)"),
 #define        NZ(x)   ((x)?(x):1)
                zstream.total_out, float(sb.st_size) / NZ(zstream.total_out));
        closeDataConn();
@@ -1280,7 +1280,7 @@ bad:
 #endif
        deflateEnd(&zstream);
     } else
-       emsg = fxStr::format("Can not initialize compression library: %s",
+       emsg = fxStr::format(_("Can not initialize compression library: %s"),
            zstream.msg);
     return (false);
 }
@@ -1322,7 +1322,7 @@ FaxClient::recvData(bool (*f)(int, const char*, int, fxStr&),
            return (getReply(false) == COMPLETE);
        }
        if (cc < 0) {
-           emsg = fxStr::format("Data Connection: %s", strerror(errno));
+           emsg = fxStr::format(_("Data Connection: %s"), strerror(errno));
            (void) getReply(false);
            break;
        }
@@ -1385,7 +1385,7 @@ FaxClient::recvZData(bool (*f)(void*, const char*, int, fxStr&),
                return (getReply(false) == COMPLETE);
            }
            if (cc < 0) {
-               emsg = fxStr::format("Data Connection: %s", strerror(errno));
+               emsg = fxStr::format(_("Data Connection: %s"), strerror(errno));
                (void) getReply(false);
                goto bad;
            }
@@ -1396,7 +1396,7 @@ FaxClient::recvZData(bool (*f)(void*, const char*, int, fxStr&),
                if (dstate == Z_STREAM_END)
                    break;
                if (dstate != Z_OK) {
-                   emsg = fxStr::format("Decoding error: %s", zstream.msg);
+                   emsg = fxStr::format(_("Decoding error: %s"), zstream.msg);
                    goto bad;
                }
                size_t occ = sizeof (obuf) - zstream.avail_out;
@@ -1410,7 +1410,7 @@ bad:
        closeDataConn();
        inflateEnd(&zstream);
     } else
-       emsg = fxStr::format("Can not initialize decoder: %s", zstream.msg);
+       emsg = fxStr::format(_("Can not initialize decoder: %s"), zstream.msg);
     return (false);
 }
 
@@ -1589,9 +1589,9 @@ FaxClient::makeHeader(const char* fmt, const FaxFmtHeader fmts[], fxStr& header)
                if (fspec[1] == '-')    // left justify
                    width = -width;
                if (width == 0 && prec == 0)
-                   header.append(hp->title);
+                   header.append(_(hp->title));
                else
-                   header.append(fxStr::format("%*.*s", width, prec, hp->title));
+                   header.append(fxStr::format("%*.*s", width, prec, _(hp->title)));
            } else {
                *fp++ = c;
                header.append(fxStr(fspec, fp-fspec));
@@ -1606,59 +1606,59 @@ FaxClient::makeHeader(const char* fmt, const FaxFmtHeader fmts[], fxStr& header)
  * queue status listings returned by the server.
  */
 const FaxClient::FaxFmtHeader FaxClient::jobFormats[] = {
-    { 'A',     "SUB" },        // A (subaddr)
-    { 'B',     "PWD" },        // B (passwd)
-    { 'C',     "Company" },    // C (company)
-    { 'D',     "Dials" },      // D (totdials & maxdials)
-    { 'E',     "BR" },         // E (desiredbr)
-    { 'F',     "Tagline" },    // F (tagline)
-    { 'G',     "ST" },         // G (desiredst)
-    { 'H',     "DF" },         // H (desireddf)
-    { 'I',     "UsrPri" },     // I (usrpri)
-    { 'J',     "JobTag" },     // J (jobtag)
-    { 'K',     "EC" },         // K (desiredec as symbol)
-    { 'L',     "Location" },   // L (location)
-    { 'M',     "MailAddr" },   // M (mailaddr)
-    { 'N',     "DT" },         // N (desiredtl as symbol)
-    { 'O',     "CC" },         // O (useccover as symbol)
-    { 'P',     "Pages" },      // P (npages & totpages)
-    { 'Q',     "MinSP" },      // Q (minsp)
-    { 'R',     "Receiver" },   // R (receiver)
-    { 'S',     "Sender" },     // S (sender)
-    { 'T',     "Tries" },      // T (tottries & maxtries)
-    { 'U',     "ChopThreshold" },// U (chopthreshold)
-    { 'V',     "DoneOp" },     // V (doneop)
-    { 'W',     "CommID" },     // W (commid)
-    { 'X',     "JobType" },    // X (jobtype)
-    { 'Y',     "Date       Time" },    // Y (date & time)
-    { 'Z',     "UNIX Time" },  // Z (seconds since the UNIX epoch)
-    { 'a',     "State" },      // a (job state as symbol)
-    { 'b',     "NTries" },     // b (ntries)
-    { 'c',     "Client" },     // c (client)
-    { 'd',     "TotDials" },   // d (totdials)
-    { 'e',     "Number" },     // e (external)
-    { 'f',     "NDials" },     // f (ndials)
-    { 'g',     "GID" },        // g (groupid)
-    { 'h',     "Chop" },       // h (pagechop as symbol)
-    { 'i',     "Priority" },   // i (pri)
-    { 'j',     "JID" },        // j (jobid)
-    { 'k',     "LastTime" },   // k (killtime)
-    { 'l',     "PageLength" }, // l (pagelength)
-    { 'm',     "Modem" },      // m (modem)
-    { 'n',     "Notify" },     // n (notify as symbol)
-    { 'o',     "Owner" },      // o (owner)
-    { 'p',     "Pages" },      // p (npages)
-    { 'q',     "RetryTime" },  // q (retrytime as MM:SS)
-    { 'r',     "Resolution" }, // r (resolution)
-    { 's',     "Status" },     // s (notice a.k.a. status)
-    { 't',     "TotTries" },   // t (tottries)
-    { 'u',     "MaxTries" },   // u (maxtries)
-    { 'v',     "DialString" }, // v (number a.ka. dialstring)
-    { 'w',     "PageWidth" },  // w (pagewidth)
-    { 'x',     "MaxDials" },   // x (maxdials)
-    { 'y',     "TotPages" },   // y (totpages)
-    { 'z',     "TTS" },        // z (tts)
-    { '0',     "UseXVres" },   // 0 (usexvres as symbol)
+    { 'A',     N_("SUB") },            // A (subaddr)
+    { 'B',     N_("PWD") },            // B (passwd)
+    { 'C',     N_("Company") },        // C (company)
+    { 'D',     N_("Dials") },          // D (totdials & maxdials)
+    { 'E',     N_("BR") },             // E (desiredbr)
+    { 'F',     N_("Tagline") },        // F (tagline)
+    { 'G',     N_("ST") },             // G (desiredst)
+    { 'H',     N_("DF") },             // H (desireddf)
+    { 'I',     N_("UsrPri") },         // I (usrpri)
+    { 'J',     N_("JobTag") },         // J (jobtag)
+    { 'K',     N_("EC") },             // K (desiredec as symbol)
+    { 'L',     N_("Location") },       // L (location)
+    { 'M',     N_("MailAddr") },       // M (mailaddr)
+    { 'N',     N_("DT") },             // N (desiredtl as symbol)
+    { 'O',     N_("CC") },             // O (useccover as symbol)
+    { 'P',     N_("Pages") },          // P (npages & totpages)
+    { 'Q',     N_("MinSP") },          // Q (minsp)
+    { 'R',     N_("Receiver") },       // R (receiver)
+    { 'S',     N_("Sender") },         // S (sender)
+    { 'T',     N_("Tries") },          // T (tottries & maxtries)
+    { 'U',     N_("ChopThreshold") },  // U (chopthreshold)
+    { 'V',     N_("DoneOp") },         // V (doneop)
+    { 'W',     N_("CommID") },         // W (commid)
+    { 'X',     N_("JobType") },        // X (jobtype)
+    { 'Y',     N_("Date       Time") },// Y (date & time)
+    { 'Z',     N_("UNIX Time") },      // Z (seconds since the UNIX epoch)
+    { 'a',     N_("State") },          // a (job state as symbol)
+    { 'b',     N_("NTries") },         // b (ntries)
+    { 'c',     N_("Client") },         // c (client)
+    { 'd',     N_("TotDials") },       // d (totdials)
+    { 'e',     N_("Number") },         // e (external)
+    { 'f',     N_("NDials") },         // f (ndials)
+    { 'g',     N_("GID") },            // g (groupid)
+    { 'h',     N_("Chop") },           // h (pagechop as symbol)
+    { 'i',     N_("Priority") },       // i (pri)
+    { 'j',     N_("JID") },            // j (jobid)
+    { 'k',     N_("LastTime") },       // k (killtime)
+    { 'l',     N_("PageLength") },     // l (pagelength)
+    { 'm',     N_("Modem") },          // m (modem)
+    { 'n',     N_("Notify") },         // n (notify as symbol)
+    { 'o',     N_("Owner") },          // o (owner)
+    { 'p',     N_("Pages") },          // p (npages)
+    { 'q',     N_("RetryTime") },      // q (retrytime as MM:SS)
+    { 'r',     N_("Resolution") },     // r (resolution)
+    { 's',     N_("Status") },         // s (notice a.k.a. status)
+    { 't',     N_("TotTries") },       // t (tottries)
+    { 'u',     N_("MaxTries") },       // u (maxtries)
+    { 'v',     N_("DialString") },     // v (number a.ka. dialstring)
+    { 'w',     N_("PageWidth") },      // w (pagewidth)
+    { 'x',     N_("MaxDials") },       // x (maxdials)
+    { 'y',     N_("TotPages") },       // y (totpages)
+    { 'z',     N_("TTS") },            // z (tts)
+    { '0',     N_("UseXVres") },       // 0 (usexvres as symbol)
     { '\0' },
 };
 void FaxClient::getJobStatusHeader(fxStr& header)
@@ -1669,26 +1669,26 @@ void FaxClient::getJobStatusHeader(fxStr& header)
  * queue status listings returned by the server.
  */
 const FaxClient::FaxFmtHeader FaxClient::recvFormats[] = {
-    { 'Y',     "Date       Time" },    // Y (date & time)
-    { 'a',     "SUB" },        // a (subaddress)
-    { 'b',     "BR" },         // b (bitrate)
-    { 'd',     "DF" },         // d (data format)
-    { 'e',     "Error" },      // e (error description)
-    { 'f',     "Filename" },   // f (filename)
-    { 'h',     "Time" },       // h (time spent receiving)
-    { 'i',     "CIDName" },    // i (caller id name)
-    { 'j',     "CIDNumber" },  // j (caller id number)
-    { 'l',     "Length" },     // l (pagelength)
-    { 'm',     "Protect" },    // m (fax-style protection mode, no group bits)
-    { 'n',     "Size" },       // n (file size)
-    { 'o',     "Owner" },      // o (owner)
-    { 'p',     "Pages" },      // p (npages)
-    { 'q',     "Protect" },    // m (UNIX-style protection mode)
-    { 'r',     "Resolution" }, // r (resolution)
-    { 's',     "Sender/TSI" }, // s (sender TSI)
-    { 't',     "Recvd@" },     // t (time received)
-    { 'w',     "Width" },      // w (pagewidth)
-    { 'z',     " " },          // z (``*'' if being received)
+    { 'Y',     N_("Date       Time") },// Y (date & time)
+    { 'a',     N_("SUB") },            // a (subaddress)
+    { 'b',     N_("BR") },             // b (bitrate)
+    { 'd',     N_("DF") },             // d (data format)
+    { 'e',     N_("Error") },          // e (error description)
+    { 'f',     N_("Filename") },       // f (filename)
+    { 'h',     N_("Time") },           // h (time spent receiving)
+    { 'i',     N_("CIDName") },        // i (caller id name)
+    { 'j',     N_("CIDNumber") },      // j (caller id number)
+    { 'l',     N_("Length") },         // l (pagelength)
+    { 'm',     N_("Protect") },        // m (fax-style protection mode, no group bits)
+    { 'n',     N_("Size") },           // n (file size)
+    { 'o',     N_("Owner") },          // o (owner)
+    { 'p',     N_("Pages") },          // p (npages)
+    { 'q',     N_("Protect") },        // m (UNIX-style protection mode)
+    { 'r',     N_("Resolution") },     // r (resolution)
+    { 's',     N_("Sender/TSI") },     // s (sender TSI)
+    { 't',     N_("Recvd@") },         // t (time received)
+    { 'w',     N_("Width") },          // w (pagewidth)
+    { 'z',     " " },                  // z (``*'' if being received)
     { '\0' },
 };
 void FaxClient::getRecvStatusHeader(fxStr& header)
@@ -1699,15 +1699,15 @@ void FaxClient::getRecvStatusHeader(fxStr& header)
  * status listings returned by the server.
  */
 const FaxClient::FaxFmtHeader FaxClient::modemFormats[] = {
-    { 'h',     "Host" },       // h (hostname)
-    { 'l',     "LocalID" },    // l (local identifier)
-    { 'm',     "Modem" },      // m (canonical modem name)
-    { 'n',     "Number" },     // n (fax phone number)
-    { 'r',     "MaxRecv" },    // r (max recv pages)
-    { 's',     "Status" },     // s (status information)
-    { 't',     "Tracing" },    // t (server:session tracing level)
-    { 'v',     "Speaker" },    // v (speaker volume as symbol)
-    { 'z',     " " },          // z (``*'' if faxgetty is running)
+    { 'h',     N_("Host") },           // h (hostname)
+    { 'l',     N_("LocalID") },        // l (local identifier)
+    { 'm',     N_("Modem") },          // m (canonical modem name)
+    { 'n',     N_("Number") },         // n (fax phone number)
+    { 'r',     N_("MaxRecv") },        // r (max recv pages)
+    { 's',     N_("Status") },         // s (status information)
+    { 't',     N_("Tracing") },        // t (server:session tracing level)
+    { 'v',     N_("Speaker") },        // v (speaker volume as symbol)
+    { 'z',     " " },                  // z (``*'' if faxgetty is running)
     { '\0' },
 };
 void FaxClient::getModemStatusHeader(fxStr& header)
@@ -1718,19 +1718,19 @@ void FaxClient::getModemStatusHeader(fxStr& header)
  * status listings returned by the server.
  */
 const FaxClient::FaxFmtHeader FaxClient::fileFormats[] = {
-    { 'a',     "LastAcc" },    // a (last access time)
-    { 'c',     "Created" },    // c (create time)
-    { 'd',     "Device" },     // d (device)
-    { 'f',     "Filename" },   // f (filename)
-    { 'g',     "GID" },        // g (GID of file)
-    { 'l',     "Links" },      // l (link count)
-    { 'm',     "LastMod" },    // m (last modification time)
-    { 'o',     "Owner" },      // o (owner based on file GID)
-    { 'p',     "Protect" },    // p (fax-style protection flags, no group bits)
-    { 'q',     "Protect" },    // q (UNIX-style protection flags)
-    { 'r',     "RootDev" },    // r (root device)
-    { 's',     "Size" },       // s (file size in bytes)
-    { 'u',     "UID" },        // u (UID of file)
+    { 'a',     N_("LastAcc") },        // a (last access time)
+    { 'c',     N_("Created") },        // c (create time)
+    { 'd',     N_("Device") },         // d (device)
+    { 'f',     N_("Filename") },       // f (filename)
+    { 'g',     N_("GID") },            // g (GID of file)
+    { 'l',     N_("Links") },          // l (link count)
+    { 'm',     N_("LastMod") },        // m (last modification time)
+    { 'o',     N_("Owner") },          // o (owner based on file GID)
+    { 'p',     N_("Protect") },        // p (fax-style protection flags, no group bits)
+    { 'q',     N_("Protect") },        // q (UNIX-style protection flags)
+    { 'r',     N_("RootDev") },        // r (root device)
+    { 's',     N_("Size") },           // s (file size in bytes)
+    { 'u',     N_("UID") },            // u (UID of file)
     { '\0' },
 };
 void FaxClient::getFileStatusHeader(fxStr& header)
index b6fea38a6c0c0f15ab6ddd64aeb47449171f99f2..81323acc0d0582f62783583c10c3ba566ae63ce4 100644 (file)
@@ -52,7 +52,7 @@ FaxConfig::readConfig(const fxStr& filename)
 {
     FILE* fd = Sys::fopen(tildeExpand(filename), "r");
     if (fd) {
-       configTrace("Read config file %s", (const char*) filename);
+       configTrace(_("Read config file %s"), (const char*) filename);
        char line[1024];
        while (fgets(line, sizeof (line)-1, fd)){
            line[strlen(line)-1]='\0';          // Nuke \r at end of line
@@ -90,8 +90,8 @@ FaxConfig::tildeExpand(const fxStr& filename)
        if (!cp || *cp == '\0') {
            struct passwd* pwd = getpwuid(getuid());
            if (!pwd) {
-               configError("No passwd file entry for uid %u,"
-                   " cannot expand ~ in \"%s\"",
+               configError(_("No passwd file entry for uid %u,"
+                   " cannot expand ~ in \"%s\""),
                    getuid(), (const char*) filename);
                cp = "";                // NB: XXX maybe this should be fatal?
            } else
@@ -163,7 +163,7 @@ FaxConfig::readConfigItem(const char* b)
        cp++;
     }
     if (*cp != ':') {
-       configError("Syntax error at line %u, missing ':' in \"%s\"",
+       configError(_("Syntax error at line %u, missing ':' in \"%s\""),
            lineno, b);
        return (false);
     }
@@ -178,7 +178,7 @@ FaxConfig::readConfigItem(const char* b)
        char* dp = ++cp;
        for (value = dp; (c = *cp) != '"'; cp++) {
            if (c == '\0') {                    // unmatched quote mark
-               configError("Syntax error at line %u, missing quote mark in \"%s\"",
+               configError(_("Syntax error at line %u, missing quote mark in \"%s\""),
                    lineno, b);
                return (false);
            }
@@ -211,18 +211,18 @@ FaxConfig::readConfigItem(const char* b)
 
     if (streq(tag, "include") ) {
         u_int old_lineno = lineno;
-       configTrace("%s = %s (line %u)", tag, value, lineno);
+       configTrace(_("%s = %s (line %u)"), tag, value, lineno);
        lineno = 0;
        readConfig(value);
        lineno = old_lineno;
        return (true);
     }
     if (!setConfigItem(tag, value)) {
-       configTrace("Unknown configuration parameter \"%s\" ignored at line %u",
+       configTrace(_("Unknown configuration parameter \"%s\" ignored at line %u"),
             tag, lineno);
        return (false);
     } else {
-       configTrace("%s = %s (line %u)", tag, value, lineno);
+       configTrace(_("%s = %s (line %u)"), tag, value, lineno);
        return (true);
     }
 }
index 9b5b2106eda5bdabdca8078d2fe935c38d4bff93..f65ef9a6ac84e200797e01d46e944248364d0f96 100644 (file)
@@ -119,7 +119,7 @@ FaxDB::parseDatabase(FILE* fd, FaxDBRecord* parent)
     while (getToken(fd, key)) {
        if (key == "]") {
            if (parent == 0)
-               fprintf(stderr, "%s: line %d: Unmatched \"]\".\n",
+               fprintf(stderr, _("%s: line %d: Unmatched \"]\".\n"),
                    (const char*) filename, lineno);
            break;
        }
@@ -131,7 +131,7 @@ FaxDB::parseDatabase(FILE* fd, FaxDBRecord* parent)
        if (!getToken(fd, value))
            break;
        if (value != ":") {
-           fprintf(stderr, "%s: line %d: Missing \":\" separator.\n",
+           fprintf(stderr, _("%s: line %d: Missing \":\" separator.\n"),
                (const char*) filename, lineno);
            continue;
        }
@@ -179,7 +179,7 @@ top:
            if (c == '\\') {
                c = getc(fd);
                if (c == EOF) {
-                   fprintf(stderr, "%s: Premature EOF.\n", (const char*) filename);
+                   fprintf(stderr, _("%s: Premature EOF.\n"), (const char*) filename);
                    return (false);
                }
                // XXX handle standard escapes
index 2b60640322163031d2453feab4273bb2ca03d450..9a5328c6ce442f2b003ed22d0d55cdc4ada52d3c 100644 (file)
@@ -70,7 +70,7 @@ InetTransport::callServer(fxStr& emsg)
     const char* cproto = proto;                        // XXX for busted include files
     struct protoent* pp = getprotobyname(cproto);
     if (!pp) {
-       client.printWarning("%s: No protocol definition, using default.",
+       client.printWarning(_("%s: No protocol definition, using default."),
            cproto);
        protocol = 0;
     } else
@@ -78,13 +78,13 @@ InetTransport::callServer(fxStr& emsg)
 
     struct hostent* hp = Socket::gethostbyname(client.getHost());
     if (!hp) {
-       emsg = client.getHost() | ": Unknown host";
+       emsg = client.getHost() | _(": Unknown host");
        return (false);
     }
     
     int fd = socket(hp->h_addrtype, SOCK_STREAM, protocol);
     if (fd < 0) {
-       emsg = "Can not create socket to connect to server.";
+       emsg = _("Can not create socket to connect to server.");
        return (false);
     }
     struct sockaddr_in sin;
@@ -95,7 +95,7 @@ InetTransport::callServer(fxStr& emsg)
        if (!sp) {
            if (!isdigit(cproto[0])) {
                client.printWarning(
-                   "No \"%s\" service definition, using default %u/%s.",
+                   _("No \"%s\" service definition, using default %u/%s."),
                    FAX_SERVICE, FAX_DEFPORT, cproto);
                sin.sin_port = htons(FAX_DEFPORT);
            } else
@@ -107,23 +107,23 @@ InetTransport::callServer(fxStr& emsg)
     for (char** cpp = hp->h_addr_list; *cpp; cpp++) {
        memcpy(&sin.sin_addr, *cpp, hp->h_length);
        if (client.getVerbose())
-           client.traceServer("Trying %s (%s) at port %u...",
+           client.traceServer(_("Trying %s (%s) at port %u..."),
                (const char*) client.getHost(),
                inet_ntoa(sin.sin_addr),
                ntohs(sin.sin_port));
        if (Socket::connect(fd, &sin, sizeof (sin)) >= 0) {
            if (client.getVerbose())
-               client.traceServer("Connected to %s.", hp->h_name);
+               client.traceServer(_("Connected to %s."), hp->h_name);
 #if defined(IP_TOS) && defined(IPTOS_LOWDELAY)
            int tos = IPTOS_LOWDELAY;
            if (Socket::setsockopt(fd, IPPROTO_IP, IP_TOS, &tos, sizeof (tos)) < 0)
-               client.printWarning("setsockopt(TOS): %s (ignored)",
+               client.printWarning(_("setsockopt(TOS): %s (ignored)"),
                    strerror(errno));
 #endif
 #ifdef SO_OOBINLINE
            int on = 1;
            if (Socket::setsockopt(fd, SOL_SOCKET, SO_OOBINLINE, &on, sizeof (on)) < 0)
-               client.printWarning("setsockopt(OOBLINE): %s (ignored)",
+               client.printWarning(_("setsockopt(OOBLINE): %s (ignored)"),
                    strerror(errno));
 #endif
            /*
@@ -136,7 +136,7 @@ InetTransport::callServer(fxStr& emsg)
            return (true);
        }
     }
-    emsg = fxStr::format("Can not reach server at host \"%s\", port %u.",
+    emsg = fxStr::format(_("Can not reach server at host \"%s\", port %u."),
        (const char*) client.getHost(), ntohs(sin.sin_port));
     Sys::close(fd), fd = -1;
     return (false);
@@ -230,12 +230,18 @@ InetTransport::abortCmd(fxStr& emsg)
     return (true);
 }
 #else
+void
+Transport::notConfigured(fxStr& emsg)
+{
+    emsg = _("Sorry, no TCP/IP communication support was configured.");
+}
+
 bool InetTransport::callServer(fxStr& emsg)
-    { notConfigured("TCP/IP", emsg); return (false); }
+    { notConfigured(emsg); return (false); }
 bool InetTransport::initDataConn(fxStr& emsg)
-    { notConfigured("TCP/IP", emsg); return (false); }
+    { notConfigured(emsg); return (false); }
 bool InetTransport::openDataConn(fxStr& emsg)
-    { notConfigured("TCP/IP", emsg); return (false); }
+    { notConfigured(emsg); return (false); }
 bool InetTransport::abortDataConn(fxStr& emsg)
-    { notConfigured("TCP/IP", emsg); return (false); }
+    { notConfigured(emsg); return (false); }
 #endif
index 2b10298d24fc0dd24a8ac6da31fb26197b5dca40..92f3195d9053f8fb24859241de9d5f61b8da5112 100644 (file)
@@ -35,7 +35,7 @@ const char* fxObj::className() const { return "fxObj"; }
 
 void fxObj::subClassMustDefine(const char* method) const
 {
-    fprintf(stderr, "%s: Sub class must define method \"%s\".\n",
+    fprintf(stderr, _("%s: Sub class must define method \"%s\".\n"),
        className(), method);
     abort();
 }
index 5a6997f0d248a1a2c152ae6bb94079529767c297..80a7db932fe58d53d6d48634233c31627edd23ac 100644 (file)
@@ -47,7 +47,7 @@ parseError(const char* file, u_int lineno, const char* fmt ...)
 {
     va_list ap;
     va_start(ap, fmt);
-    fprintf(stderr, "%s: line %u: ", file, lineno); 
+    fprintf(stderr, _("%s: line %u: "), file, lineno);
     vfprintf(stderr, fmt, ap);
     va_end(ap);
 }
@@ -62,7 +62,7 @@ PageSizeInfo::skipws(char*& cp,
        cp++;
     if (*cp == '\0') {
        parseError(file, lineno,
-           "Unexpected end of line after \"%s\".\n", item);
+           _("Unexpected end of line after \"%s\".\n"), item);
        return (false);
     } else
        return (true);
@@ -95,27 +95,27 @@ PageSizeInfo::readPageInfoFile()
            pi.name = cp;
            while (*cp != '\t')
                cp++;
-           if (!skipws(cp, file, "page size name", lineno))
+           if (!skipws(cp, file, _("page size name"), lineno))
                continue;
            pi.abbr = cp;
            while (*cp != '\t')
                cp++;
-           if (!skipws(cp, file, "page size abbreviation", lineno))
+           if (!skipws(cp, file, _("page size abbreviation"), lineno))
                continue;
            pi.w = (BMU) strtoul(cp, &cp, 10);
-           if (!skipws(cp, file, "page width", lineno))
+           if (!skipws(cp, file, _("page width"), lineno))
                continue;
            pi.h = (BMU) strtoul(cp, &cp, 10);
-           if (!skipws(cp, file, "page height", lineno))
+           if (!skipws(cp, file, _("page height"), lineno))
                continue;
            pi.grw = (BMU) strtoul(cp, &cp, 10);
-           if (!skipws(cp, file, "guaranteed page width", lineno))
+           if (!skipws(cp, file, _("guaranteed page width"), lineno))
                continue;
            pi.grh = (BMU) strtoul(cp, &cp, 10);
-           if (!skipws(cp, file, "guaranteed page height", lineno))
+           if (!skipws(cp, file, _("guaranteed page height"), lineno))
                continue;
            pi.top = (BMU) strtoul(cp, &cp, 10);
-           if (!skipws(cp, file, "top margin", lineno))
+           if (!skipws(cp, file, _("top margin"), lineno))
                continue;
            pi.left = (BMU) strtoul(cp, &cp, 10);
            pi.name = strdup(pi.name);
@@ -125,7 +125,7 @@ PageSizeInfo::readPageInfoFile()
        fclose(fp);
     } else {
        fprintf(stderr,
-    "Warning, no page size database file \"%s\", using builtin default.\n",
+    _("Warning, no page size database file \"%s\", using builtin default.\n"),
            (const char*)file);
        PageInfo pi;
        pi.name = strdup("default");
index 3af6f6015f221a192d0c2cba69ebf7afc66eedc4..6fc3c44a853dccdd7ecf2dac042c00614991c852 100644 (file)
@@ -100,7 +100,7 @@ SNPPClient::printWarning(const char* fmt ...)
 void
 SNPPClient::vprintWarning(const char* fmt, va_list ap)
 {
-    fprintf(stderr, "Warning, ");
+    fprintf(stderr, _("Warning, "));
     vfprintf(stderr, fmt, ap);
     fputs("\n", stderr);
 }
@@ -205,7 +205,7 @@ SNPPClient::setupSenderIdentity(fxStr& emsg)
     }
     fxStr mbox;
     if (senderName == "" || !getNonBlankMailbox(mbox)) {
-       emsg = "Malformed (null) sender name or mail address";
+       emsg = _("Malformed (null) sender name or mail address");
        return (false);
     } else
        return (true);
@@ -251,7 +251,7 @@ SNPPClient::setupUserIdentity(fxStr& emsg)
     pwd = getpwuid(getuid());
     if (!pwd) {
        emsg = fxStr::format(
-           "Can not locate your password entry (uid %lu): %s.",
+           _("Can not locate your password entry (uid %lu): %s."),
                (u_long) getuid(), strerror(errno));
        return (false);
     }
@@ -275,8 +275,8 @@ SNPPClient::setupUserIdentity(fxStr& emsg)
     } else
        senderName = userName;
     if (senderName.length() == 0) {
-       emsg = "Bad (null) user name; your password file entry"
-           " probably has bogus GECOS field information.";
+       emsg = _("Bad (null) user name; your password file entry"
+           " probably has bogus GECOS field information.");
        return (false);
     } else
        return (true);
@@ -382,7 +382,7 @@ SNPPClient::setConfigItem(const char* tag, const char* value)
     } else if (streq(tag, "holdtime")) {
        fxStr emsg;
        if (!jproto.setHoldTime(tag, emsg))
-           configError("Invalid hold time \"%s\": %s",
+           configError(_("Invalid hold time \"%s\": %s"),
                value, (const char*) emsg);
     } else if (streq(tag, "retrytime")) {
        jproto.setRetryTime(value);
@@ -451,20 +451,20 @@ SNPPClient::callInetServer(fxStr& emsg)
     }
     struct hostent* hp = Socket::gethostbyname(getHost());
     if (!hp) {
-       emsg = getHost() | ": Unknown host";
+       emsg = getHost() | _(": Unknown host");
        return (false);
     }
     int protocol;
     const char* cproto = proto;                        // XXX for busted include files
     struct protoent* pp = getprotobyname(cproto);
     if (!pp) {
-       printWarning("%s: No protocol definition, using default.", cproto);
+       printWarning(_("%s: No protocol definition, using default."), cproto);
        protocol = 0;
     } else
        protocol = pp->p_proto;
     int fd = socket(hp->h_addrtype, SOCK_STREAM, protocol);
     if (fd < 0) {
-       emsg = "Can not create socket to connect to server.";
+       emsg = _("Can not create socket to connect to server.");
        return (false);
     }
     struct sockaddr_in sin;
@@ -475,7 +475,7 @@ SNPPClient::callInetServer(fxStr& emsg)
        if (!sp) {
            if (!isdigit(cproto[0])) {
                printWarning(
-                   "No \"%s\" service definition, using default %u/%s.",
+                   _("No \"%s\" service definition, using default %u/%s."),
                    SNPP_SERVICE, SNPP_DEFPORT, cproto);
                sin.sin_port = htons(SNPP_DEFPORT);
            } else
@@ -487,30 +487,30 @@ SNPPClient::callInetServer(fxStr& emsg)
     for (char** cpp = hp->h_addr_list; *cpp; cpp++) {
        memcpy(&sin.sin_addr, *cpp, hp->h_length);
        if (getVerbose())
-           traceServer("Trying %s (%s) at port %u...",
+           traceServer(_("Trying %s (%s) at port %u..."),
                (const char*) getHost(),
                inet_ntoa(sin.sin_addr),
                ntohs(sin.sin_port));
        if (Socket::connect(fd, &sin, sizeof (sin)) >= 0) {
            if (getVerbose())
-               traceServer("Connected to %s.", hp->h_name);
+               traceServer(_("Connected to %s."), hp->h_name);
 #if defined(IP_TOS) && defined(IPTOS_LOWDELAY)
            int tos = IPTOS_LOWDELAY;
            if (Socket::setsockopt(fd, IPPROTO_IP, IP_TOS, &tos, sizeof (tos)) < 0)
-               printWarning("setsockopt(TOS): %s (ignored)",
+               printWarning(_("setsockopt(TOS): %s (ignored)"),
                    strerror(errno));
 #endif
 #ifdef SO_OOBINLINE
            int on = 1;
            if (Socket::setsockopt(fd, SOL_SOCKET, SO_OOBINLINE, &on, sizeof (on)) < 0)
-               printWarning("setsockopt(OOBLINE): %s (ignored)",
+               printWarning(_("setsockopt(OOBLINE): %s (ignored)"),
                    strerror(errno));
 #endif
            setCtrlFds(fd, fd);
            return (true);
        }
     }
-    emsg = fxStr::format("Can not reach server at host \"%s\", port %u.",
+    emsg = fxStr::format(_("Can not reach server at host \"%s\", port %u."),
        (const char*) getHost(), ntohs(sin.sin_port));
     close(fd), fd = -1;
     return (false);
@@ -519,7 +519,7 @@ SNPPClient::callInetServer(fxStr& emsg)
 bool
 SNPPServer::callInetServer(fxStr& emsg)
 {
-    emsg = "Sorry, no TCP/IP communication support was configured.";
+    emsg = _("Sorry, no TCP/IP communication support was configured.");
     return (false);
 }
 #endif
@@ -570,7 +570,7 @@ SNPPClient::login(const char* user, fxStr& emsg)
            state &= ~SS_HASSITE;
        return (true);
     } else {
-       emsg = "Login failed: " | lastResponse;
+       emsg = _("Login failed: ") | lastResponse;
        return (false);
     }
 }
@@ -587,14 +587,14 @@ SNPPClient::getPasswd(const char* prompt)
 void
 SNPPClient::lostServer(void)
 {
-    printError("Service not available, remote server closed connection");
+    printError(_("Service not available, remote server closed connection"));
     hangupServer();
 }
 
 void
 SNPPClient::unexpectedResponse(fxStr& emsg)
 {
-    emsg = "Unexpected server response: " | lastResponse;
+    emsg = _("Unexpected server response: ") | lastResponse;
 }
 
 void
@@ -602,7 +602,7 @@ SNPPClient::protocolBotch(fxStr& emsg, const char* fmt ...)
 {
     va_list ap;
     va_start(ap, fmt);
-    emsg = "Protocol botch" | fxStr::vformat(fmt, ap);
+    emsg = _("Protocol botch") | fxStr::vformat(fmt, ap);
     va_end(ap);
 }
 
@@ -637,7 +637,7 @@ SNPPClient::vcommand(const char* fmt, va_list ap)
        }
     }
     if (fdOut == NULL) {
-       printError("No control connection for command");
+       printError(_("No control connection for command"));
        code = -1;
        return (0);
     }
@@ -852,7 +852,7 @@ bool
 SNPPClient::submitJobs(fxStr& emsg)
 {
     if (!isLoggedIn()) {
-       emsg = "Not logged in to server";
+       emsg = _("Not logged in to server");
        return (false);
     }
     /*
@@ -884,7 +884,7 @@ SNPPClient::submitJobs(fxStr& emsg)
 void
 SNPPClient::notifyNewJob(const SNPPJob& job)
 {
-    printf("destination pin %s: request id is %s for host %s\n"
+    printf(_("destination pin %s: request id is %s for host %s\n")
        , (const char*) job.getPIN()
        , (const char*) job.getJobID()
        , (const char*) getHost()
@@ -907,14 +907,14 @@ SNPPClient::sendRawData(void* buf, int cc, fxStr& emsg)
     for (int cnt, sent = 0; cc; sent += cnt, cc -= cnt) 
        if ((cnt = write(fileno(fdOut), bp + sent, cc)) <= 0) {
            protocolBotch(emsg, errno == EPIPE ?
-               " (server closed connection)" : " (server write error: %s).",
+               _(" (server closed connection)") : _(" (server write error: %s)."),
                strerror(errno));
            return (false);
        }
 #else
     if (write(fileno(fdOut), buf, cc) != cc) {
        protocolBotch(emsg, errno == EPIPE ?
-           " (server closed connection)" : " (server write error: %s).",
+           _(" (server closed connection)") : _(" (server write error: %s)."),
            strerror(errno));
        return (false);
     }
@@ -928,14 +928,14 @@ SNPPClient::sendData(int fd, fxStr& emsg)
     struct stat sb;
     (void) Sys::fstat(fd, sb);
     if (getVerbose())
-       traceServer("SEND message data, %lu bytes", (u_long) sb.st_size);
+       traceServer(_("SEND message data, %lu bytes"), (u_long) sb.st_size);
     if (command("DATA") == CONTINUE) {
        size_t cc = (size_t) sb.st_size;
        while (cc > 0) {
            char buf[32*1024];
            size_t n = fxmin(cc, sizeof (buf));
            if (read(fd, buf, n) != (ssize_t) n) {
-               protocolBotch(emsg, " (data read: %s).", strerror(errno));
+               protocolBotch(emsg, _(" (data read: %s)."), strerror(errno));
                return (false);
            }
            if (!sendRawData(buf, n, emsg))
@@ -958,7 +958,7 @@ SNPPClient::sendData(const fxStr& filename, fxStr& emsg)
        ok = sendData(fd, emsg);
        Sys::close(fd);
     } else
-       emsg = fxStr::format("Unable to open message file \"%s\".",
+       emsg = fxStr::format(_("Unable to open message file \"%s\"."),
            (const char*) filename);
     return (ok);
 }
@@ -977,7 +977,7 @@ bool
 SNPPClient::siteParm(const char* name, const fxStr& value)
 {
     if (!hasSiteCmd()) {
-       printWarning("no SITE %s support; ignoring set request.", name);
+       printWarning(_("no SITE %s support; ignoring set request."), name);
        return (true);
     } else
        return (command("SITE %s %s", name, (const char*) value) == COMPLETE);
@@ -987,7 +987,7 @@ bool
 SNPPClient::siteParm(const char* name, u_int value)
 {
     if (!hasSiteCmd()) {
-       printWarning("no SITE %s support; ignoring set request.", name);
+       printWarning(_("no SITE %s support; ignoring set request."), name);
        return (true);
     } else
        return (command("SITE %s %u", name, value) == COMPLETE);
index c243f9081726d9eac739a4f933744ddba2ff0a63..b6fb185a9dd99b99a392e6b6ed26a2aa65501462 100644 (file)
@@ -98,7 +98,7 @@ SendFaxClient::prepareForJobSubmissions(fxStr& emsg)
     if (typeRules == NULL) {
        typeRules = TypeRules::read(typeRulesFile);
        if (!typeRules) {
-           emsg = "Unable to setup file typing and conversion rules";
+           emsg = _("Unable to setup file typing and conversion rules");
            return (false);
        }
     }
@@ -124,7 +124,7 @@ SendFaxClient::prepareForJobSubmissions(fxStr& emsg)
        if (job.getPageWidth() != 0 && job.getPageLength() != 0)
            continue;
        if (!job.setPageSize(job.getPageSize())) {
-           emsg = "Unknown page size " | job.getPageSize();
+           emsg = _("Unknown page size ") | job.getPageSize();
            return (false);
        }
     }
@@ -233,8 +233,8 @@ SendFaxClient::makeCoverPage(const SendFaxJob& job, fxStr& file, fxStr& emsg)
            pid_t pid = fork();
            switch (pid) {
            case -1:                    // error
-               emsg = fxStr::format("Error creating cover sheet; "
-                   "could not fork subprocess: %s", strerror(errno));
+               emsg = fxStr::format(_("Error creating cover sheet; "
+                   "could not fork subprocess: %s"), strerror(errno));
                Sys::close(pfd[1]);
                break;
            case 0:                     // child, exec command
@@ -259,8 +259,8 @@ SendFaxClient::makeCoverPage(const SendFaxJob& job, fxStr& file, fxStr& emsg)
                    file = tmpFile;
                    return (true);
                }
-               emsg = fxStr::format("Error creating cover sheet; "
-                   "command was \"%s\"; exit status %x"
+               emsg = fxStr::format(_("Error creating cover sheet; "
+                   "command was \"%s\"; exit status %x")
                    , (const char*) joinargs(coverCmd, av)
                    , status
                );
@@ -268,12 +268,12 @@ SendFaxClient::makeCoverPage(const SendFaxJob& job, fxStr& file, fxStr& emsg)
            }
            Sys::close(pfd[0]);
        } else {
-           emsg = fxStr::format("Error creating cover sheet; "
-               "unable to create pipe to subprocess: %s", strerror(errno));
+           emsg = fxStr::format(_("Error creating cover sheet; "
+               "unable to create pipe to subprocess: %s"), strerror(errno));
        }
 #undef MAXARGS
     } else
-       emsg = fxStr::format("%s: Can not create temporary file for cover page",
+       emsg = fxStr::format(_("%s: Can not create temporary file for cover page"),
            (const char*) tmpFile);
     Sys::unlink(tmpFile);
     return (false);
@@ -416,11 +416,11 @@ bool
 SendFaxClient::submitJobs(fxStr& emsg)
 {
     if (!setup) {
-       emsg = "Documents not prepared";
+       emsg = _("Documents not prepared");
        return (false);
     }
     if (!isLoggedIn()) {
-       emsg = "Not logged in to server";
+       emsg = _("Not logged in to server");
        return (false);
     }
     /*
@@ -456,7 +456,7 @@ SendFaxClient::sendDocuments(fxStr& emsg)
        FileInfo& info = (*files)[i];
        int fd = Sys::open(info.temp, O_RDONLY);
        if (fd < 0) {
-           emsg = fxStr::format(info.temp | ": Can not open: %s",
+           emsg = fxStr::format(info.temp | _(": Can not open: %s"),
                strerror(errno));
            return (false);                     // XXX
        }
@@ -477,7 +477,7 @@ SendFaxClient::sendDocuments(fxStr& emsg)
        Sys::close(fd);
        if (!fileSent) {
            if (emsg == "")
-               emsg = "Document transfer failed: " | getLastResponse();
+               emsg = _("Document transfer failed: ") | getLastResponse();
            return (false);
        }
     }
@@ -491,12 +491,12 @@ void
 SendFaxClient::notifyNewJob(const SendFaxJob& job)
 {
     int nfiles = files->length();
-    printf("request id is %s (group id %s) for host %s (%u %s)\n"
+    printf(ngettext("request id is %s (group id %s) for host %s (%u file)\n",
+           "request id is %s (group id %s) for host %s (%u files)\n", nfiles)
        , (const char*) job.getJobID()
        , (const char*) job.getGroupID()
        , (const char*) getHost()
        , nfiles
-       , nfiles > 1 ? "files" : "file"
     );
 }
 
@@ -603,7 +603,7 @@ SendFaxClient::setupSenderIdentity(const fxStr& from, fxStr& emsg)
     }
     fxStr mbox;
     if (senderName == "" || !getNonBlankMailbox(mbox)) {
-       emsg = "Malformed (null) sender name or mail address";
+       emsg = _("Malformed (null) sender name or mail address");
        return (false);
     } else
        return (true);
@@ -676,7 +676,7 @@ SendFaxClient::prepareFile(FileInfo& info, fxStr& emsg)
            printf("CONVERT \"%s\"\n", (const char*) sysCmd);
        if (system(sysCmd) != 0) {
            Sys::unlink(tmpFile);
-           emsg = fxStr::format("Error converting document; command was \"%s\"",
+           emsg = fxStr::format(_("Error converting document; command was \"%s\""),
                (const char*) sysCmd);
            return (false);
        }
@@ -704,16 +704,16 @@ SendFaxClient::fileType(const char* filename, fxStr& emsg)
     struct stat sb;
     int fd = Sys::open(filename, O_RDONLY);
     if (fd < 0) {
-       emsg = fxStr::format("%s: Can not open file", filename);
+       emsg = fxStr::format(_("%s: Can not open file"), filename);
        return (NULL);
     }
     if (Sys::fstat(fd, sb) < 0) {
-       emsg = fxStr::format("%s: Can not stat file", filename);
+       emsg = fxStr::format(_("%s: Can not stat file"), filename);
        Sys::close(fd);
        return (NULL);
     }
     if ((sb.st_mode & S_IFMT) != S_IFREG) {
-       emsg = fxStr::format("%s: Not a regular file", filename);
+       emsg = fxStr::format(_("%s: Not a regular file"), filename);
        Sys::close(fd);
        return (NULL);
     }
@@ -721,12 +721,12 @@ SendFaxClient::fileType(const char* filename, fxStr& emsg)
     int cc = Sys::read(fd, buf, sizeof (buf));
     Sys::close(fd);
     if (cc == 0) {
-       emsg = fxStr::format("%s: Empty file", filename);
+       emsg = fxStr::format(_("%s: Empty file"), filename);
        return (NULL);
     }
     const TypeRule* tr = typeRules->match(buf, cc);
     if (!tr) {
-       emsg = fxStr::format("%s: Can not determine file type", filename);
+       emsg = fxStr::format(_("%s: Can not determine file type"), filename);
        return (NULL);
     }
     if (tr->getResult() == TypeRule::ERROR) {
index 9dab502142f0821cac3bdc686938f5e1861f5a11..ce9ca4fa0d15d2b5825a523a6c14a9378fa285b6 100644 (file)
@@ -530,7 +530,7 @@ SendFaxJob::createJob(SendFaxClient& client, fxStr& emsg)
     if (coverFile != "") {
        int fd = Sys::open(coverFile, O_RDONLY);
        if (fd < 0) {
-           emsg = fxStr::format("%s: Can not open: %s",
+           emsg = fxStr::format(_("%s: Can not open: %s"),
                (const char*) coverFile, strerror(errno));
            return (false);                     // XXX
        }
@@ -542,7 +542,7 @@ SendFaxJob::createJob(SendFaxClient& client, fxStr& emsg)
        Sys::close(fd);
        if (!fileSent) {
            if (emsg == "")
-               emsg = "Document transfer failed: " | client.getLastResponse();
+               emsg = _("Document transfer failed: ") | client.getLastResponse();
            return (false);
        }
        CHECK(client.jobCover(coverDoc))
index b90184542c5724f4d849f88e1fa54b536ed4b8d1..a751cf9f8336bc62c6ec459e65172c39ede3f730 100644 (file)
@@ -60,7 +60,7 @@ u_long Sequence::getNext(const char* name, fxStr& emsg)
         fd = -1;
     }
     if (fd < 0) {
-        emsg = fxStr::format("Unable to open sequence number file %s; %s.",
+        emsg = fxStr::format(_("Unable to open sequence number file %s; %s."),
             name, strerror(errno));
         logError("%s: open: %s", name, strerror(errno));
         return ((u_long) -1);
@@ -74,7 +74,7 @@ u_long Sequence::getNext(const char* name, fxStr& emsg)
         seqnum = atol(line);
     }
     if (seqnum < 1 || seqnum >= MAXSEQNUM) {
-        logWarning("%s: Invalid sequence number \"%s\", resetting to 1",
+        logWarning(_("%s: Invalid sequence number \"%s\", resetting to 1"),
             name, line);
         seqnum = 1;
     }
@@ -84,7 +84,7 @@ u_long Sequence::getNext(const char* name, fxStr& emsg)
     if (Sys::write(fd, (const char*)line2, len) != len ||
             ftruncate(fd, len)) {
         emsg = fxStr::format(
-            "Unable update sequence number file %s; write failed.", name);
+            _("Unable update sequence number file %s; write failed."), name);
         logError("%s: Problem updating sequence number file", name);
         return ((u_long) -1);
     }
index 99fac8a042f25af31a4195cf0391032dc22ccbc8..07ef780379996da2bfa5be58047ba30038b48494 100644 (file)
@@ -307,7 +307,7 @@ fxStr fxStr::copy() const
 
 void fxStr::remove(u_int start, u_int chars)
 {
-    fxAssert(start+chars<slength,"Str::remove: Invalid range");
+    fxAssert(start+chars<slength, "Str::remove: Invalid range");
     long move = slength-start-chars;           // we always move at least 1
     assert(move > 0);
     if (slength - chars <= 1) {
@@ -321,7 +321,7 @@ void fxStr::remove(u_int start, u_int chars)
 
 fxStr fxStr::cut(u_int start, u_int chars)
 {
-    fxAssert(start+chars<slength,"Str::cut: Invalid range");
+    fxAssert(start+chars<slength, "Str::cut: Invalid range");
     fxStr a(data+start, chars);
     remove(start, chars);
     return a;
index d8be6bc951af76afbbd28da1d37defd72646cb49..c6985c30b5ff17148a9c27842022d752c57c1982 100644 (file)
@@ -92,7 +92,7 @@ TextFormat::~TextFormat()
 void
 TextFormat::warning(const char* fmt ...) const
 {
-    fputs("Warning, ", stderr);
+    fputs(_("Warning, "), stderr);
     va_list ap;
     va_start(ap, fmt);
     vfprintf(stderr, fmt, ap);
@@ -129,7 +129,7 @@ TextFormat::addFont(const char* name, const char* family)
     if (workStarted) {
        fxStr emsg;
        if (!f->readMetrics(pointSize, useISO8859, emsg))
-           error("Font %s: %s", f->getFamily(), (const char*) emsg);
+           error(_("Font %s: %s"), f->getFamily(), (const char*) emsg);
     }
     return (f);
 }
@@ -248,7 +248,7 @@ TextFormat::beginFormatting(FILE* o)
      */
     tf = Sys::tmpfile();
     if (tf == NULL)
-       fatal("Cannot open temporary file: %s", strerror(errno));
+       fatal(_("Cannot open temporary file: %s"), strerror(errno));
 
     numcol = fxmax(1,numcol);
     if (pointSize == -1)
@@ -256,13 +256,13 @@ TextFormat::beginFormatting(FILE* o)
     else
        pointSize = fxmax(inch("3bp"), pointSize);
     if (pointSize > inch("18bp"))
-       warning("point size is unusually large (>18pt)");
+       warning(_("point size is unusually large (>18pt)"));
     // read font metrics
     for (FontDictIter iter(*fonts); iter.notDone(); iter++) {
        fxStr emsg;
        TextFont* f = iter.value();
        if (!f->readMetrics(pointSize, useISO8859, emsg))
-           error("Font %s: %s", f->getFamily(), (const char*) emsg);
+           error(_("Font %s: %s"), f->getFamily(), (const char*) emsg);
     }
     outline = fxmax(0L,outline);
     curFont = (*fonts)["Roman"];
@@ -274,10 +274,10 @@ TextFormat::beginFormatting(FILE* o)
        pageHeight = t;
     }
     if (lm+rm >= pageWidth)
-       fatal("Margin values too large for page; lm %lu rm %lu page width %lu",
+       fatal(_("Margin values too large for page; lm %lu rm %lu page width %lu"),
            lm, rm, pageWidth);
     if (tm+bm >= pageHeight)
-       fatal("Margin values too large for page; tm %lu bm %lu page height %lu",
+       fatal(_("Margin values too large for page; tm %lu bm %lu page height %lu"),
            tm, bm, pageHeight);
 
     col_width = (pageWidth - (lm + rm))/numcol;
@@ -318,7 +318,7 @@ TextFormat::endFormatting(void)
        Copy_Block(0L, last-1);
     }
     if (fclose(tf))
-       fatal("Close failure on temporary file: %s", strerror(errno));
+       fatal(_("Close failure on temporary file: %s"), strerror(errno));
     tf = NULL;
     emitTrailer();
     fflush(output);
@@ -334,9 +334,9 @@ TextFormat::Copy_Block(off_t b1, off_t b2)
        size_t cc = (size_t) fxmin(sizeof (buf), (size_t) (b2-k+1));
        fseek(tf, (long) k, SEEK_SET);          // position to desired block
        if (fread(buf, 1, (size_t) cc, tf) != cc)
-           fatal("Read error during reverse collation: %s", strerror(errno));
+           fatal(_("Read error during reverse collation: %s"), strerror(errno));
        if (fwrite(buf, 1, (size_t) cc, output) != cc)
-           fatal("Output write error: %s", strerror(errno));
+           fatal(_("Output write error: %s"), strerror(errno));
     }
 }
 
@@ -716,7 +716,7 @@ TextFormat::formatFile(const char* name)
        formatFile(fp);
        fclose(fp);
     } else
-       error("%s: Cannot open file: %s", name, strerror(errno));
+       error(_("%s: Cannot open file: %s"), name, strerror(errno));
 }
 
 void
@@ -1001,7 +1001,7 @@ TextFormat::flush(void)
 {
     fflush(tf);
     if (ferror(tf) && errno == ENOSPC)
-       fatal("Output write error: %s", strerror(errno));
+       fatal(_("Output write error: %s"), strerror(errno));
 }
 
 /*
@@ -1173,7 +1173,7 @@ TextFont::decodeFontName(const char* name, fxStr& filename, fxStr& emsg)
                 size_t len = strcspn(buf, "%\n");
                 if (len == strlen(buf)) {
                    emsg = fxStr::format(
-                       "Warning:%s - line too long.", (const char*)fontMapFile);
+                       _("Warning: %s - line too long."), (const char*)fontMapFile);
                        break;
                 }
                if (len == 0) continue;
@@ -1191,7 +1191,7 @@ TextFont::decodeFontName(const char* name, fxStr& filename, fxStr& emsg)
                         *(buf + len) = '\0';
                         if (len == strlen(buf)) {
                            emsg = fxStr::format(
-                               "Warning: %s - line too long.", (const char*) fontMapFile);
+                               _("Warning: %s - line too long."), (const char*) fontMapFile);
                            break;
                         }
                        if (len == 0) continue;
@@ -1231,7 +1231,7 @@ TextFont::decodeFontName(const char* name, fxStr& filename, fxStr& emsg)
                        bool result = stat(filename, &junk) ? false : true;
                        if (!result)
                            emsg = fxStr::format(
-                               "Warning: %s invalid Fontmap entry - no filename present", (const char*)val);
+                               _("Warning: %s invalid Fontmap entry - no filename present"), (const char*)val);
                         return result;
                     }
                 }
@@ -1371,7 +1371,7 @@ TextFont::readMetrics(TextCoord ps, bool useISO8859, fxStr& emsg)
     FILE *fp = openAFMFile(file);
     if (fp == NULL) {
        emsg = fxStr::format(
-           "%s: Can not open font metrics file; using fixed widths",
+           _("%s: Can not open font metrics file; using fixed widths"),
            (const char*) file);
        loadFixedMetrics(625*ps/1000L);         // NB: use fixed width metrics
        return (false);
@@ -1388,7 +1388,7 @@ TextFont::readMetrics(TextCoord ps, bool useISO8859, fxStr& emsg)
     do {
        if (!getAFMLine(fp, buf, sizeof (buf))) {
            emsg = fxStr::format(
-               "%s: No glyph metric table located; using fixed widths",
+               _("%s: No glyph metric table located; using fixed widths"),
                (const char*) file);
            fclose(fp);
            /*
@@ -1407,7 +1407,7 @@ TextFont::readMetrics(TextCoord ps, bool useISO8859, fxStr& emsg)
        int ix, w;
        /* read the glyph position and width */
        if (sscanf(buf, "C %d ; WX %d ;", &ix, &w) != 2) {
-           emsg = fxStr::format("%s, line %u: format error",
+           emsg = fxStr::format(_("%s, line %u: format error"),
                (const char*) file, lineno);
            fclose(fp);
            return (false);
index 75c7e4fdd8fed4df3d31a6c3bd55b661aa11c528..49449f9ae919308ae4177e66414cc3d5d111e2ac 100644 (file)
@@ -84,9 +84,3 @@ Transport::abortCmd(fxStr& emsg)
     }
     return (true);
 }
-
-void
-Transport::notConfigured(const char* what, fxStr& emsg)
-{
-    emsg = fxStr::format("Sorry, no %s communication support was configured.", what);
-}
index 56d535cb62992c0a678e8ec5bcb4079a9bdfdb9c..657bb2677aea09ece8e1f3dea8a708c14471f1fc 100644 (file)
@@ -37,7 +37,7 @@ protected:
 
     Transport(FaxClient&);
 
-    void notConfigured(const char* what, fxStr& emsg);
+    virtual void notConfigured(fxStr& emsg);
 public:
     virtual ~Transport();
 
index 2a65c7aa528309d030380be9d9f567a4e32af1b3..398a648ca86ca98cfad97499f796dad2c822694d 100644 (file)
@@ -88,7 +88,7 @@ bool
 TypeRule::match(const void* data, size_t size, bool verbose) const
 {
     if (verbose) {
-       printf("rule: %soffset %#lx %s %s",
+       printf(_("rule: %soffset %#lx %s %s"),
            cont ? ">" : "",
            (u_long) off,
            typeNames[type],
@@ -98,7 +98,7 @@ TypeRule::match(const void* data, size_t size, bool verbose) const
            printf(" \"%s\"", value.s);
        else if (type != ASCII && type != ASCIIESC) {
            if (op == ANY)
-               printf(" <any value>");
+               printf(_(" <any value>"));
            else
                printf(" %#llx", (long long) value.v);
        }
@@ -106,7 +106,7 @@ TypeRule::match(const void* data, size_t size, bool verbose) const
     }
     if (off > (off_t)size) {
        if (verbose)
-           printf("failed (offset past data)\n");
+           printf(_("failed (offset past data)\n"));
        return (false);
     }
     bool ok = false;
@@ -119,7 +119,7 @@ TypeRule::match(const void* data, size_t size, bool verbose) const
        for (i = 0; i < size; i++)
            if (!isprint(cp[i]) && !isspace(cp[i])) {
                if (verbose)
-                   printf("failed (unprintable char %#x)\n", cp[i]);
+                   printf(_("failed (unprintable char %#x)\n"), cp[i]);
                return (false);
            }
        ok = true;
@@ -131,7 +131,7 @@ TypeRule::match(const void* data, size_t size, bool verbose) const
        for (i = 0; i < size; i++)
            if (!isprint(cp[i]) && !isspace(cp[i]) && cp[i] != '\033') {
                if (verbose)
-                   printf("failed (unprintable char %#x)\n", cp[i]);
+                   printf(_("failed (unprintable char %#x)\n"), cp[i]);
                return (FALSE);
            }
        ok = TRUE;
@@ -159,7 +159,7 @@ TypeRule::match(const void* data, size_t size, bool verbose) const
            break;
        }
        if (verbose)
-           printf("failed (insufficient data)\n");
+           printf(_("failed (insufficient data)\n"));
        return (false);
     case LONG:
        if (off + 4 < (off_t)size) {
@@ -168,7 +168,7 @@ TypeRule::match(const void* data, size_t size, bool verbose) const
            break;
        }
        if (verbose)
-           printf("failed (insufficient data)\n");
+           printf(_("failed (insufficient data)\n"));
        return (false);
     }
     /*
@@ -189,10 +189,10 @@ TypeRule::match(const void* data, size_t size, bool verbose) const
 done:
     if (verbose) {
        if (ok)
-           printf("success (result %s, rule \"%s\")\n",
+           printf(_("success (result %s, rule \"%s\")\n"),
                resultNames[result], (const char*) cmd);
        else
-           printf("failed (comparison)\n");
+           printf(_("failed (comparison)\n"));
     }
     return (ok);
 }
@@ -306,7 +306,7 @@ parseError(const char* file, u_int lineno, const char* fmt ...)
 {
     va_list ap;
     va_start(ap, fmt);
-    fprintf(stderr, "%s: line %u: ", file, lineno); 
+    fprintf(stderr, _("%s: line %u: "), file, lineno);
     vfprintf(stderr, fmt, ap);
     va_end(ap);
 }
@@ -318,7 +318,7 @@ TypeRules::read(const fxStr& file)
 
     fp = fopen(file, "r");
     if (fp == NULL) {
-       fprintf(stderr, "%s: Can not open type rules file.\n",
+       fprintf(stderr, _("%s: Can not open type rules file.\n"),
            (const char*) file);
        return NULL;
     }
@@ -339,7 +339,7 @@ TypeRules::read(const fxStr& file)
        const char *op = cp;
        rule.off = strtoul(op, &cp, 0); // file offset
        if (cp == op) {
-           parseError(file, lineno, "Missing file offset");
+           parseError(file, lineno, _("Missing file offset"));
            continue;
        }
        while (isspace(*cp))
@@ -364,7 +364,7 @@ TypeRules::read(const fxStr& file)
        else if (strncasecmp(tp, "addr", cp-tp) == 0)
            rule.type = TypeRule::ADDR;
        else {
-           parseError(file, lineno, "Unknown datatype \"%.*s\"", cp-tp, tp);
+           parseError(file, lineno, _("Unknown datatype \"%.*s\""), cp-tp, tp);
            continue;                   // bad type
        }
        while (isspace(*cp))
@@ -405,7 +405,7 @@ TypeRules::read(const fxStr& file)
                const char* vp = cp;
                rule.value.v = strtol(vp, &cp, 0);
                if (vp == cp) {
-                   parseError(file, lineno, "Missing match value");
+                   parseError(file, lineno, _("Missing match value"));
                    continue;
                }
            }
@@ -433,7 +433,7 @@ TypeRules::read(const fxStr& file)
        else if (strncasecmp(rp, "error", cp-rp) == 0)
            rule.result = TypeRule::ERROR;
        else {
-           parseError(file, lineno, "Unknown result \"%.*s\"", cp-rp, rp);
+           parseError(file, lineno, _("Unknown result \"%.*s\""), cp-rp, rp);
            continue;
        }
        while (isspace(*cp))
@@ -483,13 +483,13 @@ const TypeRule*
 TypeRules::match(const void* data, u_int size) const
 {
     if (verbose)
-       printf("match against (..., %u)\n", size);
+       printf(_("match against (..., %u)\n"), size);
     for (u_int i = 0, n = (*rules).length(); i < n; i++) {
        TypeRule& rule = (*rules)[i];
        if (!rule.isContinuation() && rule.match(data, size, verbose))
            return (&(*rules)[i + match2(i, data, size, verbose)]);
     }
     if (verbose)
-       printf("no match\n");
+       printf(_("no match\n"));
     return (NULL);
 }
index 88b3eac89c9c1b2da95f13d513fd8d85d89cec3e..8bfc131df0280461962151e4b935560374737fd7 100644 (file)
@@ -31,6 +31,7 @@
 #include "stdio.h"
 #include "sys/types.h"
 #include "port.h"
+#include "config.h"
 
 // Needed for the placement new operator
 #ifdef HAS_OLD_NEW_H
index d3ba1590391cf7edc15089df21e09278a9e4f64a..e254f480d31302c75292679918282a1bdf6d8a0b 100644 (file)
@@ -49,7 +49,7 @@ UnixTransport::callServer(fxStr& emsg)
 {
     int fd = socket(AF_UNIX, SOCK_STREAM, 0);
     if (fd < 0) {
-       emsg = "Can not create socket to connect to server.";
+       emsg = _("Can not create socket to connect to server.");
        return (false);
     }
     struct sockaddr_un Sun;
@@ -57,13 +57,13 @@ UnixTransport::callServer(fxStr& emsg)
     Sun.sun_family = AF_UNIX;
     strncpy(Sun.sun_path, client.getHost(), sizeof (Sun.sun_path));
     if (client.getVerbose())
-       client.traceServer("connect to server at %s",
+       client.traceServer(_("connect to server at %s"),
            (const char*) client.getHost());
     if (Socket::connect(fd, &Sun, sizeof (Sun)) >= 0) {
        client.setCtrlFds(fd, dup(fd));
        return (true);
     } else {
-       emsg = fxStr::format("Can not reach server at Unix domain socket \"%s\".",
+       emsg = fxStr::format(_("Can not reach server at Unix domain socket \"%s\"."),
            (const char*) client.getHost());
        Sys::close(fd), fd = -1;
        return (false);
@@ -132,10 +132,16 @@ UnixTransport::openDataConn(fxStr&)
 #endif
 }
 #else
+void
+Transport::notConfigured(fxStr& emsg)
+{
+    emsg = _("Sorry, no Unix domain communication support was configured.");
+}
+
 bool UnixTransport::callServer(fxStr& emsg)
-    { notConfigured("Unix domain", emsg); return (false); }
+    { notConfigured(emsg); return (false); }
 bool UnixTransport::initDataConn(fxStr& emsg)
-    { notConfigured("Unix domain", emsg); return (false); }
+    { notConfigured(emsg); return (false); }
 bool UnixTransport::openDataConn(fxStr& emsg)
-    { notConfigured("Unix domain", emsg); return (false); }
+    { notConfigured(emsg); return (false); }
 #endif
index 80ffa3c66be495e24d983e3caa9dea8d372ee6c3..d65c9acb2efd8be47a969b60b08f1cecb7b59fc7 100644 (file)
@@ -42,13 +42,13 @@ static      bool quiet = false;
 static void
 usage()
 {
-    fxFatal("usage: %s"
+    fxFatal(_("usage: %s"
        " [-v]"
        " [-a area-code]"
        " [-c country-code]"
        " [-i international-prefix]"
        " [-l long-distance-prefix]"
-       " dialrules"
+       " dialrules")
        , appName
        );
 }
@@ -57,7 +57,7 @@ static int
 prompt()
 {
     if (! quiet)
-           printf("ready> "); fflush(stdout);
+           printf(_("ready> ")); fflush(stdout);
     return (1);
 }
 
@@ -107,14 +107,14 @@ main(int argc, char* argv[])
     rules.def("InternationalPrefix", internationalPrefix);
     rules.def("LongDistancePrefix", longDistancePrefix);
     if (!rules.parse())
-       fxFatal("%s: Problem parsing rules in %s", appName, argv[optind]);
+       fxFatal(_("%s: Problem parsing rules in %s"), appName, argv[optind]);
     char line[1024];
     while (prompt() && fgets(line, sizeof (line), stdin)) {
        char* cp = strchr(line, '\n');
        if (cp)
            *cp = '\0';
        if (verbose)
-           printf("input = \"%s\"\n", line);
+           printf(_("input = \"%s\"\n"), line);
        if ((cp = strchr(line, '('))) {
            char* ep = strrchr(cp, ')');
            if (ep)
@@ -129,9 +129,9 @@ main(int argc, char* argv[])
            fxStr c = rules.canonicalNumber(line);
            fxStr d = rules.dialString(line);
            fxStr n = rules.displayNumber(line);
-           printf("canonical = \"%s\"\n", (const char*) c);
-           printf("dial-string = \"%s\"\n", (const char*) d);
-           printf("display = \"%s\"\n", (const char *) n);
+           printf(_("canonical = \"%s\"\n"), (const char*) c);
+           printf(_("dial-string = \"%s\"\n"), (const char*) d);
+           printf(_("display = \"%s\"\n"), (const char *) n);
        }
     }
     return (0);
index 142fcf9d1566a7854d5a31e89d69b90ce815c1a9..45859a8d6b09b69bbc071fe298e1c2c5fd8d5441 100644 (file)
@@ -89,7 +89,7 @@ faxFetchApp::run(int argc, char** argv)
            mode = MODE_Z;
            break;
        case '?':
-           fxFatal("usage: faxfetch [-h server-host] [-v] file");
+           fxFatal(_("usage: faxfetch [-h server-host] [-v] file"));
        }
     if (optind < argc) {
        fxStr emsg;
index 9f6bf9292f01bea28348f77890d4afd3d19ac2f3..c3f7966158b7a378cda9b10ba049701f19e3dc24 100644 (file)
@@ -82,17 +82,17 @@ sanitize(fxStr& s)
 static void
 usage (const char* app)
 {
-    printf("usage: %s [-n] [-S fmt] [-s fmt] [-e fmt] [-E fmt] [-D]\n\n", app);
-    printf("\t-n\tPrint FAX filename\n");
-    printf("\t-C d\tQuoted CSV-style output with <d> as the deliminator\n");
-    printf("\t-c d\tCSV-style output with <d> as the deliminator\n");
-    printf("\t-r\traw format - values outputed with no names\n");
+    printf(_("usage: %s [-n] [-S fmt] [-s fmt] [-e fmt] [-E fmt] [-D]\n\n"), app);
+    printf(_("\t-n\tPrint FAX filename\n"));
+    printf(_("\t-C d\tQuoted CSV-style output with <d> as the deliminator\n"));
+    printf(_("\t-c d\tCSV-style output with <d> as the deliminator\n"));
+    printf(_("\t-r\traw format - values outputed with no names\n"));
 
-    printf("  Raw format options:\n");
-    printf("\t-S fmt\tUse fmt for the fax start format\n");
-    printf("\t-s fmt\tUse fmt for the field start format\n");
-    printf("\t-e fmt\tUse fmt for the field end format\n");
-    printf("\t-E fmt\tUse fmt for the fax end format\n");
+    printf(_("  Raw format options:\n"));
+    printf(_("\t-S fmt\tUse fmt for the fax start format\n"));
+    printf(_("\t-s fmt\tUse fmt for the field start format\n"));
+    printf(_("\t-e fmt\tUse fmt for the field end format\n"));
+    printf(_("\t-E fmt\tUse fmt for the fax end format\n"));
 }
 
 static const char*
@@ -240,13 +240,13 @@ main(int argc, char** argv)
        TIFFSetWarningHandler(NULL);
        TIFF* tif = TIFFOpen(argv[optind], "r");
        if (tif == NULL) {
-           printf("Could not open %s; either not TIFF or corrupted.\n",
+           printf(_("Could not open %s; either not TIFF or corrupted.\n"),
                    argv[optind]);
            return (1);
        }
        bool ok = isFAXImage(tif);
        if (!ok) {
-           printf("Does not look like a facsimile?\n");
+           printf(_("Does not look like a facsimile?\n"));
            return (1);
        }
 
@@ -330,13 +330,13 @@ main(int argc, char** argv)
                i++;
            }
        } else
-           sender = "<unknown>";
-       printField("%s", "Sender", (const char*) sender);
+           sender = _("<unknown>");
+       printField("%s", _("Sender"), (const char*) sender);
 #ifdef TIFFTAG_FAXSUBADDRESS
        if (TIFFGetField(tif, TIFFTAG_FAXSUBADDRESS, &cp)) {
            fxStr subaddr(cp);
            sanitize(subaddr);
-           printField("%s", "SubAddr", (const char*) subaddr);
+           printField("%s", _("SubAddr"), (const char*) subaddr);
        }
 #endif
        fxStr date;
@@ -378,31 +378,31 @@ main(int argc, char** argv)
        } while (TIFFReadDirectory(tif));
        TIFFClose(tif);
 
-       printField("%u", "Pages", npages);
+       printField("%u", _("Pages"), npages);
        if (params.vr == VR_NORMAL)
-           printField("Normal", "Quality");
+           printField(_("Normal"), _("Quality"));
        else if (params.vr == VR_FINE)
-           printField("Fine", "Quality");
+           printField(_("Fine"), _("Quality"));
        else if (params.vr == VR_R8)
-           printField("Superfine", "Quality");
+           printField(_("Superfine"), _("Quality"));
        else if (params.vr == VR_R16)
-           printField("Hyperfine", "Quality");
+           printField(_("Hyperfine"), _("Quality"));
        else
-           printField("%u lines/inch", "Quality", params.verticalRes());
+           printField(_("%u lines/inch"), _("Quality"), params.verticalRes());
        PageSizeInfo* info = PageSizeInfo::getPageSizeBySize(w, h);
        if (info)
-           printField("%s", "Page", info->name());
+           printField("%s", _("Page"), info->name());
        else
-           printField("%u by %u", "Page", params.pageWidth(), (u_int) h);
+           printField(_("%u by %u"), _("Page"), params.pageWidth(), (u_int) h);
        delete info;
-       printField("%s", "Received", (const char*) date);
-       printField("%s", "TimeToRecv", time == 0 ? "<unknown>" : fmtTime(time));
-       printField("%s", "SignalRate", params.bitRateName());
-       printField("%s", "DataFormat", params.dataFormatName());
-       printField("%s", "ErrCorrect", params.ec == EC_DISABLE ? "No" : "Yes");
+       printField("%s", _("Received"), (const char*) date);
+       printField("%s", _("TimeToRecv"), time == 0 ? _("<unknown>") : fmtTime(time));
+       printField("%s", _("SignalRate"), params.bitRateName());
+       printField("%s", _("DataFormat"), params.dataFormatName());
+       printField("%s", _("ErrCorrect"), params.ec == EC_DISABLE ? _("No") : _("Yes"));
        for (u_int i = 0; i < callid.size(); i++) {
            // formatting will mess up if i gets bigger than one digit
-           fxStr fmt(fxStr::format("CallID%u", i+1));
+           fxStr fmt(fxStr::format(_("CallID%u"), i+1));
            printField("%s", (const char*)fmt, (const char*) callid.id(i));
        }
        printEnd(name);
index a5b38fad99ef94e03968c91571fb3dc3fb3de5ce..27561b55b732b8ba4ce25f8b446017a0404b82c2 100644 (file)
@@ -52,7 +52,7 @@ static bool
 writeData(int arg, const char* buf, int cc, fxStr& emsg)
 {
     if (Sys::write((intptr_t) arg, buf, cc) != cc) {
-       emsg = fxStr::format("write error: %s", strerror(errno));
+       emsg = fxStr::format(_("write error: %s"), strerror(errno));
        return (false);
     } else
        return (true);
@@ -98,7 +98,7 @@ watchApp::run(int argc, char** argv)
     if (callServer(emsg)) {
        if (login(NULL, emsg) && setType(TYPE_A)) {
            if (getTimeZone() == TZ_GMT)
-               printWarning("time values reported in GMT");
+               printWarning(_("time values reported in GMT"));
            (void) recvData(writeData, STDOUT_FILENO, emsg, 0,
                "SITE TRIGGER %s", argv[optind]);
        }
@@ -111,7 +111,7 @@ watchApp::run(int argc, char** argv)
 void
 watchApp::usage()
 {
-    fxFatal("usage: %s [-h host] [-g] [-l] [-v] trigger-specification",
+    fxFatal(_("usage: %s [-h host] [-g] [-l] [-v] trigger-specification"),
        (const char*) appName);
 }
 
index 67689f418ba2e0dd039205e32142cfbc73ebddd0..35a16097283f1dddd0b5a85d6d3e9eadf0cae2aa 100644 (file)
@@ -42,7 +42,7 @@ static        const char* prog;
 static void
 usage()
 {
-    fprintf(stderr, "Usage: %s"
+    fprintf(stderr, _("Usage: %s"
        " [-1]"
        " [-2]"
        " [-B]"
@@ -57,13 +57,13 @@ usage()
        " [-U]"
        " [-Ml=#,r=#,t=#,b=#]"
        " [-V #]"
-       " files... >out.ps\n", prog);
-    fprintf(stderr,"Default options:"
+       " files... >out.ps\n"), prog);
+    fprintf(stderr, _("Default options:"
        " -f Courier"
        " -1"
        " -p 11bp"
        " -o 0"
-       "\n");
+       "\n"));
     exit(1);
 }
 
@@ -106,7 +106,7 @@ main(int argc, char* argv[])
        case 'f':               // body font
            if (!fmt.setTextFont(optarg)) {
                fprintf(stderr,
-                   "%s: No font metric information found for \"%s\".\n",
+                   _("%s: No font metric information found for \"%s\".\n"),
                    prog, optarg);
                usage();
            }
@@ -122,7 +122,7 @@ main(int argc, char* argv[])
            break;
        case 'M':               // margin(s)
            if (!fmt.setPageMargins(optarg)) {
-               fprintf(stderr, "Bad margin syntax.\n");
+               fprintf(stderr, _("Bad margin syntax.\n"));
                usage();
            }
            break;
@@ -140,7 +140,7 @@ main(int argc, char* argv[])
            break;
        case 's':               // page size
            if (!fmt.setPageSize(optarg)) {
-               fprintf(stderr, "Unknown page size %s.\n", optarg);
+               fprintf(stderr, _("Unknown page size %s.\n"), optarg);
                usage();
            }
            break;
@@ -151,7 +151,7 @@ main(int argc, char* argv[])
            fmt.setTextLineHeight(TextFormat::inch(optarg));
            break;
        default:
-           fprintf(stderr,"Unrecognized option \"%c\".\n", c);
+           fprintf(stderr, _("Unrecognized option \"%c\".\n"), c);
            usage();
        }
 #ifdef notdef
index 702b0947cfc8ad99c087c687b9389278c33960c2..a7242d240d1f9c9d0384069d70827c19d7c96227 100644 (file)
@@ -33,12 +33,12 @@ extern void fxFatal(const char* fmt, ...);
 static void
 usage(void)
 {
-    fxFatal("usage: %s"
+    fxFatal(_("usage: %s"
        " [-r vertical-res]"
        " [-l page-length]"
        " [-w page-width]"
        " [-1] [-2] [-3]"
-       " input.tif"
+       " input.tif")
        , appName
        );
 }
@@ -112,9 +112,9 @@ main(int argc, char* argv[])
     } else {
        struct stat sb;
        if (Sys::stat(argv[optind], sb) < 0)
-           emsg = "Document file is unreadable or does not exist";
+           emsg = _("Document file is unreadable or does not exist");
        else
-           emsg = "Document is not valid TIFF (unspecified format error)";
+           emsg = _("Document is not valid TIFF (unspecified format error)");
        status = REJECT;
     }
     if (status != OK) {
@@ -149,32 +149,32 @@ checkPageFormat(TIFF* tif, fxStr& emsg)
     TIFFGetFieldDefaulted(tif, TIFFTAG_BITSPERSAMPLE, &bps);
     if (bps != 1) {
        emsg.append(fxStr::format(
-           "Document is not a bilevel image (bits/sample %u).\n", bps));
+           _("Document is not a bilevel image (bits/sample %u).\n"), bps));
        status |= REIMAGE;
     }
     uint16 spp;
     TIFFGetFieldDefaulted(tif, TIFFTAG_SAMPLESPERPIXEL, &spp);
     if (spp != 1) {
        emsg.append(fxStr::format(
-           "Document is a multi-sample image (samples/pixel %u).\n", spp));
+           _("Document is a multi-sample image (samples/pixel %u).\n"), spp));
        status |= REIMAGE;
     }
     uint16 compression = 0;
     (void) TIFFGetField(tif, TIFFTAG_COMPRESSION, &compression);
     if (useMMR) {
        if (compression != COMPRESSION_CCITTFAX4) {
-           emsg.append("Document requires reformatting, not in Group 4 format.\n");
+           emsg.append(_("Document requires reformatting, not in Group 4 format.\n"));
            status |= REFORMAT;
        }
     } else {
        if (compression != COMPRESSION_CCITTFAX3) {
-           emsg.append("Document requires reformatting, not in Group 3 format.\n");
+           emsg.append(_("Document requires reformatting, not in Group 3 format.\n"));
            status |= REFORMAT;
        }
        uint32 g3opts = 0;
        (void) TIFFGetField(tif, TIFFTAG_GROUP3OPTIONS, &g3opts);
        if ((g3opts ^ dataFormat) & GROUP3OPT_2DENCODING) {
-           emsg.append("Document requires reformatting, not in 2DMR format.\n");
+           emsg.append(_("Document requires reformatting, not in 2DMR format.\n"));
            status |= REFORMAT;
        }
     }
@@ -183,7 +183,7 @@ checkPageFormat(TIFF* tif, fxStr& emsg)
      * but not if the strips are not in sequential order.
      */
     if (TIFFNumberOfStrips(tif) != 1) {
-       emsg.append("Document should be reformatted as a single strip.\n");
+       emsg.append(_("Document should be reformatted as a single strip.\n"));
        status |= REFORMAT;
     }
 #ifdef notdef
@@ -193,8 +193,8 @@ checkPageFormat(TIFF* tif, fxStr& emsg)
     uint16 fill;
     (void) TIFFGetFieldDefaulted(tif, TIFFTAG_FILLORDER, &fill);
     if (fill != FILLORDER_LSB2MSB) {
-       emsg.append("Document should be reformatted with "
-           "LSB-to-MSB bit order.\n");
+       emsg.append(_("Document should be reformatted with "
+           "LSB-to-MSB bit order.\n"));
        status |= REFORMAT;
     }
 #endif
@@ -232,8 +232,8 @@ checkPageFormat(TIFF* tif, fxStr& emsg)
     }
     // vres is in inches, compare inches to inches, allow 15 lpi variation
     if ((u_long) yresinch > vres ? (u_long) yresinch - vres > 15 : vres - (u_long) yresinch > 15) {
-       emsg.append(fxStr::format("Document requires reformatting to adjust"
-           " vertical resolution (convert to %lu, document is %lu).\n",
+       emsg.append(fxStr::format(_("Document requires reformatting to adjust"
+           " vertical resolution (convert to %lu, document is %lu).\n"),
            vres, (u_long) yresinch));
        status |= REVRES;
     }
@@ -244,12 +244,12 @@ checkPageFormat(TIFF* tif, fxStr& emsg)
      */
     uint32 w;
     if (!TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &w)) {
-       emsg = "Document is not valid TIFF (missing ImageWidth tag).\n";
+       emsg = _("Document is not valid TIFF (missing ImageWidth tag).\n");
        return (REJECT);
     }
     if (w != pageWidth) {
-       emsg.append(fxStr::format("Document requires resizing to adjust"
-           " page width (convert to %lu, document is %lu).\n",
+       emsg.append(fxStr::format(_("Document requires resizing to adjust"
+           " page width (convert to %lu, document is %lu).\n"),
            (u_long) pageWidth, (u_long) w));
        status |= RESIZE;
     }
@@ -264,7 +264,7 @@ checkPageFormat(TIFF* tif, fxStr& emsg)
      */
     uint32 h = 0;
     if (!TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &h)) {
-       emsg = "Document is not valid TIFF (missing ImageLength tag).\n";
+       emsg = _("Document is not valid TIFF (missing ImageLength tag).\n");
        return (REJECT);
     }
     /*
@@ -273,8 +273,8 @@ checkPageFormat(TIFF* tif, fxStr& emsg)
     if (!useUnlimitedLength) {
        float len = h / (yres == 0 ? 1. : yres);                // page length in mm
        if (pageLength != (uint32) -1 && len > pageLength) {
-           emsg.append(fxStr::format("Document requires resizing to adjust"
-               " page length (convert to %lu, document is %lu).\n",
+           emsg.append(fxStr::format(_("Document requires resizing to adjust"
+               " page length (convert to %lu, document is %lu).\n"),
                (u_long) pageLength, (u_long) len));
            status |= RESIZE;
        }
index d6ba39bb82127d0d3367271ac2ba1bff813f63bd..1b05b15470267a8bb9f39d4fa4810a011f772593 100644 (file)
@@ -49,16 +49,16 @@ fileType(const char* filename)
     struct stat sb;
     int fd = open(filename, O_RDONLY);
     if (fd < 0) {
-       fprintf(stderr, "%s: Can not open file\n", filename);
+       fprintf(stderr, _("%s: Can not open file\n"), filename);
        return (NULL);
     }
     if (fstat(fd, &sb) < 0) {
-       fprintf(stderr, "%s: Can not stat file\n", filename);
+       fprintf(stderr, _("%s: Can not stat file\n"), filename);
        close(fd);
        return (NULL);
     }
     if ((sb.st_mode & S_IFMT) != S_IFREG) {
-       fprintf(stderr, "%s: Not a regular file\n", filename);
+       fprintf(stderr, _("%s: Not a regular file\n"), filename);
        close(fd);
        return (NULL);
     }
@@ -66,12 +66,12 @@ fileType(const char* filename)
     int cc = read(fd, buf, sizeof (buf));
     close(fd);
     if (cc == 0) {
-       fprintf(stderr, "%s: Empty file\n", filename);
+       fprintf(stderr, _("%s: Empty file\n"), filename);
        return (NULL);
     }
     const TypeRule* tr = typeRules->match(buf, cc);
     if (!tr) {
-       fprintf(stderr, "%s: Can not determine file type\n", filename);
+       fprintf(stderr, _("%s: Can not determine file type\n"), filename);
        return (NULL);
     }
     if (tr->getResult() == TypeRule::ERROR) {
@@ -87,7 +87,7 @@ char* appName;
 void
 usage()
 {
-    fprintf(stderr, "usage: %s [-f rulesfile] files\n", appName);
+    fprintf(stderr, _("usage: %s [-f rulesfile] files\n"), appName);
     exit(-1);
 }
 
@@ -114,7 +114,7 @@ main(int argc, char* argv[])
        usage();
     typeRules = TypeRules::read(file);
     if (!typeRules) {
-       fprintf(stderr, "Unable to setup file typing and conversion rules\n");
+       fprintf(stderr, _("Unable to setup file typing and conversion rules\n"));
        return (-1);
     }
     typeRules->setVerbose(true);