aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2023-10-19 11:07:18 -0400
committerJason Merrill <jason@redhat.com>2023-10-19 12:34:35 -0400
commit00e7c49fa04a3766e4726322b427621a74b78c71 (patch)
treed3f19240df5cc52f5efba441ffad62685e50f550 /gcc
parent1ec36bcda366732d3d801c67e9f70e2868b7d0e2 (diff)
downloadgcc-00e7c49fa04a3766e4726322b427621a74b78c71.zip
gcc-00e7c49fa04a3766e4726322b427621a74b78c71.tar.gz
gcc-00e7c49fa04a3766e4726322b427621a74b78c71.tar.bz2
ABOUT-GCC-NLS: add usage guidance
gcc/ChangeLog: * ABOUT-GCC-NLS: Add usage guidance.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ABOUT-GCC-NLS16
1 files changed, 16 insertions, 0 deletions
diff --git a/gcc/ABOUT-GCC-NLS b/gcc/ABOUT-GCC-NLS
index e90a671..9424de4 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