public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Jason Merrill <jason@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r14-4757] ABOUT-GCC-NLS: add usage guidance
Date: Thu, 19 Oct 2023 16:36:15 +0000 (GMT)	[thread overview]
Message-ID: <20231019163616.414E73858C54@sourceware.org> (raw)

https://gcc.gnu.org/g:00e7c49fa04a3766e4726322b427621a74b78c71

commit r14-4757-g00e7c49fa04a3766e4726322b427621a74b78c71
Author: Jason Merrill <jason@redhat.com>
Date:   Thu Oct 19 11:07:18 2023 -0400

    ABOUT-GCC-NLS: add usage guidance
    
    gcc/ChangeLog:
    
            * ABOUT-GCC-NLS: Add usage guidance.

Diff:
---
 gcc/ABOUT-GCC-NLS | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/gcc/ABOUT-GCC-NLS b/gcc/ABOUT-GCC-NLS
index e90a67144e34..9424de42e150 100644
--- a/gcc/ABOUT-GCC-NLS
+++ b/gcc/ABOUT-GCC-NLS
@@ -23,6 +23,22 @@ For example, GCC source code should not contain calls like `error
 ("unterminated comment")' instead, as it is the `error' function's
 responsibility to translate the message before the user sees it.
 
+In general, use no markup for strings that are the immediate format string
+argument of a diagnostic function.  Use G_("str") for strings that will be
+used as the format string for a diagnostic but are e.g. assigned to a
+variable first.  Use N_("str") for strings that are not diagnostic format
+strings, but will still be translated later.  Use _("str") for strings that
+will not be translated elsewhere.  It's important not to use _("str") in
+the initializer of a statically allocated variable; use one of the others
+instead and make sure that uses of that variable translate the string,
+whether directly with _(msg) or by passing it to a diagnostic or other
+function that performs the translation.
+
+Avoid using %s to compose a diagnostic message from multiple translatable
+strings; instead, write out the full diagnostic message for each variant.
+Only use %s for message components that do not need translation, such as
+keywords.
+
 By convention, any function parameter in the GCC sources whose name
 ends in `msgid' is expected to be a message requiring translation.
 If the parameter name ends with `gmsgid', it is assumed to be a GCC

                 reply	other threads:[~2023-10-19 16:36 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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

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

  git send-email \
    --in-reply-to=20231019163616.414E73858C54@sourceware.org \
    --to=jason@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /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).