1 Notes on GCC's Native Language Support
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.
7 Not all of GCC's diagnostic messages have been internationalized. Programs
8 like `enquire' and `genattr' (in fact all gen* programs) are not
9 internationalized, as their users are GCC maintainers who typically need to
10 be able to read English anyway; internationalizing them would thus entail
11 needless work for the human translators. Messages used for debugging, such
12 as used in dumped tables, should also not be translated.
14 The GCC library should not contain any messages that need
15 internationalization, because it operates below the internationalization
18 Currently, the only language translation supplied is en_UK (British English).
20 Unlike some other GNU programs, the GCC sources contain few instances
21 of explicit translation calls like _("string"). Instead, the
22 diagnostic printing routines automatically translate their arguments.
23 For example, GCC source code should not contain calls like `error
24 (_("unterminated comment"))'; it should contain calls like `error
25 ("unterminated comment")' instead, as it is the `error' function's
26 responsibility to translate the message before the user sees it.
28 By convention, any function parameter in the GCC sources whose name
29 ends in `msgid' is expected to be a message requiring translation.
30 For example, the `error' function's first parameter is named `msgid'.
31 GCC's exgettext script uses this convention to determine which
32 function parameter strings need to be translated. The exgettext
33 script also assumes that any occurrence of `%eMSGID}' on a source
34 line, where MSGID does not contain `%' or `}', corresponds to a
35 message MSGID that requires translation; this is needed to identify
36 diagnostics in GCC spec strings.
38 If you modify source files, you'll need to use a special
39 version of the GNU gettext package to propagate the modifications to the
42 Paul Eggerts original patches have been incorporated into the official
43 gettext CVS. These sources may be accessed via anonymous cvs. The root for
44 the gettext CVS is :pserver:anoncvs@anoncvs.cygnus.com:/cvs/gettext
45 Password is `anoncvs' like for the GCC CVS. After having retrieved the
46 sources, you have to apply the following patch, which is pending approval by
47 the gettext maintainer.
49 After having built and installed these gettext tools, you have to configure
50 GCC with --enable-maintainer-mode to get the master catalog rebuilt.
52 2000-06-01 Martin v. Löwis <loewis@informatik.hu-berlin.de>
54 * xgettext.c (long_options): New option defines.
55 * xget-lex.c (phase6_get): If set, process #defines as well.
57 --- doc/gettext.texi 2000/07/28 21:11:32 1.2
58 +++ doc/gettext.texi 2000/08/27 23:28:32
60 This file provides documentation for GNU @code{gettext} utilities.
61 It also serves as a reference for the free Translation Project.
63 -Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
64 +Copyright (C) 1995, 1996, 1997, 1998, 2000 Free Software Foundation, Inc.
66 Permission is granted to make and distribute verbatim copies of
67 this manual provided the copyright notice and this permission notice
68 @@ -54,7 +54,7 @@ by the Foundation.
71 @vskip 0pt plus 1filll
72 -Copyright @copyright{} 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
73 +Copyright @copyright{} 1995, 1996, 1997, 1998, 2000 Free Software Foundation, Inc.
75 Permission is granted to make and distribute verbatim copies of
76 this manual provided the copyright notice and this permission notice
77 @@ -1828,6 +1828,10 @@ not have to care about these details.
79 @itemx --default-domain=@var{name}
80 Use @file{@var{name}.po} for output (instead of @file{messages.po}).
83 +Look for the keywords in #define statements as well. Normally, xgettext
84 +will treat them as white space.
86 The special domain name @file{-} or @file{/dev/stdout} means to write
87 the output to @file{stdout}.
89 --- src/xget-lex.c 2000/07/28 21:11:32 1.2
90 +++ src/xget-lex.c 2000/08/27 23:28:33
91 @@ -1045,6 +1045,7 @@ phaseX_get (tp)
92 static token_ty phase6_pushback[4];
93 static int phase6_pushback_length;
99 @@ -1068,9 +1069,36 @@ phase6_get (tp)
100 if (tp->type != token_type_hash)
103 + /* Find the first non-whitespace token. If it is a define, we
104 + will treat the rest of the line as normal input, if defines
111 + if (tp->type == token_type_eoln || tp->type == token_type_eof)
113 + if (tp->type != token_type_white_space)
116 + if (tp->type == token_type_name
117 + && strcmp (tp->string, "define") == 0)
119 + /* It's not a define, so we start collecting tokens. */
123 + buf = xrealloc (buf, bufmax * sizeof (buf[0]));
131 /* Accumulate the rest of the directive in a buffer. Work out
138 --- src/xgettext.c 2000/07/28 21:11:32 1.2
139 +++ src/xgettext.c 2000/08/27 23:28:35
140 @@ -80,6 +80,9 @@ static char *comment_tag;
141 /* Name of default domain file. If not set defaults to messages.po. */
142 static char *default_domain;
144 +/* If preprocessor defines are also analyzed for keywords. */
147 /* If called with --debug option the output reflects whether format
148 string recognition is done automatically or forced by the user. */
150 @@ -125,6 +128,7 @@ static const struct option long_options[
151 { "debug", no_argument, &do_debug, 1 },
152 { "default-domain", required_argument, NULL, 'd' },
153 { "directory", required_argument, NULL, 'D' },
154 + { "defines", no_argument, &defines, 1 },
155 { "escape", no_argument, NULL, 'E' },
156 { "exclude-file", required_argument, NULL, 'x' },
157 { "extract-all", no_argument, &extract_all, 1 },
158 @@ -552,6 +556,7 @@ Mandatory arguments to long options are
159 -C, --c++ shorthand for --language=C++\n\
160 --debug more detailed formatstring recognision result\n\
161 -d, --default-domain=NAME use NAME.po for output (instead of messages.po)\n\
162 + --defines analyze preprocessor defines\n\
163 -D, --directory=DIRECTORY add DIRECTORY to list for input files search\n\
164 -e, --no-escape do not use C escapes in output (default)\n\
165 -E, --escape use C escapes in output, no extended chars\n\