Next: Token Internationalization, Up: Parser Internationalization [Contents][Index]
The maintainer of a package that uses a Bison-generated parser enables the internationalization of the parser’s output through the following steps. Here we assume a package that uses GNU Autoconf and GNU Automake.
cp /usr/local/share/aclocal/bison-i18n.m4 m4/bison-i18n.m4
AM_GNU_GETTEXT
invocation, add an invocation of BISON_I18N
. This macro is
defined in the file bison-i18n.m4 that you copied earlier. It
causes configure
to find the value of the
BISON_LOCALEDIR
variable, and it defines the source-language
symbol YYENABLE_NLS
to enable translations in the
Bison-generated parser.
main
function of your program, designate the directory
containing Bison’s runtime message catalog, through a call to
‘bindtextdomain’ with domain name ‘bison-runtime’.
For example:
bindtextdomain ("bison-runtime", BISON_LOCALEDIR);
Typically this appears after any other call bindtextdomain
(PACKAGE, LOCALEDIR)
that your package already has. Here we rely on
‘BISON_LOCALEDIR’ to be defined as a string through the
Makefile.
main
function, make ‘BISON_LOCALEDIR’ available as a C preprocessor macro,
either in ‘DEFS’ or in ‘AM_CPPFLAGS’. For example:
DEFS = @DEFS@ -DBISON_LOCALEDIR='"$(BISON_LOCALEDIR)"'
or:
AM_CPPFLAGS = -DBISON_LOCALEDIR='"$(BISON_LOCALEDIR)"'
autoreconf
to generate the build
infrastructure.