diff --git a/src/dorem.c b/src/dorem.c index 3f6ef5c7..1ce6a9aa 100644 --- a/src/dorem.c +++ b/src/dorem.c @@ -67,18 +67,18 @@ check_trigger_function(char const *fname, char const *type) if (!f) { if (strcmp(type, "WARN")) { /* Undefined WARN functions are diagnosed elsewhere... */ - Wprint("Undefined %s function: `%s'", type, fname); + Wprint(tr("Undefined %s function: `%s'"), type, fname); } return; } if (f->nargs != 1) { - Wprint("%s function `%s' defined at %s:%d should take 1 argument but actually takes %d", type, fname, f->filename, f->lineno, f->nargs); + Wprint(tr("%s function `%s' defined at %s:%d should take 1 argument but actually takes %d"), type, fname, f->filename, f->lineno, f->nargs); return; } if (ensure_expr_references_first_local_arg(f->node)) { return; } - Wprint("%s function `%s' defined at %s:%d does not use its argument", type, fname, f->filename, f->lineno); + Wprint(tr("%s function `%s' defined at %s:%d does not use its argument"), type, fname, f->filename, f->lineno); } static void @@ -154,7 +154,7 @@ static void ensure_satnode_mentions_trigdate(expr_node *node) if (node->type == N_CONSTANT) { if (node->u.value.type == INT_TYPE) { if (node->u.value.v.val == 0) { - Wprint("SATISFY: constant 0 will never be true"); + Wprint(tr("SATISFY: constant 0 will never be true")); } return; } @@ -166,14 +166,14 @@ static void ensure_satnode_mentions_trigdate(expr_node *node) str = node->u.name; } if (!*str) { - Wprint("SATISFY: constant \"\" will never be true"); + Wprint(tr("SATISFY: constant \"\" will never be true")); } return; } ensure_satnode_mentions_trigdate_aux(node, &mentioned); if (!mentioned) { - Wprint("SATISFY: expression has no reference to trigdate() or $T..."); + Wprint(tr("SATISFY: expression has no reference to trigdate() or $T...")); } } @@ -615,7 +615,7 @@ int ParseRem(ParsePtr s, Trigger *trig, TimeTrig *tim) case T_Omit: DBufFree(&buf); if (trig->omitfunc[0]) { - Wprint("Warning: OMIT is ignored if you use OMITFUNC"); + Wprint(tr("Warning: OMIT is ignored if you use OMITFUNC")); } r = ParseLocalOmit(s, trig); @@ -629,7 +629,7 @@ int ParseRem(ParsePtr s, Trigger *trig, TimeTrig *tim) case T_OmitFunc: if (trig->localomit) { - Wprint("Warning: OMIT is ignored if you use OMITFUNC"); + Wprint(tr("Warning: OMIT is ignored if you use OMITFUNC")); } r=ParseToken(s, &buf); if (r) return r; @@ -707,7 +707,7 @@ int ParseRem(ParsePtr s, Trigger *trig, TimeTrig *tim) trig->typ = MSG_TYPE; if (s->isnested) return E_CANT_NEST_RTYPE; if (!WarnedAboutImplicit && !SuppressImplicitRemWarnings) { - Wprint("Missing REM type; assuming MSG"); + Wprint(tr("Missing REM type; assuming MSG")); WarnedAboutImplicit = 1; } parsing = 0; @@ -738,22 +738,22 @@ int ParseRem(ParsePtr s, Trigger *trig, TimeTrig *tim) if (!s->nonconst_expr) { if (trig->y != NO_YR && trig->m != NO_MON && trig->d != NO_DAY && trig->until != NO_UNTIL) { if (DSE(trig->y, trig->m, trig->d) > trig->until) { - Wprint("Warning: UNTIL/THROUGH date earlier than start date"); + Wprint(tr("Warning: UNTIL/THROUGH date earlier than start date")); } } if (trig->from != NO_DATE) { if (trig->until != NO_UNTIL && trig->until < trig->from) { - Wprint("Warning: UNTIL/THROUGH date earlier than FROM date"); + Wprint(tr("Warning: UNTIL/THROUGH date earlier than FROM date")); } } else if (trig->scanfrom != NO_DATE) { if (trig->until != NO_UNTIL && trig->until < trig->scanfrom) { - Wprint("Warning: UNTIL/THROUGH date earlier than SCANFROM date"); + Wprint(tr("Warning: UNTIL/THROUGH date earlier than SCANFROM date")); } } } if (trig->y != NO_YR && trig->m != NO_MON && trig->d != NO_DAY && trig->until != NO_UNTIL && trig->rep == NO_REP) { - Wprint("Warning: Useless use of UNTIL with fully-specified date and no *rep"); + Wprint(tr("Warning: Useless use of UNTIL with fully-specified date and no *rep")); } /* Set scanfrom to default if not set explicitly */ diff --git a/src/dosubst.c b/src/dosubst.c index 46a3eef0..d59bc563 100644 --- a/src/dosubst.c +++ b/src/dosubst.c @@ -40,7 +40,7 @@ check_subst_args(UserFunc *f, int n) if (f->nargs == n) { return 1; } - Wprint("Function `%s' defined at %s:%d should take %d argument%s, but actually takes %d", + Wprint(tr("Function `%s' defined at %s:%d should take %d argument%s, but actually takes %d"), f->name, f->filename, f->lineno, n, (n == 1 ? "" : "s"), f->nargs); return 0; } @@ -232,7 +232,7 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int dse, DBufPutc(&orig, c); } if (!c) { - Wprint("Warning: Unterminated %%(...) substitution sequence"); + Wprint(tr("Warning: Unterminated %%(...) substitution sequence")); } err = OK; if (GetTranslatedStringTryingVariants(DBufValue(&orig), &translated)) { @@ -275,11 +275,11 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int dse, } } if (!c) { - Wprint("Warning: Unterminated %%{...} substitution sequence"); + Wprint(tr("Warning: Unterminated %%{...} substitution sequence")); } func = FindUserFunc(s); if (!func) { - Wprint("No substition function `%s' defined", s); + Wprint(tr("No substition function `%s' defined"), s); continue; } diff --git a/src/files.c b/src/files.c index 6cc116a9..9e89d1a4 100644 --- a/src/files.c +++ b/src/files.c @@ -145,7 +145,7 @@ static void OpenPurgeFile(char const *fname, char const *mode) if (DBufPuts(&fname_buf, ".purged") != OK) return; PurgeFP = fopen(DBufValue(&fname_buf), mode); if (!PurgeFP) { - fprintf(ErrFp, "Cannot open `%s' for writing: %s\n", DBufValue(&fname_buf), strerror(errno)); + fprintf(ErrFp, tr("Cannot open `%s' for writing: %s\n"), DBufValue(&fname_buf), strerror(errno)); } set_cloexec(PurgeFP); DBufFree(&fname_buf); @@ -325,7 +325,7 @@ int OpenFile(char const *fname) while (h) { if (!strcmp(fname, h->filename)) { if (DebugFlag & DB_TRACE_FILES) { - fprintf(ErrFp, "Reading `%s': Found in cache\n", fname); + fprintf(ErrFp, tr("Reading `%s': Found in cache\n"), fname); } CLine = h->cache; STRSET(FileName, fname); @@ -348,13 +348,13 @@ int OpenFile(char const *fname) PurgeFP = stdout; } if (DebugFlag & DB_TRACE_FILES) { - fprintf(ErrFp, "Reading `-': Reading stdin\n"); + fprintf(ErrFp, tr("Reading `-': Reading stdin\n")); } } else { fp = fopen(fname, "r"); set_cloexec(fp); if (DebugFlag & DB_TRACE_FILES) { - fprintf(ErrFp, "Reading `%s': Opening file on disk\n", fname); + fprintf(ErrFp, tr("Reading `%s': Opening file on disk\n"), fname); } if (PurgeMode) { OpenPurgeFile(fname, "w"); @@ -401,7 +401,7 @@ static int CacheFile(char const *fname, int use_pclose) char const *s; if (DebugFlag & DB_TRACE_FILES) { - fprintf(ErrFp, "Caching file `%s' in memory\n", fname); + fprintf(ErrFp, tr("Caching file `%s' in memory\n"), fname); } cl = NULL; /* Create a file header */ @@ -539,7 +539,7 @@ static int PopFile(void) if (!Hush && NumIfs) { Eprint("%s", GetErr(E_MISS_ENDIF)); for (j=NumIfs-1; j >=0; j--) { - fprintf(ErrFp, "%s(%d): IF without ENDIF\n", FileName, IfLinenos[j]); + fprintf(ErrFp, tr("%s(%d): IF without ENDIF\n"), FileName, IfLinenos[j]); } } if (!IStackPtr) return E_EOF; @@ -760,7 +760,7 @@ static int SetupGlobChain(char const *dirname, IncludeStruct *i) while(dc) { if (!strcmp(dc->dirname, dir)) { if (DebugFlag & DB_TRACE_FILES) { - fprintf(ErrFp, "Found cached directory listing for `%s'\n", + fprintf(ErrFp, tr("Found cached directory listing for `%s'\n"), dir); } free(dir); @@ -771,7 +771,7 @@ static int SetupGlobChain(char const *dirname, IncludeStruct *i) } if (DebugFlag & DB_TRACE_FILES) { - fprintf(ErrFp, "Scanning directory `%s' for *.rem files\n", dir); + fprintf(ErrFp, tr("Scanning directory `%s' for *.rem files\n"), dir); } if (ShouldCache) { @@ -785,7 +785,7 @@ static int SetupGlobChain(char const *dirname, IncludeStruct *i) } if (dc) { if (DebugFlag & DB_TRACE_FILES) { - fprintf(ErrFp, "Caching directory `%s' listing\n", dir); + fprintf(ErrFp, tr("Caching directory `%s' listing\n"), dir); } dc->chain = NULL; @@ -917,7 +917,7 @@ static int IncludeCmd(char const *cmd) while(h) { if (!strcmp(fname, h->filename)) { if (DebugFlag & DB_TRACE_FILES) { - fprintf(ErrFp, "Reading command `%s': Found in cache\n", fname); + fprintf(ErrFp, tr("Reading command `%s': Found in cache\n"), fname); } CLine = h->cache; STRSET(FileName, fname); @@ -934,7 +934,7 @@ static int IncludeCmd(char const *cmd) } if (DebugFlag & DB_TRACE_FILES) { - fprintf(ErrFp, "Executing `%s' for INCLUDECMD and caching as `%s'\n", + fprintf(ErrFp, tr("Executing `%s' for INCLUDECMD and caching as `%s'\n"), cmd, fname); } @@ -1201,7 +1201,7 @@ static int CheckSafetyAux(struct stat *statbuf) if (!geteuid()) { /* Reject files not owned by root or group/world writable */ if (statbuf->st_uid != 0) { - fprintf(ErrFp, "SECURITY: Won't read non-root-owned file or directory when running as root!\n"); + fprintf(ErrFp, tr("SECURITY: Won't read non-root-owned file or directory when running as root!\n")); return 0; } } @@ -1211,7 +1211,7 @@ static int CheckSafetyAux(struct stat *statbuf) return 1; } if ((statbuf->st_mode & S_IWOTH)) { - fprintf(ErrFp, "SECURITY: Won't read world-writable file or directory!\n"); + fprintf(ErrFp, tr("SECURITY: Won't read world-writable file or directory!\n")); return 0; } diff --git a/src/funcs.c b/src/funcs.c index 5fa64562..bc405899 100644 --- a/src/funcs.c +++ b/src/funcs.c @@ -3021,7 +3021,7 @@ static int FPsshade(func_info *info) if (!psshade_warned) { psshade_warned = 1; - Wprint("psshade() is deprecated; use SPECIAL SHADE instead."); + Wprint(tr("psshade() is deprecated; use SPECIAL SHADE instead.")); } sprintf(s, "/_A LineWidth 2 div def "); @@ -3076,7 +3076,7 @@ static int FPsmoon(func_info *info) } if (!psmoon_warned) { psmoon_warned = 1; - Wprint("psmoon() is deprecated; use SPECIAL MOON instead."); + Wprint(tr("psmoon() is deprecated; use SPECIAL MOON instead.")); } if (size > 0) { sprintf(sizebuf, "%d", size); @@ -3622,7 +3622,7 @@ FEvalTrig(func_info *info) } else { /* Hokey... */ if (trig.scanfrom != DSEToday) { - Wprint("Warning: SCANFROM is ignored in two-argument form of evaltrig()"); + Wprint(tr("Warning: SCANFROM is ignored in two-argument form of evaltrig()")); } dse = ComputeTrigger(scanfrom, &trig, &tim, &r, 0); } @@ -3677,7 +3677,7 @@ FMultiTrig(func_info *info) return E_PARSE_ERR; } if (tim.ttime != NO_TIME) { - Eprint("Cannot use AT clause in multitrig() function"); + Eprint(tr("Cannot use AT clause in multitrig() function")); return E_PARSE_ERR; } dse = ComputeTrigger(trig.scanfrom, &trig, &tim, &r, 0); diff --git a/src/hbcal.c b/src/hbcal.c index 63ddb8b7..8c2f7b76 100644 --- a/src/hbcal.c +++ b/src/hbcal.c @@ -324,7 +324,7 @@ int GetValidHebDate(int yin, int min, int din, int adarbehave, case ADAR2ADARB: *mout = min = ADARB; break; default: - Eprint("GetValidHebDate: Bad adarbehave value %d", adarbehave); + Eprint(tr("GetValidHebDate: Bad adarbehave value %d"), adarbehave); return E_SWERR; } } @@ -464,7 +464,7 @@ int ComputeJahr(int y, int m, int d, int *ans) /* Check for Adar A */ if (m == ADARA && monlen[m] == 0) { - Eprint("No Adar A in %d", y); + Eprint(tr("No Adar A in %d"), y); return E_BAD_HEBDATE; } diff --git a/src/main.c b/src/main.c index 7987763d..744f7355 100644 --- a/src/main.c +++ b/src/main.c @@ -373,7 +373,7 @@ static void DoReminders(void) default: if (!SuppressImplicitRemWarnings) { - Wprint("Unrecognized command; interpreting as REM"); + Wprint(tr("Unrecognized command; interpreting as REM")); WarnedAboutImplicit = 1; } DestroyParser(&p); @@ -2034,7 +2034,7 @@ static int GetOnceDateFromFile(void) /* Save today to file */ fp = fopen(OnceFile, "w"); if (!fp) { - Wprint("Warning: Unable to save ONCE timestamp to %s: %s", + Wprint(tr("Warning: Unable to save ONCE timestamp to %s: %s"), OnceFile, strerror(errno)); return once_date; } diff --git a/src/omit.c b/src/omit.c index 295d4aa3..1f5915f4 100644 --- a/src/omit.c +++ b/src/omit.c @@ -92,7 +92,7 @@ int DestroyOmitContexts(int print_unmatched) while (c) { if (print_unmatched) { - Wprint("Unmatched PUSH-OMIT-CONTEXT at %s(%d)", + Wprint(tr("Unmatched PUSH-OMIT-CONTEXT at %s(%d)"), c->filename, c->lineno); } num++; @@ -186,7 +186,7 @@ int PopOmitContext(ParsePtr p) SavedOmitContexts = c->next; if (c->filename && FileName && strcmp(c->filename, FileName)) { - Wprint("POP-OMIT-CONTEXT at %s:%d matches PUSH-OMIT-CONTEXT in different file: %s:%d", FileName, LineNo, c->filename, c->lineno); + Wprint(tr("POP-OMIT-CONTEXT at %s:%d matches PUSH-OMIT-CONTEXT in different file: %s:%d"), FileName, LineNo, c->filename, c->lineno); } /* Free memory used by the saved context */ if (c->partsave) free(c->partsave); @@ -395,7 +395,7 @@ int DoOmit(ParsePtr p) default: if (tok.type == T_Until) { - Eprint("OMIT: UNTIL not allowed; did you mean THROUGH?"); + Eprint(tr("OMIT: UNTIL not allowed; did you mean THROUGH?")); } else if (tok.type == T_Illegal && tok.val < 0) { Eprint("%s: `%s'", GetErr(-tok.val), DBufValue(&buf)); } else { @@ -465,7 +465,7 @@ int DoOmit(ParsePtr p) InsertIntoSortedArray(PartialOmitArray, NumPartialOmits, syndrome); NumPartialOmits++; if (NumPartialOmits == 366) { - Wprint("You have OMITted everything! The space-time continuum is at risk."); + Wprint(tr("You have OMITted everything! The space-time continuum is at risk.")); } } if (mc == m[1] && dc == d[1]) { @@ -487,7 +487,7 @@ int DoOmit(ParsePtr p) start = DSE(y[0], m[0], d[0]); end = DSE(y[1], m[1], d[1]); if (end < start) { - Eprint("Error: THROUGH date earlier than start date"); + Eprint(tr("Error: THROUGH date earlier than start date")); return E_BAD_DATE; } diff --git a/src/queue.c b/src/queue.c index e374c84c..1c10bc7c 100644 --- a/src/queue.c +++ b/src/queue.c @@ -346,7 +346,7 @@ void HandleQueuedReminders(void) /* If we're a daemon, get the mod time of initial file */ if (Daemon > 0) { if (stat(InitialFile, &StatBuf)) { - fprintf(ErrFp, "Cannot stat %s - not running as daemon!\n", + fprintf(ErrFp, tr("Cannot stat %s - not running as daemon!\n"), InitialFile); Daemon = 0; } else FileModTime = StatBuf.st_mtime; diff --git a/src/userfns.c b/src/userfns.c index 65308c7a..c547acc6 100644 --- a/src/userfns.c +++ b/src/userfns.c @@ -208,7 +208,7 @@ int DoFset(ParsePtr p) return OK; } /* Warn about redefinition */ - Wprint("Function %s redefined (previously defined at %s:%d)", + Wprint(tr("Function %s redefined (previously defined at %s:%d)"), existing->name, existing->filename, existing->lineno); } @@ -352,7 +352,7 @@ int DoFset(ParsePtr p) /* Add the function definition */ FSet(func); if (orig_namelen > VAR_NAME_LEN) { - Wprint("Warning: Function name `%s...' truncated to `%s'", + Wprint(tr("Warning: Function name `%s...' truncated to `%s'"), func->name, func->name); } return OK; diff --git a/src/utils.c b/src/utils.c index a2356074..caf10ffd 100644 --- a/src/utils.c +++ b/src/utils.c @@ -244,17 +244,17 @@ static void print_callstack_aux(FILE *fp, cs *entry) { int i = 0; - char const *in = "In"; + char const *in = tr("In"); cs *prev = NULL; while(entry) { if (prev) { - in = "Called from"; + in = tr("Called from"); } if (!prev || strcmp(prev->func, entry->func) || strcmp(prev->filename, entry->filename) || prev->lineno != entry->lineno) { if (prev) { fprintf(fp, "\n"); } - (void) fprintf(fp, " %s(%d): [#%d] %s function `%s'", entry->filename, entry->lineno, i, in, entry->func); + (void) fprintf(fp, tr(" %s(%d): [#%d] %s function `%s'"), entry->filename, entry->lineno, i, in, entry->func); } prev = entry; entry = entry->next; @@ -264,7 +264,10 @@ print_callstack_aux(FILE *fp, cs *entry) } } if (entry) { - (void) fprintf(fp, "\n [remaining call frames omitted]"); + (void) fprintf(fp, "\n ["); + (void) fprintf(fp, tr("remaining call frames omitted")); + (void) fprintf(fp, "]"); + } } diff --git a/src/var.c b/src/var.c index 4e8c8d16..17bb77b4 100644 --- a/src/var.c +++ b/src/var.c @@ -85,7 +85,7 @@ strtod_in_c_locale(char const *str, char **endptr) if (**endptr) { x = strtod(str, endptr); if (!**endptr) { - Wprint("Accepting \"%s\" for $Latitude/$Longitude, but you should use the \"C\" locale decimal separator \".\" instead", str); + Wprint(tr("Accepting \"%s\" for $Latitude/$Longitude, but you should use the \"C\" locale decimal separator \".\" instead"), str); } } return x; @@ -94,7 +94,7 @@ strtod_in_c_locale(char const *str, char **endptr) static void deprecated_var(char const *var, char const *instead) { if (DebugFlag & DB_PRTLINE) { - Wprint("%s is deprecated; use %s instead", var, instead); + Wprint(tr("%s is deprecated; use %s instead"), var, instead); } } @@ -201,7 +201,7 @@ static int oncefile_func(int do_set, Value *val) } if (ProcessedOnce) { - Wprint("Not setting $OnceFile: Already processed a reminder with a ONCE clause"); + Wprint(tr("Not setting $OnceFile: Already processed a reminder with a ONCE clause")); return OK; } if (OnceFile) { @@ -608,7 +608,7 @@ int DoSet (Parser *p) } if (p->isnested) { - Eprint("%s", "Do not use [] around expression in SET command"); + Eprint("%s", tr("Do not use [] around expression in SET command")); return E_CANTNEST_FDEF; } @@ -628,7 +628,7 @@ int DoSet (Parser *p) if (*DBufValue(&buf) == '$') r = SetSysVar(DBufValue(&buf)+1, &v); else r = SetVar(DBufValue(&buf), &v); if (buf.len > VAR_NAME_LEN) { - Wprint("Warning: Variable name `%.*s...' truncated to `%.*s'", + Wprint(tr("Warning: Variable name `%.*s...' truncated to `%.*s'"), VAR_NAME_LEN, DBufValue(&buf), VAR_NAME_LEN, DBufValue(&buf)); } DBufFree(&buf); @@ -1078,7 +1078,7 @@ int GetSysVar(char const *name, Value *val) /* In "verbose" mode, print attempts to test $RunOff */ if (DebugFlag & DB_PRTLINE) { if (v->value == (void *) &RunDisabled) { - Wprint("(Security note: $RunOff variable tested.)"); + Wprint(tr("(Security note: $RunOff variable tested.)")); } } return OK;