mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-27 05:03:07 +00:00
examples: bistromathic: demonstrate internationalization
Currently it was only using stubs. Let's actually translate the strings using gettext. * examples/c/bistromathic/local.mk: Define LOCALEDIR, BISON_LOCALEDIR and link with libintl. * examples/c/bistromathic/parse.y: Use them. Remove useless includes. Take ENABLE_NLS into account. (error_format_string): New. (yyreport_syntax_error): Rewrite to rely on a format string, which is more appropriate for internationalization. * examples/c/bistromathic/Makefile: We no longer use Flex. We need readline and intl. * doc/bison.texi: Point to bistromathic for a better option for internationalization. * po/POTFILES.in: Add bistromathic.
This commit is contained in:
@@ -3,20 +3,26 @@
|
||||
|
||||
BASE = bistromathic
|
||||
BISON = bison
|
||||
FLEX = flex
|
||||
XSLTPROC = xsltproc
|
||||
|
||||
# We need to find the headers and libs for readline and intl.
|
||||
# You probably need to customize this for your own environment.
|
||||
CPPFLAGS = -I/opt/local/include
|
||||
LDFLAGS = -L/opt/local/lib
|
||||
|
||||
# Find the translation catalogue for Bison's generated messagess.
|
||||
BISON_LOCALEDIR = $(shell $(BISON) $(BISON_FLAGS) --print-localedir)
|
||||
CPPFLAGS += -DENABLE_NLS -DBISON_LOCALEDIR='"$(BISON_LOCALEDIR)"'
|
||||
|
||||
LIBS = -lreadline -lintl
|
||||
|
||||
all: $(BASE)
|
||||
|
||||
%.c %.h %.xml %.gv: %.y
|
||||
$(BISON) $(BISONFLAGS) --defines --xml --graph=$*.gv -o $*.c $<
|
||||
|
||||
%.c: %.l
|
||||
$(FLEX) $(FLEXFLAGS) -o$*.c $<
|
||||
|
||||
scan.o: parse.h
|
||||
$(BASE): parse.o scan.o
|
||||
$(CC) $(CFLAGS) -o $@ $^
|
||||
$(BASE): parse.o
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LIBS)
|
||||
|
||||
run: $(BASE)
|
||||
@echo "Type bistromathic expressions. Quit with ctrl-d."
|
||||
@@ -28,8 +34,7 @@ html: $(BASE).html
|
||||
|
||||
CLEANFILES = \
|
||||
$(BASE) *.o \
|
||||
parse.[ch] parse.output parse.xml parse.html parse.gv \
|
||||
scan.c
|
||||
parse.[ch] parse.output parse.xml parse.html parse.gv
|
||||
|
||||
clean:
|
||||
rm -f $(CLEANFILES)
|
||||
|
||||
Reference in New Issue
Block a user