1 |
684 |
jeremybenn |
Notes on GCC's Native Language Support
|
2 |
|
|
|
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 |
|
|
|
7 |
|
|
Not all of GCC's diagnostic messages have been internationalized. Programs
|
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.
|
13 |
|
|
|
14 |
|
|
The GCC library should not contain any messages that need
|
15 |
|
|
internationalization, because it operates below the internationalization
|
16 |
|
|
library.
|
17 |
|
|
|
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.
|
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'.
|
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.
|
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.
|
42 |
|
|
|
43 |
|
|
If you modify source files, you'll need at least version 0.14.15 of the
|
44 |
|
|
GNU gettext package to propagate the modifications to the translation
|
45 |
|
|
tables.
|
46 |
|
|
|
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.
|
50 |
|
|
|
51 |
|
|
|
52 |
|
|
Copyright (C) 1998, 1999, 2000, 2001, 2002, 2005 Free Software Foundation, Inc.
|
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.
|