Bug 80191 - diagnostic placeholder "new initializer" must be marked for translation
Summary: diagnostic placeholder "new initializer" must be marked for translation
Status: RESOLVED INVALID
Alias: None
Product: gcc
Classification: Unclassified
Component: translation (show other bugs)
Version: 7.0
: P3 minor
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: diagnostic
Depends on:
Blocks:
 
Reported: 2017-03-26 00:13 UTC by Roland Illig
Modified: 2018-12-19 17:19 UTC (History)
4 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2018-08-21 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Roland Illig 2017-03-26 00:13:35 UTC
from cp/typeck.c:

    permerror (input_location,
	       "%s expression list treated as compound expression",
	       msg);

The placeholder "msg" gets the value "new initializer" in init.c, but that string literal is not enclosed in _(...), therefore it won't be translated.

That call seems to be the only place where build_x_compound_expr_from_vec is actually called, so having a placeholder might be unnecessary overhead.
Comment 1 Jonathan Wakely 2017-03-26 12:31:36 UTC
"new-initializer" is a grammar term in the C++ standard, so maybe it shouldn't be translated.
Comment 2 Roland Illig 2017-03-26 13:27:51 UTC
But then shouldn't it be spelled "new-initializer", not "new initializer"?
Comment 3 Martin Sebor 2017-03-26 21:44:56 UTC
I wonder if it would be worthwhile to add format specifier to the pretty printer for terms of the grammar (say %T or something).  That would make it possible to a) clearly distinguish them from plain English text that must be translated and perhaps also help diagnose unquoted %s arguments via -Wformat, and b) format them in a distinct font (such as italics or terminals that support it, as for instance Gnome terminal does).
Comment 4 Jonathan Wakely 2017-03-27 09:53:35 UTC
Martin, that might be nice for IDEs too, which can presumably aren't restricted to using a single font like most terminals.


(In reply to Roland Illig from comment #2)
> But then shouldn't it be spelled "new-initializer", not "new initializer"?

It's still clearly related to the same thing, even without the hyphen.

At the very least, "new" shouldn't be translated, because it refers to the C++ keyword, which is always spelled "new" and not "neu" or "nouveau" or anything else. It's an initializer for a new-expression, not an initializer that is newer than some other initializer.
Comment 5 Manuel López-Ibáñez 2017-03-27 20:49:27 UTC
(In reply to Jonathan Wakely from comment #4)
> At the very least, "new" shouldn't be translated, because it refers to the
> C++ keyword, which is always spelled "new" and not "neu" or "nouveau" or
> anything else. It's an initializer for a new-expression, not an initializer
> that is newer than some other initializer.

Then, it should be "%<new%> initializer". Keywords should always be quoted: https://gcc.gnu.org/wiki/DiagnosticsGuidelines#Quoting
Comment 6 Jonathan Wakely 2017-03-27 20:58:10 UTC
No, not if I'm right that it's referring to new-initializer. The C++ standard defines a new-expression and a new-initializer, and those are related to the 'new' keyword, but they are not keywords.
Comment 7 Eric Gallager 2017-08-21 16:48:18 UTC
Changing component to translation, but leaving UNCONFIRMED since there seems to be disagreement
Comment 8 Eric Gallager 2018-08-21 02:46:41 UTC
(In reply to Eric Gallager from comment #7)
> Changing component to translation, but leaving UNCONFIRMED since there seems
> to be disagreement

Putting in WAITING in the hopes that someone else will decide one way or another whether this bug is valid or not.
Comment 9 Eric Gallager 2018-12-19 04:15:01 UTC
(In reply to Eric Gallager from comment #8)
> (In reply to Eric Gallager from comment #7)
> > Changing component to translation, but leaving UNCONFIRMED since there seems
> > to be disagreement
> 
> Putting in WAITING in the hopes that someone else will decide one way or
> another whether this bug is valid or not.

No reply; closing per Jonathan in comment #6
Comment 10 Martin Sebor 2018-12-19 17:19:53 UTC
I think quoting/translating grammar terms is a general problem in the C++ front-end (perhaps to a lesser extent also in the rest of GCC as well).  The inconsistencies it leads to can be seen in the translated messages.  For instance, de.po has these two messages:

#: cp/init.c:2906
#, gcc-internal-format
msgid "array size in new-expression must be constant"
msgstr "Arraygröße in »new«-Ausdruck muss konstant sein"

and

#: cp/parser.c:8454
#, gcc-internal-format
msgid "initialization of new-expression for type %<auto%> requires exactly one element"
msgstr "Initialisierung des new-Ausdrucks für Typ %<auto%> erfordert genau ein Element"

In the first one, 'new' is quoted as if it was a keyword, but in the second one it isn't (as it shouldn't be).

Another example is one of inconsistent translation (it's not the fault of the translator -- the msgid mixes plain English text with a grammar term/expression syntax without making it clear what ends where):

#: cp/parser.c:37546
#, gcc-internal-format
msgid "expected id-expression (arguments)"
msgstr "»id-expression (arguments)« erwartet"

#: cp/parser.c:5790
#, gcc-internal-format
msgid "expected id-expression"
msgstr "ID-Ausdruck erwartet"

I don't know what the text of the C++ standard reads like in German to say what the right way to  solve this is.  Does the German text refer to 'new'-Ausdruck in the grammar, or does it use '/new-expression/' like the English edition, or something else?

Roland?

(GCC is also inconsistent in the hyphenation of grammar terms like "constant-expression" and so is the translation.)