]>
Commit | Line | Data |
---|---|---|
d70283ce JL |
1 | Notes on GCC's Native Language Support |
2 | ||
d70283ce JL |
3 | By and large, only diagnostic messages have been internationalized. |
4 | Some work remains in other areas; for example, GCC does not yet allow | |
5 | non-ASCII letters in identifiers. | |
6 | ||
842eb2a3 | 7 | Not all of GCC's diagnostic messages have been internationalized. Programs |
bfb53001 ZW |
8 | like `genattr' (in fact all gen* programs) are not internationalized, as |
9 | their users are GCC maintainers who typically need to be able to read | |
10 | English anyway; internationalizing them would thus entail needless work for | |
11 | the human translators. Messages used for debugging, such as used in dumped | |
12 | tables, should also not be translated. | |
d70283ce JL |
13 | |
14 | The GCC library should not contain any messages that need | |
842eb2a3 PT |
15 | internationalization, because it operates below the internationalization |
16 | library. | |
d70283ce | 17 | |
d70283ce JL |
18 | Unlike some other GNU programs, the GCC sources contain few instances |
19 | of explicit translation calls like _("string"). Instead, the | |
20 | diagnostic printing routines automatically translate their arguments. | |
21 | For 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 | |
24 | responsibility to translate the message before the user sees it. | |
25 | ||
26 | By convention, any function parameter in the GCC sources whose name | |
27 | ends in `msgid' is expected to be a message requiring translation. | |
4b794eaf JJ |
28 | If the parameter name ends with `gmsgid', it is assumed to be a GCC |
29 | diagnostics format string requiring translation, if it ends with | |
30 | `cmsgid', it is assumed to be a format string for `printf' family | |
31 | of functions, requiring a translation. | |
32 | For example, the `error' function's first parameter is named `gmsgid'. | |
d70283ce JL |
33 | GCC's exgettext script uses this convention to determine which |
34 | function parameter strings need to be translated. The exgettext | |
35 | script also assumes that any occurrence of `%eMSGID}' on a source | |
36 | line, where MSGID does not contain `%' or `}', corresponds to a | |
37 | message MSGID that requires translation; this is needed to identify | |
38 | diagnostics in GCC spec strings. | |
4b794eaf JJ |
39 | The `G_(GMSGID)' macro defined in intl.h can be used to mark GCC diagnostics |
40 | format strings as requiring translation, but other than that it is a | |
41 | no-op at runtime. | |
d70283ce | 42 | |
4b794eaf | 43 | If you modify source files, you'll need at least version 0.14.15 of the |
a71d3613 PT |
44 | GNU gettext package to propagate the modifications to the translation |
45 | tables. | |
842eb2a3 | 46 | |
a71d3613 PT |
47 | After having built and installed these gettext tools, you have to |
48 | configure GCC with --enable-maintainer-mode to get the master catalog | |
49 | rebuilt. | |
ad41bd84 JM |
50 | |
51 | \f | |
cbe34bb5 | 52 | Copyright (C) 1998-2017 Free Software Foundation, Inc. |
ad41bd84 JM |
53 | |
54 | Copying and distribution of this file, with or without modification, | |
55 | are permitted in any medium without royalty provided the copyright | |
56 | notice and this notice are preserved. |