GNU bug report logs - #69985
Untranslatable message in src/chown-core.h:95

Previous Next

Package: coreutils;

Reported by: Frédéric Marchal <fmarchal <at> perso.be>

Date: Sun, 24 Mar 2024 18:15:01 UTC

Severity: normal

Done: Pádraig Brady <P <at> draigBrady.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 69985 in the body.
You can then email your comments to 69985 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-coreutils <at> gnu.org:
bug#69985; Package coreutils. (Sun, 24 Mar 2024 18:15:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Frédéric Marchal <fmarchal <at> perso.be>:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Sun, 24 Mar 2024 18:15:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Frédéric Marchal <fmarchal <at> perso.be>
To: bug-coreutils <at> gnu.org
Subject: Untranslatable message in src/chown-core.h:95
Date: Sun, 24 Mar 2024 17:57:47 +0100
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.

Frederic








Reply sent to Pádraig Brady <P <at> draigBrady.com>:
You have taken responsibility. (Sun, 24 Mar 2024 20:22:01 GMT) Full text and rfc822 format available.

Notification sent to Frédéric Marchal <fmarchal <at> perso.be>:
bug acknowledged by developer. (Sun, 24 Mar 2024 20:22:02 GMT) Full text and rfc822 format available.

Message #10 received at 69985-done <at> debbugs.gnu.org (full text, mbox):

From: Pádraig Brady <P <at> draigBrady.com>
To: Frédéric Marchal <fmarchal <at> perso.be>,
 69985-done <at> debbugs.gnu.org, Wenbin Lv <wenbin816 <at> gmail.com>
Subject: Re: bug#69985: Untranslatable message in src/chown-core.h:95
Date: Sun, 24 Mar 2024 20:19:13 +0000
[Message part 1 (text/plain, inline)]
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
[coreutils-chown-translation-fix.patch (text/x-patch, attachment)]

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 22 Apr 2024 11:24:15 GMT) Full text and rfc822 format available.

This bug report was last modified 10 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.