GNU bug report logs -
#18054
Problematic translation strings in coreutils 8.22
Previous Next
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Your message dated Sat, 19 Jul 2014 07:57:56 -0700
with message-id <53CA8774.2080705 <at> cs.ucla.edu>
and subject line Re: bug#18054: Problematic translation strings in coreutils 8.22
has caused the debbugs.gnu.org bug report #18054,
regarding Problematic translation strings in coreutils 8.22
to be marked as done.
(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)
--
18054: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=18054
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
Hi!
When reviewing the Swedish translation of coreutils I noticed the pecular string
"failed to %s supplemental groups" which (because the contents of %s were
unclear) prompted me to look at the source of coreutils. The %s used in this string
is expanded to either "set" or "clear" but neither of those strings are enclosed by
the _() translation macro.
Once saw this I looked for further instances where the translation macro was
used in a strange way and I found the instance in gl/lib/randread.c. In the
.pot-file only "%s: end of file" is present and "%s: read error" is left untranslated.
The reason for this is that the translation macro _() in this instance contains
a ternary expression and only the first string will be parsed and offered for
translation. To fix this I propose to first evaluate the expression and only
then apply the translation macro.
Below I provide you with a proposed patch (applying on top of git HEAD).
Applying this patch makes the strings "set" and "clear" appear in the .pot-file
and "%s: read error" be mentioned for lib/randread.c too. I hope the patch
will help you in sorting out this minor issue. Thanks for an excellent set of utilities!
/ Sebastian
From 1333c446baefe31ebe25a1c18cd8f64a0c122516 Mon Sep 17 00:00:00 2001
From: Sebastian Rasmussen <sebras <at> hotmail.com>
Date: Wed, 16 Jul 2014 20:58:12 +0200
Subject: [PATCH] maint: fix two translation message issues
* gl/lib/randread.c (randread_error): xgettext can not handle translation
strings containing C-expressions, so use the translation macro _() only
for the real strings after the ternary expression has been evaluated.
* src/chroot.c (main): Two condtional error strings were untranslated.
---
gl/lib/randread.c | 2 +-
src/chroot.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/gl/lib/randread.c b/gl/lib/randread.c
index a073cab..af85653 100644
--- a/gl/lib/randread.c
+++ b/gl/lib/randread.c
@@ -125,7 +125,7 @@ randread_error (void const *file_name)
{
if (file_name)
error (exit_failure, errno,
- _(errno == 0 ? "%s: end of file" : "%s: read error"),
+ errno == 0 ? _("%s: end of file") : _("%s: read error"),
quotearg_colon (file_name));
abort ();
}
diff --git a/src/chroot.c b/src/chroot.c
index fff0b53..963f66b 100644
--- a/src/chroot.c
+++ b/src/chroot.c
@@ -393,7 +393,7 @@ main (int argc, char **argv)
if ((uid_set (uid) || groups) && setgroups (n_gids, gids) != 0)
error (EXIT_CANCELED, errno, _("failed to %s supplemental groups"),
- gids ? "set" : "clear");
+ gids ? _("set") : _("clear"));
free (in_gids);
free (out_gids);
--
2.0.1
[Message part 3 (message/rfc822, inline)]
[Message part 4 (text/plain, inline)]
Thanks, I pushed the attached slightly-simpler patch.
[0001-maint-fix-message-translation-glitches.patch (text/plain, attachment)]
This bug report was last modified 10 years and 313 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.