* bootstrap: Get runtime translations into runtime-po.

Create runtime-po files automatically, if possible.
* configure.ac: Invoke BISON_I18N, so that we eat our own dog food.
* data/yacc.c: Rewrite inclusion of <libintl.h> so that ENABLE_NLS
does not infringe on the user's name space.
(YYENABLE_NLS): Renamed from ENABLE_BISON_NLS.
* doc/bison.texinfo (Internationalization): Revamp the English
and Texinfo syntax a bit, to try to make it clearer.
(Bison Options, Option Cross Key): Mention --print-localedir.
* m4/bison-i18n.m4 (BISON_I18N): Rename ENABLE_BISON_NLS to
YYENABLE_NLS.  Quote a bit more.
* runtime-po/.cvsignore: New file.
* runtime-po/Makefile.in.in (mostlyclean): Remove *.old.pot.
* runtime-po/Rules-quot: Remove; now created by bootstrap.
* runtime-po/quot.sed: Likewise.
* runtime-po/boldquot.sed: Likewise.
* runtime-po/en@quot.header: Likewise.
* runtime-po/en@boldquot.header: Likewise.
* runtime-po/insert-header.sin: Likewise.
* runtime-po/remove-potcdate.sin: Likewise.
* runtime-po/Makevars: Likewise.
* runtime-po/LINGUAS: Likewise.
* runtime-po/de.po: Likewise; we will rely on the translation project
to maintain this, so "bootstrap" should get it.
* src/getarg.s (PRINT_LOCALEDIR_OPTION): Let the C compiler determine
its value.
* src/main.c (main): Bind the bison-runtime domain, too.

* data/yacc.c: Include <libintl.h> when NLS is enabled.
(YYI18N): Renamed from _. Use dgettext when NLS is enabled.
* po/POTFILES.in: Remove autogenerated file src/parse-gram.c.
* runtime-po: New directory.
* runtime-po/Makefile.in.in: New file, copied from po/, with modified
$(DOMAIN).pot-update rule, so that old messages are never dropped.
* runtime-po/Rules-quot: New file, copied from po/.
* runtime-po/quot.sed: Likewise.
* runtime-po/boldquot.sed: Likewise.
* runtime-po/en@quot.header: Likewise.
* runtime-po/en@boldquot.header: Likewise.
* runtime-po/insert-header.sin: Likewise.
* runtime-po/remove-potcdate.sin: Likewise.
* runtime-po/Makevars: New file.
* runtime-po/POTFILES.in: New file.
* runtime-po/LINGUAS: New file.
* runtime-po/bison-runtime.pot: New file.
* runtime-po/de.po: New file.
* m4/bison.m4: New file.
* Makefile.am (SUBDIRS): Add runtime-po.
(aclocaldir, aclocal_DATA): New variables.
* configure.ac: Add AC_CONFIG_FILES of runtime-po/Makefile.in.
Define aclocaldir.
* src/getargs.c (usage): Document --print-localedir option.
(PRINT_LOCALEDIR_OPTION): New enum item.
(long_options): Add --print-localedir option.
(getargs): Handle --print-localedir option.
* doc/bison.texinfo (Bison Parser): Remove paragraph about _().
(Internationalization): New section.
This commit is contained in:
Paul Eggert
2005-07-12 23:28:54 +00:00
parent 22dda0f004
commit f7ab6a5010
14 changed files with 772 additions and 47 deletions

View File

@@ -1,3 +1,65 @@
2005-07-12 Paul Eggert <eggert@cs.ucla.edu>
* bootstrap: Get runtime translations into runtime-po.
Create runtime-po files automatically, if possible.
* configure.ac: Invoke BISON_I18N, so that we eat our own dog food.
* data/yacc.c: Rewrite inclusion of <libintl.h> so that ENABLE_NLS
does not infringe on the user's name space.
(YYENABLE_NLS): Renamed from ENABLE_BISON_NLS.
* doc/bison.texinfo (Internationalization): Revamp the English
and Texinfo syntax a bit, to try to make it clearer.
(Bison Options, Option Cross Key): Mention --print-localedir.
* m4/bison-i18n.m4 (BISON_I18N): Rename ENABLE_BISON_NLS to
YYENABLE_NLS. Quote a bit more.
* runtime-po/.cvsignore: New file.
* runtime-po/Makefile.in.in (mostlyclean): Remove *.old.pot.
* runtime-po/Rules-quot: Remove; now created by bootstrap.
* runtime-po/quot.sed: Likewise.
* runtime-po/boldquot.sed: Likewise.
* runtime-po/en@quot.header: Likewise.
* runtime-po/en@boldquot.header: Likewise.
* runtime-po/insert-header.sin: Likewise.
* runtime-po/remove-potcdate.sin: Likewise.
* runtime-po/Makevars: Likewise.
* runtime-po/LINGUAS: Likewise.
* runtime-po/de.po: Likewise; we will rely on the translation project
to maintain this, so "bootstrap" should get it.
* src/getarg.s (PRINT_LOCALEDIR_OPTION): Let the C compiler determine
its value.
* src/main.c (main): Bind the bison-runtime domain, too.
2005-07-12 Bruno Haible <bruno@clisp.org>
* data/yacc.c: Include <libintl.h> when NLS is enabled.
(YYI18N): Renamed from _. Use dgettext when NLS is enabled.
* po/POTFILES.in: Remove autogenerated file src/parse-gram.c.
* runtime-po: New directory.
* runtime-po/Makefile.in.in: New file, copied from po/, with modified
$(DOMAIN).pot-update rule, so that old messages are never dropped.
* runtime-po/Rules-quot: New file, copied from po/.
* runtime-po/quot.sed: Likewise.
* runtime-po/boldquot.sed: Likewise.
* runtime-po/en@quot.header: Likewise.
* runtime-po/en@boldquot.header: Likewise.
* runtime-po/insert-header.sin: Likewise.
* runtime-po/remove-potcdate.sin: Likewise.
* runtime-po/Makevars: New file.
* runtime-po/POTFILES.in: New file.
* runtime-po/LINGUAS: New file.
* runtime-po/bison-runtime.pot: New file.
* runtime-po/de.po: New file.
* m4/bison.m4: New file.
* Makefile.am (SUBDIRS): Add runtime-po.
(aclocaldir, aclocal_DATA): New variables.
* configure.ac: Add AC_CONFIG_FILES of runtime-po/Makefile.in.
Define aclocaldir.
* src/getargs.c (usage): Document --print-localedir option.
(PRINT_LOCALEDIR_OPTION): New enum item.
(long_options): Add --print-localedir option.
(getargs): Handle --print-localedir option.
* doc/bison.texinfo (Bison Parser): Remove paragraph about _().
(Internationalization): New section.
2005-07-12 Akim Demaille <akim@epita.fr> 2005-07-12 Akim Demaille <akim@epita.fr>
* src/symtab.h, src/symtab.c (symbol_print): Swap the arguments, * src/symtab.h, src/symtab.c (symbol_print): Swap the arguments,

View File

@@ -18,7 +18,11 @@
ACLOCAL_AMFLAGS = -I m4 ACLOCAL_AMFLAGS = -I m4
SUBDIRS = config po lib data src doc tests examples SUBDIRS = config po runtime-po lib data src doc tests
# Files installed for use by Automake.
aclocaldir = @aclocaldir@
aclocal_DATA = m4/bison-i18n.m4
EXTRA_DIST = REFERENCES OChangeLog Makefile.maint GNUmakefile Makefile.cfg EXTRA_DIST = REFERENCES OChangeLog Makefile.maint GNUmakefile Makefile.cfg

View File

@@ -170,7 +170,18 @@ case $SKIP_PO in
wget -nv -nd -r -l 1 -A .po -C off \ wget -nv -nd -r -l 1 -A .po -C off \
http://www.iro.umontreal.ca/translation/maint/$package/ && http://www.iro.umontreal.ca/translation/maint/$package/ &&
ls *.po | sed 's/\.po$//' >LINGUAS ls *.po | sed 's/\.po$//' >LINGUAS
) || exit;; ) || exit
case $package in
bison)
echo "$0: getting translations into po (please ignore the robots.txt ERROR 404)..."
(cd runtime-po &&
rm -f dummy `ls | sed -n '/\.gmo$/p; /\.po$/p'` &&
wget -nv -nd -r -l 1 -A .po -C off \
http://www.iro.umontreal.ca/translation/maint/$package-runtime/ &&
ls *.po | sed 's/\.po$//' >LINGUAS
) || exit
esac;;
esac esac
@@ -231,6 +242,15 @@ rm -fr $intl_files_to_remove || exit
echo "$0: sed '/^MSGID_BUGS_ADDRESS *=/s/=.*/= bug-bison@gnu.org/' po/Makevars.template >po/Makevars ..." echo "$0: sed '/^MSGID_BUGS_ADDRESS *=/s/=.*/= bug-bison@gnu.org/' po/Makevars.template >po/Makevars ..."
sed '/^MSGID_BUGS_ADDRESS *=/s/=.*/= bug-bison@gnu.org/' po/Makevars.template >po/Makevars sed '/^MSGID_BUGS_ADDRESS *=/s/=.*/= bug-bison@gnu.org/' po/Makevars.template >po/Makevars
# Likewise for runtime-po/Makevars, except also change a few other parameters.
sed '
s/^\(DOMAIN\) *=.*/\1 = bison-runtime/
s/^\(subdir\) *=.*/\1 = runtime-po/
s/^\(XGETTEXT_OPTIONS\) *=.*/\1 = --keyword=YYI18N/
' <po/Makevars >runtime-po/Makevars
# Copy identical files from po to runtime-po.
(cd po && cp -p *-quot *.header *.sed *.sin ../runtime-po)
# if src/parse-gram.[ch] are out of date, rebuild them. # if src/parse-gram.[ch] are out of date, rebuild them.
parse_gram_y=`find src/parse-gram.y \ parse_gram_y=`find src/parse-gram.y \

View File

@@ -107,8 +107,15 @@ BISON_PREREQ_TIMEVAR
# gnulib and gettext. # gnulib and gettext.
GNULIB_AUTOCONF_SNIPPET GNULIB_AUTOCONF_SNIPPET
# We use po/Makevars.template, so we need at least gettext 0.12. # We use po/Makevars, so we need at least gettext 0.12.
AM_GNU_GETTEXT_VERSION([0.12]) AM_GNU_GETTEXT_VERSION([0.12])
BISON_I18N
# Internationalized parsers.
AC_CONFIG_FILES([runtime-po/Makefile.in])
# Autoconf macros for packages using internationalized parsers.
aclocaldir='${datadir}/aclocal'
AC_SUBST([aclocaldir])
# Initialize the test suite. # Initialize the test suite.
AC_CONFIG_TESTDIR(tests) AC_CONFIG_TESTDIR(tests)

View File

@@ -412,9 +412,16 @@ static const char *const yytname[] =
}; };
#endif #endif
/* INFRINGES ON USER NAME SPACE */ #ifndef YYI18N
#ifndef _ # if YYENABLE_NLS
# define _(msgid) msgid # if ENABLE_NLS
# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
# define YYI18N(msgid) dgettext ("bison-runtime", msgid)
# endif
# endif
# ifndef YYI18N
# define YYI18N(msgid) msgid
# endif
#endif #endif
# ifdef YYPRINT # ifdef YYPRINT
@@ -518,7 +525,7 @@ do \
} \ } \
else \ else \
{ \ { \
yyerror (]b4_yyerror_args[_("syntax error: cannot back up")); \ yyerror (]b4_yyerror_args[YYI18N ("syntax error: cannot back up")); \
YYERROR; \ YYERROR; \
} \ } \
while (0) while (0)
@@ -612,7 +619,7 @@ do { \
[[short int *bottom], [bottom]], [[short int *bottom], [bottom]],
[[short int *top], [top]])[ [[short int *top], [top]])[
{ {
YYFPRINTF (stderr, _("Stack now")); YYFPRINTF (stderr, YYI18N ("Stack now"));
for (/* Nothing. */; bottom <= top; ++bottom) for (/* Nothing. */; bottom <= top; ++bottom)
YYFPRINTF (stderr, " %d", *bottom); YYFPRINTF (stderr, " %d", *bottom);
YYFPRINTF (stderr, "\n"); YYFPRINTF (stderr, "\n");
@@ -634,7 +641,7 @@ do { \
{ {
int yyi; int yyi;
unsigned int yylno = yyrline[yyrule]; unsigned int yylno = yyrline[yyrule];
YYFPRINTF (stderr, _("Reducing stack by rule %d (line %u), "), YYFPRINTF (stderr, YYI18N ("Reducing stack by rule %d (line %u), "),
yyrule - 1, yylno); yyrule - 1, yylno);
/* Print the symbols being reduced, and their result. */ /* Print the symbols being reduced, and their result. */
for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++) for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
@@ -904,7 +911,7 @@ m4_ifdef([b4_at_dollar_used], [[ yylsp[0] = yylloc;
data in use in that stack, in bytes. This used to be a data in use in that stack, in bytes. This used to be a
conditional around just the two extra args, but that might conditional around just the two extra args, but that might
be undefined if yyoverflow is a macro. */ be undefined if yyoverflow is a macro. */
yyoverflow (_("parser stack overflow"), yyoverflow (YYI18N ("parser stack overflow"),
&yyss1, yysize * sizeof (*yyssp), &yyss1, yysize * sizeof (*yyssp),
&yyvs1, yysize * sizeof (*yyvsp), &yyvs1, yysize * sizeof (*yyvsp),
]b4_location_if([ &yyls1, yysize * sizeof (*yylsp),])[ ]b4_location_if([ &yyls1, yysize * sizeof (*yylsp),])[
@@ -944,14 +951,14 @@ m4_ifdef([b4_at_dollar_used], [[ yylsp[0] = yylloc;
yyvsp = yyvs + yysize - 1; yyvsp = yyvs + yysize - 1;
]b4_location_if([ yylsp = yyls + yysize - 1;])[ ]b4_location_if([ yylsp = yyls + yysize - 1;])[
YYDPRINTF ((stderr, _("Stack size increased to %lu\n"), YYDPRINTF ((stderr, YYI18N ("Stack size increased to %lu\n"),
(unsigned long int) yystacksize)); (unsigned long int) yystacksize));
if (yyss + yystacksize - 1 <= yyssp) if (yyss + yystacksize - 1 <= yyssp)
YYABORT; YYABORT;
} }
YYDPRINTF ((stderr, _("Entering state %d\n"), yystate)); YYDPRINTF ((stderr, YYI18N ("Entering state %d\n"), yystate));
goto yybackup; goto yybackup;
@@ -975,19 +982,19 @@ yybackup:
/* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
if (yychar == YYEMPTY) if (yychar == YYEMPTY)
{ {
YYDPRINTF ((stderr, _("Reading a token: "))); YYDPRINTF ((stderr, YYI18N ("Reading a token: ")));
yychar = YYLEX; yychar = YYLEX;
} }
if (yychar <= YYEOF) if (yychar <= YYEOF)
{ {
yychar = yytoken = YYEOF; yychar = yytoken = YYEOF;
YYDPRINTF ((stderr, _("Now at end of input.\n"))); YYDPRINTF ((stderr, YYI18N ("Now at end of input.\n")));
} }
else else
{ {
yytoken = YYTRANSLATE (yychar); yytoken = YYTRANSLATE (yychar);
YY_SYMBOL_PRINT (_("Next token is"), yytoken, &yylval, &yylloc); YY_SYMBOL_PRINT (YYI18N ("Next token is"), yytoken, &yylval, &yylloc);
} }
/* If the proper action on seeing token YYTOKEN is to reduce or to /* If the proper action on seeing token YYTOKEN is to reduce or to
@@ -1008,7 +1015,7 @@ yybackup:
YYACCEPT; YYACCEPT;
/* Shift the look-ahead token. */ /* Shift the look-ahead token. */
YY_SYMBOL_PRINT (_("Shifting"), yytoken, &yylval, &yylloc); YY_SYMBOL_PRINT (YYI18N ("Shifting"), yytoken, &yylval, &yylloc);
/* Discard the token being shifted unless it is eof. */ /* Discard the token being shifted unless it is eof. */
if (yychar != YYEOF) if (yychar != YYEOF)
@@ -1116,11 +1123,11 @@ yyerrlab:
#if 0 #if 0
/* This is so xgettext sees the translatable formats that are /* This is so xgettext sees the translatable formats that are
constructed on the fly. */ constructed on the fly. */
_("syntax error, unexpected %s"); YYI18N ("syntax error, unexpected %s");
_("syntax error, unexpected %s, expecting %s"); YYI18N ("syntax error, unexpected %s, expecting %s");
_("syntax error, unexpected %s, expecting %s or %s"); YYI18N ("syntax error, unexpected %s, expecting %s or %s");
_("syntax error, unexpected %s, expecting %s or %s or %s"); YYI18N ("syntax error, unexpected %s, expecting %s or %s or %s");
_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); YYI18N ("syntax error, unexpected %s, expecting %s or %s or %s or %s");
#endif #endif
char *yyfmt; char *yyfmt;
char const *yyf; char const *yyf;
@@ -1163,7 +1170,7 @@ yyerrlab:
yyprefix = yyor; yyprefix = yyor;
} }
yyf = _(yyformat); yyf = YYI18N (yyformat);
yysize1 = yysize + yystrlen (yyf); yysize1 = yysize + yystrlen (yyf);
yysize_overflow |= yysize1 < yysize; yysize_overflow |= yysize1 < yysize;
yysize = yysize1; yysize = yysize1;
@@ -1194,11 +1201,11 @@ yyerrlab:
YYSTACK_FREE (yymsg); YYSTACK_FREE (yymsg);
} }
else else
yyerror (]b4_yyerror_args[_("syntax error; also memory exhausted")); yyerror (]b4_yyerror_args[YYI18N ("syntax error; also memory exhausted"));
} }
else else
#endif /* YYERROR_VERBOSE */ #endif /* YYERROR_VERBOSE */
yyerror (]b4_yyerror_args[_("syntax error")); yyerror (]b4_yyerror_args[YYI18N ("syntax error"));
} }
]b4_location_if([[ yyerror_range[0] = yylloc;]])[ ]b4_location_if([[ yyerror_range[0] = yylloc;]])[
@@ -1217,7 +1224,7 @@ yyerrlab:
} }
else else
{ {
yydestruct (_("Error: discarding"), yytoken, &yylval]b4_location_if([, &yylloc])[); yydestruct (YYI18N ("Error: discarding"), yytoken, &yylval]b4_location_if([, &yylloc])[);
yychar = YYEMPTY; yychar = YYEMPTY;
} }
} }
@@ -1271,7 +1278,7 @@ yyerrlab1:
YYABORT; YYABORT;
]b4_location_if([[ yyerror_range[0] = *yylsp;]])[ ]b4_location_if([[ yyerror_range[0] = *yylsp;]])[
yydestruct (_("Error: popping"), yystos[yystate], yyvsp]b4_location_if([, yylsp])[); yydestruct (YYI18N ("Error: popping"), yystos[yystate], yyvsp]b4_location_if([, yylsp])[);
YYPOPSTACK; YYPOPSTACK;
yystate = *yyssp; yystate = *yyssp;
YY_STACK_PRINT (yyss, yyssp); YY_STACK_PRINT (yyss, yyssp);
@@ -1289,7 +1296,7 @@ yyerrlab1:
*++yylsp = yyloc;]])[ *++yylsp = yyloc;]])[
/* Shift the error token. */ /* Shift the error token. */
YY_SYMBOL_PRINT (_("Shifting"), yystos[yyn], yyvsp, yylsp); YY_SYMBOL_PRINT (YYI18N ("Shifting"), yystos[yyn], yyvsp, yylsp);
yystate = yyn; yystate = yyn;
goto yynewstate; goto yynewstate;
@@ -1314,14 +1321,14 @@ yyabortlab:
| yyoverflowlab -- parser overflow comes here. | | yyoverflowlab -- parser overflow comes here. |
`----------------------------------------------*/ `----------------------------------------------*/
yyoverflowlab: yyoverflowlab:
yyerror (]b4_yyerror_args[_("parser stack overflow")); yyerror (]b4_yyerror_args[YYI18N ("parser stack overflow"));
yyresult = 2; yyresult = 2;
/* Fall through. */ /* Fall through. */
#endif #endif
yyreturn: yyreturn:
if (yychar != YYEOF && yychar != YYEMPTY) if (yychar != YYEOF && yychar != YYEMPTY)
yydestruct (_("Error: discarding lookahead"), yydestruct (YYI18N ("Error: discarding lookahead"),
yytoken, &yylval]b4_location_if([, &yylloc])[); yytoken, &yylval]b4_location_if([, &yylloc])[);
if (yyssp != yyss) if (yyssp != yyss)
for (;;) for (;;)
@@ -1330,7 +1337,7 @@ yyreturn:
YYPOPSTACK; YYPOPSTACK;
if (yyssp == yyss) if (yyssp == yyss)
break; break;
yydestruct (_("Error: popping"), yydestruct (YYI18N ("Error: popping"),
yystos[*yyssp], yyvsp]b4_location_if([, yylsp])[); yystos[*yyssp], yyvsp]b4_location_if([, yylsp])[);
} }
#ifndef yyoverflow #ifndef yyoverflow

View File

@@ -243,6 +243,8 @@ Parser C-Language Interface
which reads tokens. which reads tokens.
* Error Reporting:: You must supply a function @code{yyerror}. * Error Reporting:: You must supply a function @code{yyerror}.
* Action Features:: Special features for use in actions. * Action Features:: Special features for use in actions.
* Internationalization:: How to let the parser speak in the user's
native language.
The Lexical Analyzer Function @code{yylex} The Lexical Analyzer Function @code{yylex}
@@ -1187,14 +1189,7 @@ start with a function called @code{main}; you have to provide this, and
arrange for it to call @code{yyparse} or the parser will never run. arrange for it to call @code{yyparse} or the parser will never run.
@xref{Interface, ,Parser C-Language Interface}. @xref{Interface, ,Parser C-Language Interface}.
If your code defines a C preprocessor macro @code{_} (a single Aside from the token type names and the symbols in the actions you
underscore), Bison assumes that it can be used to translate
English-language strings to the user's preferred language using a
function-like syntax, e.g., @code{_("syntax error")}. Otherwise,
Bison defines a no-op macro by that name that merely returns its
argument, so strings are not translated.
Aside from @code{_} and the token type names and the symbols in the actions you
write, all symbols defined in the Bison parser file itself write, all symbols defined in the Bison parser file itself
begin with @samp{yy} or @samp{YY}. This includes interface functions begin with @samp{yy} or @samp{YY}. This includes interface functions
such as the lexical analyzer function @code{yylex}, the error reporting such as the lexical analyzer function @code{yylex}, the error reporting
@@ -4250,6 +4245,8 @@ in the grammar file, you are likely to run into trouble.
which reads tokens. which reads tokens.
* Error Reporting:: You must supply a function @code{yyerror}. * Error Reporting:: You must supply a function @code{yyerror}.
* Action Features:: Special features for use in actions. * Action Features:: Special features for use in actions.
* Internationalization:: How to let the parser speak in the user's
native language.
@end menu @end menu
@node Parser Function @node Parser Function
@@ -4812,6 +4809,84 @@ of the @var{n}th component of the current rule. @xref{Locations, ,
Tracking Locations}. Tracking Locations}.
@end deffn @end deffn
@node Internationalization
@section Parser Internationalization
@cindex internationalization
@cindex i18n
@cindex NLS
@cindex gettext
@cindex bison-po
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
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
installation.
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 @acronym{GNU} Autoconf and
@acronym{GNU} Automake.
@enumerate
@item
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
@samp{share/aclocal/bison-i18n.m4} in Bison's installation directory.
For example:
@example
cp /usr/local/share/aclocal/bison-i18n.m4 m4/bison-i18n.m4
@end example
@item
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.
@item
In the @code{main} function of your program, designate the directory
containing Bison's runtime message catalog, through a call to
@samp{bindtextdomain} with domain name @samp{bison-runtime}.
For example:
@example
bindtextdomain ("bison-runtime", BISON_LOCALEDIR);
@end example
Typically this appears after any other call @code{bindtextdomain
(PACKAGE, LOCALEDIR)} that your package already has. Here we rely on
@samp{BISON_LOCALEDIR} to be defined as a string through the
@file{Makefile}.
@item
In the @file{Makefile.am} that controls the compilation of the @code{main}
function, make @samp{BISON_LOCALEDIR} available as a C preprocessor macro,
either in @samp{DEFS} or in @samp{AM_CPPFLAGS}. For example:
@example
DEFS = @@DEFS@@ -DBISON_LOCALEDIR='"$(BISON_LOCALEDIR)"'
@end example
or:
@example
AM_CPPFLAGS = -DBISON_LOCALEDIR='"$(BISON_LOCALEDIR)"'
@end example
@item
Finally, invoke the command @command{autoreconf} to generate the build
infrastructure.
@end enumerate
@node Algorithm @node Algorithm
@chapter The Bison Parser Algorithm @chapter The Bison Parser Algorithm
@@ -6575,6 +6650,9 @@ Print a summary of the command-line options to Bison and exit.
@itemx --version @itemx --version
Print the version number of Bison and exit. Print the version number of Bison and exit.
@item --print-localedir
Print the name of the directory containing locale-dependent data.
@need 1750 @need 1750
@item -y @item -y
@itemx --yacc @itemx --yacc
@@ -6714,6 +6792,7 @@ the corresponding short option.
\line{ --no-lines \leaderfill -l} \line{ --no-lines \leaderfill -l}
\line{ --no-parser \leaderfill -n} \line{ --no-parser \leaderfill -n}
\line{ --output \leaderfill -o} \line{ --output \leaderfill -o}
\line{ --print-localedir}
\line{ --token-table \leaderfill -k} \line{ --token-table \leaderfill -k}
\line{ --verbose \leaderfill -v} \line{ --verbose \leaderfill -v}
\line{ --version \leaderfill -V} \line{ --version \leaderfill -V}
@@ -6732,6 +6811,7 @@ the corresponding short option.
--no-lines -l --no-lines -l
--no-parser -n --no-parser -n
--output=@var{outfile} -o @var{outfile} --output=@var{outfile} -o @var{outfile}
--print-localedir
--token-table -k --token-table -k
--verbose -v --verbose -v
--version -V --version -V

59
m4/bison-i18n.m4 Normal file
View File

@@ -0,0 +1,59 @@
# bison-i18n.m4 serial 1 (bison-2.1)
dnl Copyright (C) 2005 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
dnl From Bruno Haible.
dnl Support for internationalization of bison-generated parsers.
dnl BISON_I18N
dnl should be used in configure.ac, after AM_GNU_GETTEXT. If USE_NLS is yes, it
dnl sets BISON_LOCALEDIR to indicate where to find the bison-runtime.mo files
dnl and defines YYENABLE_NLS if there are bison-runtime.mo files at all.
AC_DEFUN([BISON_I18N],
[
if test -z "$USE_NLS"; then
echo "The BISON-I18N macro is used without being preceded by AM-GNU-GETTEXT." 1>&2
exit 1
fi
BISON_LOCALEDIR=
if test "$USE_NLS" = yes; then
dnl AC_PROG_YACC sets the YACC variable; other macros set the BISON variable.
if test -n "$YACC"; then
case "$YACC" in
*bison*)
if ($YACC --print-localedir) >/dev/null 2>&1; then
BISON_LOCALEDIR=`$YACC --print-localedir`
fi
;;
esac
else
if test -n "$BISON"; then
if test "$BISON" != ":"; then
if ($BISON --print-localedir) >/dev/null 2>&1; then
BISON_LOCALEDIR=`$BISON --print-localedir`
fi
fi
fi
fi
AC_SUBST([BISON_LOCALEDIR])
if test -n "$BISON_LOCALEDIR"; then
USER_LINGUAS="${LINGUAS-%UNSET%}"
if test -n "$USER_LINGUAS"; then
BISON_USE_NLS=yes
else
BISON_USE_NLS=no
fi
else
BISON_USE_NLS=no
fi
else
BISON_USE_NLS=no
fi
if test $BISON_USE_NLS = yes; then
AC_DEFINE([YYENABLE_NLS], 1,
[Define to 1 to internationalize bison runtime messages.])
fi
])

View File

@@ -4,7 +4,6 @@ src/files.c
src/getargs.c src/getargs.c
src/gram.c src/gram.c
src/main.c src/main.c
src/parse-gram.c
src/parse-gram.y src/parse-gram.y
src/print.c src/print.c
src/reader.c src/reader.c

17
runtime-po/.cvsignore Normal file
View File

@@ -0,0 +1,17 @@
*.gmo
*.po
LINGUAS
Makefile
Makefile.in
Makevars
POTFILES
Rules-quot
bison-runtime.old.pot
boldquot.sed
en@boldquot.header
en@quot.header
insert-header.sin
quot.sed
remove-potcdate.sed
remove-potcdate.sin
stamp-po

356
runtime-po/Makefile.in.in Normal file
View File

@@ -0,0 +1,356 @@
# Makefile for PO directory in any package using GNU gettext.
# Copyright (C) 1995-1997, 2000-2003 by Ulrich Drepper <drepper@gnu.ai.mit.edu>
#
# This file can be copied and used freely without restrictions. It can
# be used in projects which are not available under the GNU General Public
# License but which still want to provide support for the GNU gettext
# functionality.
# Please note that the actual code of GNU gettext is covered by the GNU
# General Public License and is *not* in the public domain.
PACKAGE = @PACKAGE@
VERSION = @VERSION@
SHELL = /bin/sh
@SET_MAKE@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
datadir = @datadir@
localedir = $(datadir)/locale
gettextsrcdir = $(datadir)/gettext/po
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
MKINSTALLDIRS = @MKINSTALLDIRS@
mkinstalldirs = $(SHELL) $(MKINSTALLDIRS)
GMSGFMT = @GMSGFMT@
MSGFMT = @MSGFMT@
XGETTEXT = @XGETTEXT@
MSGMERGE = msgmerge
MSGMERGE_UPDATE = @MSGMERGE@ --update
MSGINIT = msginit
MSGCONV = msgconv
MSGFILTER = msgfilter
POFILES = @POFILES@
GMOFILES = @GMOFILES@
UPDATEPOFILES = @UPDATEPOFILES@
DUMMYPOFILES = @DUMMYPOFILES@
DISTFILES.common = Makefile.in.in remove-potcdate.sin \
$(DISTFILES.common.extra1) $(DISTFILES.common.extra2) $(DISTFILES.common.extra3)
DISTFILES = $(DISTFILES.common) Makevars POTFILES.in $(DOMAIN).pot stamp-po \
$(POFILES) $(GMOFILES) \
$(DISTFILES.extra1) $(DISTFILES.extra2) $(DISTFILES.extra3)
POTFILES = \
CATALOGS = @CATALOGS@
# Makevars gets inserted here. (Don't remove this line!)
.SUFFIXES:
.SUFFIXES: .po .gmo .mo .sed .sin .nop .po-update
.po.mo:
@echo "$(MSGFMT) -c -o $@ $<"; \
$(MSGFMT) -c -o t-$@ $< && mv t-$@ $@
.po.gmo:
@lang=`echo $* | sed -e 's,.*/,,'`; \
test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
echo "$${cdcmd}rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics -o $${lang}.gmo $${lang}.po"; \
cd $(srcdir) && rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics -o t-$${lang}.gmo $${lang}.po && mv t-$${lang}.gmo $${lang}.gmo
.sin.sed:
sed -e '/^#/d' $< > t-$@
mv t-$@ $@
all: all-@USE_NLS@
all-yes: stamp-po
all-no:
# stamp-po is a timestamp denoting the last time at which the CATALOGS have
# been loosely updated. Its purpose is that when a developer or translator
# checks out the package via CVS, and the $(DOMAIN).pot file is not in CVS,
# "make" will update the $(DOMAIN).pot and the $(CATALOGS), but subsequent
# invocations of "make" will do nothing. This timestamp would not be necessary
# if updating the $(CATALOGS) would always touch them; however, the rule for
# $(POFILES) has been designed to not touch files that don't need to be
# changed.
stamp-po: $(srcdir)/$(DOMAIN).pot
test -z "$(CATALOGS)" || $(MAKE) $(CATALOGS)
@echo "touch stamp-po"
@echo timestamp > stamp-poT
@mv stamp-poT stamp-po
# Note: Target 'all' must not depend on target '$(DOMAIN).pot-update',
# otherwise packages like GCC can not be built if only parts of the source
# have been downloaded.
# This target rebuilds $(DOMAIN).pot; it is an expensive operation.
# Note that $(DOMAIN).pot is not touched if it doesn't need to be changed.
$(DOMAIN).pot-update: $(POTFILES) $(srcdir)/POTFILES.in remove-potcdate.sed
$(XGETTEXT) -o $(DOMAIN).old.pot --no-location $(DOMAIN).pot && \
$(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_srcdir) \
--add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) \
--files-from=$(srcdir)/POTFILES.in $(subdir)/$(DOMAIN).old.pot \
--copyright-holder='$(COPYRIGHT_HOLDER)' \
--msgid-bugs-address='$(MSGID_BUGS_ADDRESS)'
rm -f $(DOMAIN).old.pot
test ! -f $(DOMAIN).po || { \
if test -f $(srcdir)/$(DOMAIN).pot; then \
sed -f remove-potcdate.sed < $(srcdir)/$(DOMAIN).pot > $(DOMAIN).1po && \
sed -f remove-potcdate.sed < $(DOMAIN).po > $(DOMAIN).2po && \
if cmp $(DOMAIN).1po $(DOMAIN).2po >/dev/null 2>&1; then \
rm -f $(DOMAIN).1po $(DOMAIN).2po $(DOMAIN).po; \
else \
rm -f $(DOMAIN).1po $(DOMAIN).2po $(srcdir)/$(DOMAIN).pot && \
mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \
fi; \
else \
mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \
fi; \
}
# This rule has no dependencies: we don't need to update $(DOMAIN).pot at
# every "make" invocation, only create it when it is missing.
# Only "make $(DOMAIN).pot-update" or "make dist" will force an update.
$(srcdir)/$(DOMAIN).pot:
$(MAKE) $(DOMAIN).pot-update
# This target rebuilds a PO file if $(DOMAIN).pot has changed.
# Note that a PO file is not touched if it doesn't need to be changed.
$(POFILES): $(srcdir)/$(DOMAIN).pot
@lang=`echo $@ | sed -e 's,.*/,,' -e 's/\.po$$//'`; \
test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
echo "$${cdcmd}$(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot"; \
cd $(srcdir) && $(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot
install: install-exec install-data
install-exec:
install-data: install-data-@USE_NLS@
if test "$(PACKAGE)" = "gettext-tools"; then \
$(mkinstalldirs) $(DESTDIR)$(gettextsrcdir); \
for file in $(DISTFILES.common) Makevars.template; do \
$(INSTALL_DATA) $(srcdir)/$$file \
$(DESTDIR)$(gettextsrcdir)/$$file; \
done; \
for file in Makevars; do \
rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \
done; \
else \
: ; \
fi
install-data-no: all
install-data-yes: all
$(mkinstalldirs) $(DESTDIR)$(datadir)
@catalogs='$(CATALOGS)'; \
for cat in $$catalogs; do \
cat=`basename $$cat`; \
lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
dir=$(localedir)/$$lang/LC_MESSAGES; \
$(mkinstalldirs) $(DESTDIR)$$dir; \
if test -r $$cat; then realcat=$$cat; else realcat=$(srcdir)/$$cat; fi; \
$(INSTALL_DATA) $$realcat $(DESTDIR)$$dir/$(DOMAIN).mo; \
echo "installing $$realcat as $(DESTDIR)$$dir/$(DOMAIN).mo"; \
for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \
if test -n "$$lc"; then \
if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \
link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \
mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
(cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \
for file in *; do \
if test -f $$file; then \
ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \
fi; \
done); \
rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
else \
if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \
:; \
else \
rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \
mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
fi; \
fi; \
rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
ln -s ../LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \
ln $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \
cp -p $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
echo "installing $$realcat link as $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo"; \
fi; \
done; \
done
install-strip: install
installdirs: installdirs-exec installdirs-data
installdirs-exec:
installdirs-data: installdirs-data-@USE_NLS@
if test "$(PACKAGE)" = "gettext-tools"; then \
$(mkinstalldirs) $(DESTDIR)$(gettextsrcdir); \
else \
: ; \
fi
installdirs-data-no:
installdirs-data-yes:
$(mkinstalldirs) $(DESTDIR)$(datadir)
@catalogs='$(CATALOGS)'; \
for cat in $$catalogs; do \
cat=`basename $$cat`; \
lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
dir=$(localedir)/$$lang/LC_MESSAGES; \
$(mkinstalldirs) $(DESTDIR)$$dir; \
for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \
if test -n "$$lc"; then \
if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \
link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \
mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
(cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \
for file in *; do \
if test -f $$file; then \
ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \
fi; \
done); \
rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
else \
if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \
:; \
else \
rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \
mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
fi; \
fi; \
fi; \
done; \
done
# Define this as empty until I found a useful application.
installcheck:
uninstall: uninstall-exec uninstall-data
uninstall-exec:
uninstall-data: uninstall-data-@USE_NLS@
if test "$(PACKAGE)" = "gettext-tools"; then \
for file in $(DISTFILES.common) Makevars.template; do \
rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \
done; \
else \
: ; \
fi
uninstall-data-no:
uninstall-data-yes:
catalogs='$(CATALOGS)'; \
for cat in $$catalogs; do \
cat=`basename $$cat`; \
lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
for lc in LC_MESSAGES $(EXTRA_LOCALE_CATEGORIES); do \
rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
done; \
done
check: all
info dvi ps pdf html tags TAGS ctags CTAGS ID:
mostlyclean:
rm -f remove-potcdate.sed
rm -f stamp-poT
rm -f core core.* $(DOMAIN).po $(DOMAIN).1po $(DOMAIN).2po *.new.po
rm -f *.old.pot
rm -fr *.o
clean: mostlyclean
distclean: clean
rm -f Makefile Makefile.in POTFILES *.mo
maintainer-clean: distclean
@echo "This command is intended for maintainers to use;"
@echo "it deletes files that may require special tools to rebuild."
rm -f stamp-po $(GMOFILES)
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
dist distdir:
$(MAKE) update-po
@$(MAKE) dist2
# This is a separate target because 'update-po' must be executed before.
dist2: $(DISTFILES)
dists="$(DISTFILES)"; \
if test "$(PACKAGE)" = "gettext-tools"; then \
dists="$$dists Makevars.template"; \
fi; \
if test -f $(srcdir)/ChangeLog; then \
dists="$$dists ChangeLog"; \
fi; \
for i in 0 1 2 3 4 5 6 7 8 9; do \
if test -f $(srcdir)/ChangeLog.$$i; then \
dists="$$dists ChangeLog.$$i"; \
fi; \
done; \
if test -f $(srcdir)/LINGUAS; then dists="$$dists LINGUAS"; fi; \
for file in $$dists; do \
if test -f $$file; then \
cp -p $$file $(distdir); \
else \
cp -p $(srcdir)/$$file $(distdir); \
fi; \
done
update-po: Makefile
$(MAKE) $(DOMAIN).pot-update
test -z "$(UPDATEPOFILES)" || $(MAKE) $(UPDATEPOFILES)
$(MAKE) update-gmo
# General rule for updating PO files.
.nop.po-update:
@lang=`echo $@ | sed -e 's/\.po-update$$//'`; \
if test "$(PACKAGE)" = "gettext-tools"; then PATH=`pwd`/../src:$$PATH; fi; \
tmpdir=`pwd`; \
echo "$$lang:"; \
test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
echo "$${cdcmd}$(MSGMERGE) $$lang.po $(DOMAIN).pot -o $$lang.new.po"; \
cd $(srcdir); \
if $(MSGMERGE) $$lang.po $(DOMAIN).pot -o $$tmpdir/$$lang.new.po; then \
if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \
rm -f $$tmpdir/$$lang.new.po; \
else \
if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \
:; \
else \
echo "msgmerge for $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \
exit 1; \
fi; \
fi; \
else \
echo "msgmerge for $$lang.po failed!" 1>&2; \
rm -f $$tmpdir/$$lang.new.po; \
fi
$(DUMMYPOFILES):
update-gmo: Makefile $(GMOFILES)
@:
Makefile: Makefile.in.in $(top_builddir)/config.status @POMAKEFILEDEPS@
cd $(top_builddir) \
&& CONFIG_FILES=$(subdir)/$@.in CONFIG_HEADERS= \
$(SHELL) ./config.status
force:
# Tell versions [3.59,3.63) of GNU make not to export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

1
runtime-po/POTFILES.in Normal file
View File

@@ -0,0 +1 @@
data/yacc.c

View File

@@ -0,0 +1,105 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR Free Software Foundation, Inc.
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: bug-bison@gnu.org\n"
"POT-Creation-Date: 2005-06-27 00:48+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
#: data/yacc.c:520
msgid "syntax error: cannot back up"
msgstr ""
#: data/yacc.c:614
msgid "Stack now"
msgstr ""
#: data/yacc.c:636
#, c-format
msgid "Reducing stack by rule %d (line %u), "
msgstr ""
#: data/yacc.c:905 data/yacc.c:1315
msgid "parser stack overflow"
msgstr ""
#: data/yacc.c:945
#, c-format
msgid "Stack size increased to %lu\n"
msgstr ""
#: data/yacc.c:952
#, c-format
msgid "Entering state %d\n"
msgstr ""
#: data/yacc.c:976
msgid "Reading a token: "
msgstr ""
#: data/yacc.c:983
msgid "Now at end of input.\n"
msgstr ""
#: data/yacc.c:988
msgid "Next token is"
msgstr ""
#: data/yacc.c:1009 data/yacc.c:1290
msgid "Shifting"
msgstr ""
#: data/yacc.c:1117
#, c-format
msgid "syntax error, unexpected %s"
msgstr ""
#: data/yacc.c:1118
#, c-format
msgid "syntax error, unexpected %s, expecting %s"
msgstr ""
#: data/yacc.c:1119
#, c-format
msgid "syntax error, unexpected %s, expecting %s or %s"
msgstr ""
#: data/yacc.c:1120
#, c-format
msgid "syntax error, unexpected %s, expecting %s or %s or %s"
msgstr ""
#: data/yacc.c:1121
#, c-format
msgid "syntax error, unexpected %s, expecting %s or %s or %s or %s"
msgstr ""
#: data/yacc.c:1195
msgid "syntax error; also memory exhausted"
msgstr ""
#: data/yacc.c:1199
msgid "syntax error"
msgstr ""
#: data/yacc.c:1218
msgid "Error: discarding"
msgstr ""
#: data/yacc.c:1272 data/yacc.c:1331
msgid "Error: popping"
msgstr ""
#: data/yacc.c:1322
msgid "Error: discarding lookahead"
msgstr ""

View File

@@ -207,9 +207,10 @@ for the equivalent short option also. Similarly for optional arguments.\n"),
fputs (_("\ fputs (_("\
Operation modes:\n\ Operation modes:\n\
-h, --help display this help and exit\n\ -h, --help display this help and exit\n\
-V, --version output version information and exit\n\ -V, --version output version information and exit\n\
-y, --yacc emulate POSIX yacc\n"), stdout); --print-localedir output directory containing locale-dependent data\n\
-y, --yacc emulate POSIX yacc\n"), stdout);
putc ('\n', stdout); putc ('\n', stdout);
fputs (_("\ fputs (_("\
@@ -289,14 +290,16 @@ const char *short_options = "yvegdhr:ltknVo:b:p:S:T::";
/* Values for long options that do not have single-letter equivalents. */ /* Values for long options that do not have single-letter equivalents. */
enum enum
{ {
LOCATIONS_OPTION = CHAR_MAX + 1 LOCATIONS_OPTION = CHAR_MAX + 1,
PRINT_LOCALEDIR_OPTION
}; };
static struct option const long_options[] = static struct option const long_options[] =
{ {
/* Operation modes. */ /* Operation modes. */
{ "help", no_argument, 0, 'h' }, { "help", no_argument, 0, 'h' },
{ "version", no_argument, 0, 'V' }, { "version", no_argument, 0, 'V' },
{ "print-localedir", no_argument, 0, PRINT_LOCALEDIR_OPTION },
/* Parser. */ /* Parser. */
{ "name-prefix", required_argument, 0, 'p' }, { "name-prefix", required_argument, 0, 'p' },
@@ -364,6 +367,10 @@ getargs (int argc, char *argv[])
version (); version ();
exit (EXIT_SUCCESS); exit (EXIT_SUCCESS);
case PRINT_LOCALEDIR_OPTION:
printf ("%s\n", LOCALEDIR);
exit (EXIT_SUCCESS);
case 'g': case 'g':
/* Here, the -g and --graph=FILE options are differentiated. */ /* Here, the -g and --graph=FILE options are differentiated. */
graph_flag = true; graph_flag = true;

View File

@@ -56,8 +56,9 @@ main (int argc, char *argv[])
{ {
program_name = argv[0]; program_name = argv[0];
setlocale (LC_ALL, ""); setlocale (LC_ALL, "");
(void) bindtextdomain (PACKAGE, LOCALEDIR); bindtextdomain (PACKAGE, LOCALEDIR);
(void) textdomain (PACKAGE); bindtextdomain ("bison-runtime", LOCALEDIR);
textdomain (PACKAGE);
uniqstrs_new (); uniqstrs_new ();