Hi Paul,
Reviewing parse-datetime.y, I see that
* 6 invocations of dbg_fputs don't use _(), while the others do.
* The invocations of _() inside dbg_printf and dbg_fputs is
useless, because at this point in the code the argument is
not a string literal, thus 'xgettext' will not extract it
when it creates gnulib-l10n.pot. Use of _() with non-literals
makes only sense in combination with the N_() macro (a.k.a.
gettext_noop).
Any objections to fixing it like in the attached proposed patch?
Bruno
>From d57bba3fa79fe62a96834eff4920029ca821d09f Mon Sep 17 00:00:00 2001
From: Bruno Haible <[email protected]>
Date: Mon, 6 Jan 2025 00:04:56 +0100
Subject: [PATCH] parse-datetime: Internationalize 6 more strings.
* lib/parse-datetime.y (dbg_printf, dbg_fputs): Don't invoke _().
(parse_datetime_body): Internationalize 6 dbg_fputs invocations.
---
ChangeLog | 6 ++++++
lib/parse-datetime.y | 17 +++++++++--------
2 files changed, 15 insertions(+), 8 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 5e03fccad1..231c3df9be 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2025-01-05 Bruno Haible <[email protected]>
+
+ parse-datetime: Internationalize 6 more strings.
+ * lib/parse-datetime.y (dbg_printf, dbg_fputs): Don't invoke _().
+ (parse_datetime_body): Internationalize 6 dbg_fputs invocations.
+
2025-01-05 Paul Eggert <[email protected]>
parse-datetime: pacify gcc 14 -Wformat-security
diff --git a/lib/parse-datetime.y b/lib/parse-datetime.y
index ec4037ceeb..9ffd0993a6 100644
--- a/lib/parse-datetime.y
+++ b/lib/parse-datetime.y
@@ -123,7 +123,7 @@ dbg_printf (char const *msgid, ...)
dbg_herald ();
va_list args;
va_start (args, msgid);
- vfprintf (stderr, _(msgid), args);
+ vfprintf (stderr, msgid, args);
va_end (args);
}
@@ -131,7 +131,7 @@ static void
dbg_fputs (char const *msgid)
{
dbg_herald ();
- fputs (_(msgid), stderr);
+ fputs (msgid, stderr);
}
@@ -1965,15 +1965,15 @@ parse_datetime_body (struct timespec *result, char const *p,
if (debugging (&pc))
{
if (pc.times_seen > 1)
- dbg_fputs ("error: seen multiple time parts\n");
+ dbg_fputs (_("error: seen multiple time parts\n"));
if (pc.dates_seen > 1)
- dbg_fputs ("error: seen multiple date parts\n");
+ dbg_fputs (_("error: seen multiple date parts\n"));
if (pc.days_seen > 1)
- dbg_fputs ("error: seen multiple days parts\n");
+ dbg_fputs (_("error: seen multiple days parts\n"));
if (pc.dsts_seen > 1)
- dbg_fputs ("error: seen multiple daylight-saving parts\n");
+ dbg_fputs (_("error: seen multiple daylight-saving parts\n"));
if ((pc.J_zones_seen + pc.local_zones_seen + pc.zones_seen) > 1)
- dbg_fputs ("error: seen multiple time-zone parts\n");
+ dbg_fputs (_("error: seen multiple time-zone parts\n"));
}
goto fail;
}
@@ -2011,7 +2011,8 @@ parse_datetime_body (struct timespec *result, char const *p,
tm.tm_hour = tm.tm_min = tm.tm_sec = 0;
pc.seconds.tv_nsec = 0;
if (debugging (&pc))
- dbg_fputs ("warning: using midnight as starting time: 00:00:00\n");
+ dbg_printf (_("warning: using midnight as starting time: %s\n"),
+ "00:00:00");
}
/* Let mktime deduce tm_isdst if we have an absolute timestamp. */
--
2.43.0