bug-coreutils@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
From: "Pádraig Brady" <P@draigBrady.com>
To: "Frédéric Marchal" <fmarchal@perso.be>,
	69985-done@debbugs.gnu.org, "Wenbin Lv" <wenbin816@gmail.com>
Subject: bug#69985: Untranslatable message in src/chown-core.h:95
Date: Sun, 24 Mar 2024 20:19:13 +0000	[thread overview]
Message-ID: <bf07871c-ea3a-c823-5d22-91c270f5cdbc@draigBrady.com> (raw)
In-Reply-To: <1882492.tdWV9SEqCh@marchal>

[-- Attachment #1: Type: text/plain, Size: 2422 bytes --]

On 24/03/2024 16:57, Frédéric Marchal wrote:
> Hi,
> 
> In src/chown-core.h:95 (coreutils-9.5-pre1), the following message is
> impossible to translate as it is created by concatenating string fragments:
> 
> static inline void
> emit_from_option_description (bool user)
> {
>    printf (_("\
>        --from=CURRENT_OWNER:CURRENT_GROUP\n\
>                           change the %sgroup of each file only if\n\
>                           its current owner and/or group match those
> specified\n\
>                           here.  Either may be omitted, in which case a
> match\n\
>                           is not required for the omitted attribute\n\
> "), user ? "owner and/or " : "");
> }
> 
> A translatable message must *never ever* be produced by concatenating
> substrings. Even if the substrings are themselves translated, there is no
> guaranties that the order of the words is the same in every language.
> 
> There is, unfortunately, no easy solution that save keystrokes. It must be
> written like this:
> 
> if (user)
>    printf (_("\
>        --from=CURRENT_OWNER:CURRENT_GROUP\n\
>                           change the owner and/or group of each file only if\n\
>                           its current owner and/or group match those
> specified\n\
>                           here.  Either may be omitted, in which case a
> match\n\
>                           is not required for the omitted attribute\n\
> "));
> else
>    printf (_("\
>        --from=CURRENT_OWNER:CURRENT_GROUP\n\
>                           change the group of each file only if\n\
>                           its current owner and/or group match those
> specified\n\
>                           here.  Either may be omitted, in which case a
> match\n\
>                           is not required for the omitted attribute\n\
> "));
> 
> That make sense as both are distinct messages with different purposes.
> 
> I also suspect that the two messages should be even more different than they
> currently are. The message, when user is false, suspiciously contains one more
> "owner and/or" that is not removed and it says "Either may be omitted" when
> only the group is mentioned at the beginning of the message.

The composed strings are accurate, but yes not translatable.
The attached simplifies the description a little,
so there is a single string to cater for both chown and chgrp.

Marking this as done.

thanks,
Pádraig

[-- Attachment #2: coreutils-chown-translation-fix.patch --]
[-- Type: text/x-patch, Size: 2315 bytes --]

From baea9881f79690552b0aa3ca6844bbf64fa6e55e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <P@draigBrady.com>
Date: Sun, 24 Mar 2024 20:12:53 +0000
Subject: [PATCH] doc: fix translation issue in chown/chgrp amalgamation

* src/chown-core.h (emit_from_option_description): The conditional
string composition here caused issues for translators.
Instead move to a more general description ...
(src/chown.c (usage): ... here.
Fixes https://bugs.gnu.org/69985
---
 src/chown-core.h | 12 ------------
 src/chown.c      |  8 +++++++-
 2 files changed, 7 insertions(+), 13 deletions(-)

diff --git a/src/chown-core.h b/src/chown-core.h
index e1396e3ea..4bd68fed4 100644
--- a/src/chown-core.h
+++ b/src/chown-core.h
@@ -89,16 +89,4 @@ chown_files (char **files, int bit_flags,
              struct Chown_option const *chopt)
   _GL_ATTRIBUTE_NONNULL ();
 
-static inline void
-emit_from_option_description (bool user)
-{
-  printf (_("\
-      --from=CURRENT_OWNER:CURRENT_GROUP\n\
-                         change the %sgroup of each file only if\n\
-                         its current owner and/or group match those specified\n\
-                         here.  Either may be omitted, in which case a match\n\
-                         is not required for the omitted attribute\n\
-"), user ? "owner and/or " : "");
-}
-
 #endif /* CHOWN_CORE_H */
diff --git a/src/chown.c b/src/chown.c
index 90ce84d67..3194dc75f 100644
--- a/src/chown.c
+++ b/src/chown.c
@@ -109,7 +109,13 @@ With --reference, change the group of each FILE to that of RFILE.\n\
                          (useful only on systems that can change the\n\
                          ownership of a symlink)\n\
 "), stdout);
-      emit_from_option_description (chown_mode == CHOWN_CHOWN);
+      fputs (_("\
+      --from=CURRENT_OWNER:CURRENT_GROUP\n\
+                         change the ownership of each file only if its\n\
+                         current owner and/or group match those specified here.\n\
+                         Either may be omitted, in which case a match\n\
+                         is not required for the omitted attribute\n\
+"), stdout);
       fputs (_("\
       --no-preserve-root  do not treat '/' specially (the default)\n\
       --preserve-root    fail to operate recursively on '/'\n\
-- 
2.44.0


      reply	other threads:[~2024-03-24 20:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-24 16:57 bug#69985: Untranslatable message in src/chown-core.h:95 Frédéric Marchal
2024-03-24 20:19 ` Pádraig Brady [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://lists.gnu.org/mailman/listinfo/bug-coreutils

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bf07871c-ea3a-c823-5d22-91c270f5cdbc@draigBrady.com \
    --to=p@draigbrady.com \
    --cc=69985-done@debbugs.gnu.org \
    --cc=fmarchal@perso.be \
    --cc=wenbin816@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).