/c++defs.h
/lib
/cdecl99
+/ABOUT-NLS
SUBDIRS = lib .
AM_CPPFLAGS = -I$(top_builddir)/src -I$(top_srcdir)/src \
- -I$(top_builddir)/lib -I$(top_srcdir)/lib
+ -I$(top_builddir)/lib -I$(top_srcdir)/lib \
+ -DLOCALEDIR=\"$(localedir)\"
MAINTAINERCLEANFILES = src/scan.c src/scan.h src/scan.stamp \
src/parse.c src/parse.h src/parse.stamp
include_HEADERS = src/cdecl.h
noinst_HEADERS = src/typemap.h src/output.h src/scan.h src/parse.h
+noinst_DATA = $(MOFILES)
+
lib_LTLIBRARIES = libcdecl.la
libcdecl_la_LDFLAGS = -export-symbols-regex '^cdecl_[[:lower:]]'
libcdecl_la_SOURCES = src/scan.c src/parse.c src/parse-decl.c src/typemap.c \
src/output.c src/explain.c src/declare.c
+libcdecl_la_LIBADD = $(LTLIBINTL)
bin_PROGRAMS = cdecl99
cdecl99_SOURCES = src/cdecl99.c
< $(srcdir)/src/types.lst > $@.tmp
$(AM_V_at)mv -f $@.tmp $@
+# Supporting rules for gettext.
+ALL_MOFILES = $(POFILES:.po=.mo)
+EXTRA_DIST += po/$(PACKAGE).pot po/LINGUAS $(POFILES) $(ALL_MOFILES)
+MAINTAINERCLEANFILES += po/$(PACKAGE).pot $(ALL_MOFILES)
+XGETTEXT_OPTS = -D $(builddir) -D $(srcdir) --from-code=utf-8 \
+ --add-comments=TRANSLATORS: --foreign-user \
+ --package-name=$(PACKAGE) --package-version=$(PACKAGE_VERSION) \
+ --msgid-bugs-address=$(PACKAGE_BUGREPORT)
+
+po/$(PACKAGE).pot: $(SOURCES)
+ $(AM_V_at)$(MKDIR_P) $(@D)
+ $(AM_V_GEN)$(XGETTEXT) $(XGETTEXT_OPTS) -o $@ $(SOURCES)
+
+.po.mo:
+ $(AM_V_at)$(MKDIR_P) $(@D)
+ $(AM_V_GEN)$(MSGFMT) -c -o $@ $<
+
+install-data-hook: install-mo
+install-mo: $(MOFILES)
+ for mo in $?; do \
+ lang=`expr "$$mo" : '.*/\(.*\)\.mo' \| "$$mo" : '\(.*\)\.mo'`; \
+ test x"$$lang" = x"" && exit 1; \
+ inst="$(DESTDIR)$(localedir)/$$lang/LC_MESSAGES"; \
+ set -x; \
+ $(MKDIR_P) "$$inst" || exit $$?; \
+ $(INSTALL_DATA) "$$mo" "$$inst/$(PACKAGE).mo" || exit $$?; \
+ set +x; \
+ done
+.PHONY: install-mo
+
# These are required to prevent the builtin lex/yacc rules from
# superseding ours...
src/scan.c src/scan.h: src/scan.stamp
AC_CONFIG_HEADER([config.h])
AC_CONFIG_MACRO_DIR([m4])
-AM_INIT_AUTOMAKE([-Wall -Werror foreign subdir-objects])
+AM_INIT_AUTOMAKE([-Wall foreign subdir-objects])
AM_SILENT_RULES([yes])
AC_PROG_CC_C99
LT_INIT
gl_INIT
+AM_GNU_GETTEXT([external])
+AM_GNU_GETTEXT_VERSION([0.18.1])
+DX_LINGUAS
+
AC_ARG_VAR([FLEX], [Command to invoke flex. Defaults to flex.])
AC_ARG_VAR([FLEXFLAGS], [Additional options to pass to flex.])
AC_CHECK_PROGS([FLEX], [flex], [flex])
00gnulib.m4
+codeset.m4
errno_h.m4
extensions.m4
+fcntl-o.m4
getdelim.m4
getline.m4
getopt.m4
+gettext.m4
+glibc2.m4
+glibc21.m4
gnulib-common.m4
gnulib-comp.m4
gnulib-tool.m4
+iconv.m4
include_next.m4
+intdiv0.m4
+intl.m4
+intldir.m4
+intlmacosx.m4
+intmax.m4
+inttypes-pri.m4
+inttypes_h.m4
+lcmessage.m4
lib-ld.m4
lib-link.m4
lib-prefix.m4
libtool.m4
+lock.m4
longlong.m4
ltoptions.m4
ltsugar.m4
lt~obsolete.m4
malloc.m4
multiarch.m4
+nls.m4
+po.m4
+printf-posix.m4
+progtest.m4
readline.m4
realloc.m4
+size_max.m4
stddef_h.m4
stdint.m4
+stdint_h.m4
stdio_h.m4
stdlib_h.m4
+threadlib.m4
+uintmax_t.m4
unistd_h.m4
+visibility.m4
warn-on-use.m4
wchar_t.m4
+wint_t.m4
+xsize.m4
# Specification in the form of a command-line invocation:
-# gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=. --no-conditional-dependencies --libtool --macro-prefix=gl --no-vc-files getopt-gnu readline
+# gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=. --no-conditional-dependencies --libtool --macro-prefix=gl --no-vc-files getopt-gnu gettext readline
# Specification in the form of a few gnulib-tool.m4 macro invocations:
gl_LOCAL_DIR([])
gl_MODULES([
getopt-gnu
+ gettext
readline
])
gl_AVOID([])
--- /dev/null
+dnl Copyright © 2011 Nick Bowler
+dnl
+dnl Computes the set of .po and .mo files based on the LINGUAS environment
+dnl variable. The variable POFILES is set to the complete list of .po files,
+dnl according to the LINGUAS file in the po directory. The variable MOFILES
+dnl is set to the list of .mo files that the user has requested be installed.
+dnl Both POFILES and MOFILES are AC_SUBSTed.
+dnl
+dnl License WTFPL2: Do What The Fuck You Want To Public License, version 2.
+dnl This is free software: you are free to do what the fuck you want to.
+dnl There is NO WARRANTY, to the extent permitted by law.
+
+AC_DEFUN([DX_LINGUAS], [dnl
+AC_REQUIRE([AM_GNU_GETTEXT])
+
+POFILES=
+MOFILES=
+
+if test -f "$srcdir/$POSUB/LINGUAS"; then
+ ALL_LINGUAS=`sed 's/#.*$//' "$srcdir/$POSUB/LINGUAS"`
+
+ : ${LINGUAS=all}
+ if test x"$LINGUAS" != x"all"; then
+ # Replicate la_CC-style codes as la.
+ LINGUAS=`printf '%s\n' "$LINGUAS" \
+ | [sed 's/\([^_[:space:]]*\)_[^[:space:]]*/& \1/g']`
+
+ printf '%s\n' $ALL_LINGUAS | sort > conftest.LINGUAS
+ LINGUAS=`printf '%s\n' $LINGUAS | sort \
+ | join - conftest.LINGUAS`
+ else
+ LINGUAS=$ALL_LINGUAS
+ fi
+
+ # Note: $srcdir is not used here because these variables are for make.
+ set x $ALL_LINGUAS; shift
+ case ${#} in
+ 0) ;;
+ *) POFILES=`printf "$POSUB/%s.po\n" "${@}"` ;;
+ esac
+
+ set x $LINGUAS; shift
+ case ${#} in
+ 0) ;;
+ *) MOFILES=`printf "$POSUB/%s.mo\n" "${@}"` ;;
+ esac
+fi
+
+AC_SUBST([POFILES])
+AC_SUBST([MOFILES])
+])
--- /dev/null
+*.pot
+*.mo
--- /dev/null
+# English translations for cdecl99 package.
+# This file is put in the public domain.
+# Nick Bowler <nbowler@draconx.ca>, 2011.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: cdecl99 0.1\n"
+"Report-Msgid-Bugs-To: nbowler@draconx.ca\n"
+"POT-Creation-Date: 2011-09-13 21:34-0400\n"
+"PO-Revision-Date: 2011-09-13 21:54-0400\n"
+"Last-Translator: Nick Bowler <nbowler@draconx.ca>\n"
+"Language-Team: English\n"
+"Language: en\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=2; plural=(n != 1);\n"
+
+#. TRANSLATORS: (C) must *always* be translated as ©.
+#: src/cdecl99.c:46
+msgid "(C)"
+msgstr "©"
#include <string.h>
#include <errno.h>
#include <getopt.h>
+#include <gettext.h>
#include "readline.h"
#include "cdecl.h"
static void print_version(void)
{
puts(PACKAGE_STRING);
- puts("Copyright (C) 2011 Nick Bowler.");
+ /* TRANSLATORS: (C) must *always* be translated as ©. */
+ printf("Copyright %s 2011 Nick Bowler.\n", gettext("(C)"));
puts("License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.");
puts("This is free software: you are free to change and redistribute it.");
puts("There is NO WARRANTY, to the extent permitted by law.");
if (argc > 0)
progname = argv[0];
+ /* Initialize gettext. */
+ setlocale(LC_ALL, "");
+ bindtextdomain(PACKAGE, LOCALEDIR);
+ textdomain(PACKAGE);
+
while ((opt = getopt_long(argc, argv, sopts, lopts, NULL)) != -1) {
switch (opt) {
case 'q':