public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/104709] New: A translated error message will include untanslated parts
@ 2022-02-27 10:51 goeran at uddeborg dot se
  2022-02-28  9:21 ` [Bug c++/104709] " redi at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: goeran at uddeborg dot se @ 2022-02-27 10:51 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104709

            Bug ID: 104709
           Summary: A translated error message will include untanslated
                    parts
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: goeran at uddeborg dot se
  Target Milestone: ---

In the function open_module_client in gcc/cp/mapper-client.cc there an error
message

    failed %s mapper %qs line %u

and a similar without a line. This message is properly marked for translation.
The first %s in this message however will be a string which will be
untranslated, resulting in a mixed language message.

At the very least, the strings assigned (in various places) to "errmsg" need to
be marked for translation. Composing a message in this way is however a bad
idea in general, and might be hard to translate properly for some locales. If
possible it would be better to have more complete messages, not inserting parts
of it through a %s substitution. 

(See
https://www.gnu.org/software/gettext/manual/html_node/Preparing-Strings.html#Decent-English-style
for a longer discussion.)

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/104709] A translated error message will include untanslated parts
  2022-02-27 10:51 [Bug c++/104709] New: A translated error message will include untanslated parts goeran at uddeborg dot se
@ 2022-02-28  9:21 ` redi at gcc dot gnu.org
  2022-03-04 10:10 ` redi at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: redi at gcc dot gnu.org @ 2022-02-28  9:21 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104709

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2022-02-28

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/104709] A translated error message will include untanslated parts
  2022-02-27 10:51 [Bug c++/104709] New: A translated error message will include untanslated parts goeran at uddeborg dot se
  2022-02-28  9:21 ` [Bug c++/104709] " redi at gcc dot gnu.org
@ 2022-03-04 10:10 ` redi at gcc dot gnu.org
  2022-03-04 10:37 ` jakub at gcc dot gnu.org
  2022-03-11 10:47 ` redi at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: redi at gcc dot gnu.org @ 2022-03-04 10:10 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104709

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
A small improvement would be:

--- a/gcc/cp/mapper-client.cc
+++ b/gcc/cp/mapper-client.cc
@@ -304,8 +304,13 @@ module_client::open_module_client (location_t loc, const
char *o,
 #endif

   if (errmsg)
-    error_at (loc, line ? G_("failed %s mapper %qs line %u")
-             : G_("failed %s mapper %qs"), errmsg, name.c_str (), line);
+    {
+      if (line)
+       error_at (loc, G_("error in mapper %qs at line %u: %s"), name.c_str (),
+                 line, errmsg);
+      else
+       error_at (loc, G_("error in mapper %qs: %s"), name.c_str (), errmsg);
+    }

   // now wave hello!
   c->Cork ();



That way at least the untranslated part is always at the end, rather than
embedded in the middle of a translated string.

It's not really clear whether the current errors are ideal even for English
output, e.g. Cody::OpenInet6 might set errmsg to "socket" which would yield
something like:

failed socket mapper 'name' at line N

I think this means it failed to *open* a socket for the mapper, but that's not
how it reads.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/104709] A translated error message will include untanslated parts
  2022-02-27 10:51 [Bug c++/104709] New: A translated error message will include untanslated parts goeran at uddeborg dot se
  2022-02-28  9:21 ` [Bug c++/104709] " redi at gcc dot gnu.org
  2022-03-04 10:10 ` redi at gcc dot gnu.org
@ 2022-03-04 10:37 ` jakub at gcc dot gnu.org
  2022-03-11 10:47 ` redi at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-03-04 10:37 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104709

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
A better way would be not to pass around errmsg but instead an enum what exact
error it is and then just handle all of those in a switch.
Like e.g. required_token in cp/parser.cc (cp_parser_required_error) etc.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/104709] A translated error message will include untanslated parts
  2022-02-27 10:51 [Bug c++/104709] New: A translated error message will include untanslated parts goeran at uddeborg dot se
                   ` (2 preceding siblings ...)
  2022-03-04 10:37 ` jakub at gcc dot gnu.org
@ 2022-03-11 10:47 ` redi at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: redi at gcc dot gnu.org @ 2022-03-11 10:47 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104709

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |roland.illig at gmx dot de

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
*** Bug 104876 has been marked as a duplicate of this bug. ***

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-03-11 10:47 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-27 10:51 [Bug c++/104709] New: A translated error message will include untanslated parts goeran at uddeborg dot se
2022-02-28  9:21 ` [Bug c++/104709] " redi at gcc dot gnu.org
2022-03-04 10:10 ` redi at gcc dot gnu.org
2022-03-04 10:37 ` jakub at gcc dot gnu.org
2022-03-11 10:47 ` redi at gcc dot gnu.org

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).