]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/ABOUT-GCC-NLS
Remove m_nloops field from loop_versioning
[thirdparty/gcc.git] / gcc / ABOUT-GCC-NLS
CommitLineData
d70283ce
JL
1Notes on GCC's Native Language Support
2
d70283ce
JL
3By and large, only diagnostic messages have been internationalized.
4Some work remains in other areas; for example, GCC does not yet allow
5non-ASCII letters in identifiers.
6
842eb2a3 7Not all of GCC's diagnostic messages have been internationalized. Programs
bfb53001
ZW
8like `genattr' (in fact all gen* programs) are not internationalized, as
9their users are GCC maintainers who typically need to be able to read
10English anyway; internationalizing them would thus entail needless work for
11the human translators. Messages used for debugging, such as used in dumped
12tables, should also not be translated.
d70283ce
JL
13
14The GCC library should not contain any messages that need
842eb2a3
PT
15internationalization, because it operates below the internationalization
16library.
d70283ce 17
d70283ce
JL
18Unlike some other GNU programs, the GCC sources contain few instances
19of explicit translation calls like _("string"). Instead, the
20diagnostic printing routines automatically translate their arguments.
21For example, GCC source code should not contain calls like `error
22(_("unterminated comment"))'; it should contain calls like `error
23("unterminated comment")' instead, as it is the `error' function's
24responsibility to translate the message before the user sees it.
25
00e7c49f
JM
26In general, use no markup for strings that are the immediate format string
27argument of a diagnostic function. Use G_("str") for strings that will be
28used as the format string for a diagnostic but are e.g. assigned to a
29variable first. Use N_("str") for strings that are not diagnostic format
30strings, but will still be translated later. Use _("str") for strings that
31will not be translated elsewhere. It's important not to use _("str") in
32the initializer of a statically allocated variable; use one of the others
33instead and make sure that uses of that variable translate the string,
34whether directly with _(msg) or by passing it to a diagnostic or other
35function that performs the translation.
36
37Avoid using %s to compose a diagnostic message from multiple translatable
38strings; instead, write out the full diagnostic message for each variant.
39Only use %s for message components that do not need translation, such as
40keywords.
41
d70283ce
JL
42By convention, any function parameter in the GCC sources whose name
43ends in `msgid' is expected to be a message requiring translation.
4b794eaf
JJ
44If the parameter name ends with `gmsgid', it is assumed to be a GCC
45diagnostics format string requiring translation, if it ends with
46`cmsgid', it is assumed to be a format string for `printf' family
47of functions, requiring a translation.
48For example, the `error' function's first parameter is named `gmsgid'.
d70283ce
JL
49GCC's exgettext script uses this convention to determine which
50function parameter strings need to be translated. The exgettext
51script also assumes that any occurrence of `%eMSGID}' on a source
52line, where MSGID does not contain `%' or `}', corresponds to a
53message MSGID that requires translation; this is needed to identify
54diagnostics in GCC spec strings.
4b794eaf
JJ
55The `G_(GMSGID)' macro defined in intl.h can be used to mark GCC diagnostics
56format strings as requiring translation, but other than that it is a
57no-op at runtime.
d70283ce 58
4b794eaf 59If you modify source files, you'll need at least version 0.14.15 of the
a71d3613
PT
60GNU gettext package to propagate the modifications to the translation
61tables.
842eb2a3 62
a71d3613
PT
63After having built and installed these gettext tools, you have to
64configure GCC with --enable-maintainer-mode to get the master catalog
65rebuilt.
ad41bd84
JM
66
67\f
a945c346 68Copyright (C) 1998-2024 Free Software Foundation, Inc.
ad41bd84
JM
69
70Copying and distribution of this file, with or without modification,
71are permitted in any medium without royalty provided the copyright
72notice and this notice are preserved.