mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-15 07:13:02 +00:00
Add i18n support to the GLR skeleton. Partially fix the C++
skeleton; a C++ expert needs to finish this. Remove debugging msgids; there's little point to having them translated, since they can be understood only by someone who can read the (English-language) source code. Generate runtime-po/bison-runtime.pot automatically, so that we don't have to worry about garbage getting in that file. We'll make sure after the next official release that old msgids don't get lost. See <http://lists.gnu.org/archive/html/bison-patches/2005-07/msg00119.html>. * runtime-po/Makefile.in.in, runtime-po/bison-runtime.pot: Remove. Now auto-generated. * PACKAGING: Don't claim that Gawk, GCC, Perl use this method yet. Fix typos in explanations of the runtime file. * bootstrap: Change gettext keyword from YYI18N to YY_. Use standard Makefile.in.in in runtime-po, since we'll arrange for backward-compatible bison-runtime.po files in a different way. * data/glr.c (YY_): New macro, from yacc.c. (yyuserAction, yyreportAmbiguity, yyreportSyntaxError, yyparse): Translate messages intended for users. (yyreportSyntaxError): Change "virtual memory" to "memory" to match the wording in the other skeletons. We don't know that the memory is virtual. * data/lalr1.cc (YY_): Renamed from _. All uses changed. Use same method that yacc.c uses. Don't translate debugging messages. (yy::yyreport_syntax_error): Put in a FIXME for the i18n stuff; it doesn't work (yet), and requires C++ expertise to fix. * data/yacc.c (YY_): Renamed from YY18N. All uses changed. Move defn to a more logical place, to be consistent with other skeletons. Don't translate debugging messages. Don't assume line numbers fit in unsigned int; use unsigned long fmts. * doc/bison.texinfo: Mention <libintl.h>. Change glibc cross reference to gettext cross reference. Add indexing terms. Mention YYENABLE_NLS. * runtime-po/POTFILES.in: Add data/glr.c, data/lalr1.cc.
This commit is contained in:
@@ -1203,7 +1203,9 @@ In some cases the Bison parser file includes system headers, and in
|
||||
those cases your code should respect the identifiers reserved by those
|
||||
headers. On some non-@acronym{GNU} hosts, @code{<alloca.h>},
|
||||
@code{<stddef.h>}, and @code{<stdlib.h>} are included as needed to
|
||||
declare memory allocators and related types. Other system headers may
|
||||
declare memory allocators and related types. @code{<libintl.h>} is
|
||||
included if message translation is in use
|
||||
(@pxref{Internationalization}). Other system headers may
|
||||
be included if you define @code{YYDEBUG} to a nonzero value
|
||||
(@pxref{Tracing, ,Tracing Your Parser}).
|
||||
|
||||
@@ -4821,8 +4823,8 @@ A Bison-generated parser can print diagnostics, including error and
|
||||
tracing messages. By default, they appear in English. However, Bison
|
||||
also supports outputting diagnostics in the user's native language.
|
||||
To make this work, the user should set the usual environment
|
||||
variables. @xref{Using gettextized software, , User influence on
|
||||
@code{gettext}, libc, The GNU C Library Reference Manual}. For
|
||||
variables. @xref{Users, , The User's View, gettext, GNU
|
||||
@code{gettext} utilities}. For
|
||||
example, the shell command @samp{export LC_ALL=fr_CA.UTF-8} might set
|
||||
the user's locale to French Canadian using the @acronym{UTF}-8
|
||||
encoding. The exact set of available locales depends on the user's
|
||||
@@ -4835,6 +4837,7 @@ steps. Here we assume a package that uses @acronym{GNU} Autoconf and
|
||||
|
||||
@enumerate
|
||||
@item
|
||||
@cindex bison-i18n.m4
|
||||
Into the directory containing the @acronym{GNU} Autoconf macros used
|
||||
by the package---often called @file{m4}---copy the
|
||||
@file{bison-i18n.m4} file installed by Bison under
|
||||
@@ -4846,11 +4849,16 @@ cp /usr/local/share/aclocal/bison-i18n.m4 m4/bison-i18n.m4
|
||||
@end example
|
||||
|
||||
@item
|
||||
@findex BISON_I18N
|
||||
@vindex BISON_LOCALEDIR
|
||||
@vindex YYENABLE_NLS
|
||||
In the top-level @file{configure.ac}, after the @code{AM_GNU_GETTEXT}
|
||||
invocation, add an invocation of @code{BISON_I18N}. This macro is
|
||||
defined in the file @file{bison-i18n.m4} that you copied earlier. It
|
||||
causes @samp{configure} to find the value of the
|
||||
@code{BISON_LOCALEDIR} variable.
|
||||
@code{BISON_LOCALEDIR} variable, and it defines the source-language
|
||||
symbol @code{YYENABLE_NLS} to enable translations in the
|
||||
Bison-generated parser.
|
||||
|
||||
@item
|
||||
In the @code{main} function of your program, designate the directory
|
||||
|
||||
Reference in New Issue
Block a user