An Internationalized Software Project With Auto Tools | ||
---|---|---|
Prev | Adding gettext Support | Next |
# gettextize Creating po/ subdirectory Symlinking file ABOUT-NLS Symlinking file config.rpath Symlinking file mkinstalldirs Not copying intl/ directory. Symlinking file po/Makefile.in.in ... Symlinking file po/remove-potcdate.sin Creating initial po/POTFILES.in Creating po/ChangeLog Creating directory m4 Symlinking file m4/codeset.m4 ... Symlinking file m4/xsize.m4 Creating m4/Makefile.am Creating m4/ChangeLog Updating Makefile.am (backup is in Makefile.am~) Updating configure.ac (backup is in configure.ac~) Adding an entry to ChangeLog (backup is in ChangeLog~) Please use AM_GNU_GETTEXT([external]) in order to cause autoconfiguration to look for an external libintl. Please create po/Makevars from the template in po/Makevars.template. You can then remove po/Makevars.template. Please fill po/POTFILES.in as described in the documentation. Please run 'aclocal -I m4' to regenerate the aclocal.m4 file. You need aclocal from GNU automake 1.5 (or newer) to do this. Then run 'autoconf' to regenerate the configure file. Please run 'automake m4/Makefile' to create m4/Makefile.in You might also want to copy the convenience header file gettext.h from the /usr/local/share/gettext directory into your package. It is a wrapper around |
Makefile.am |
SUBDIRS = src po ACLOCAL_AMFLAGS = -I m4 EXTRA_DIST = config.rpath mkinstalldirs m4/Makefile.in src/gettext.h check-gettext: @if test x$(USE_NLS) != "xyes" ; then echo "Missing gettext. Rerun configure and check for" \ "'checking whether to use NLS... yes'!" ; exit 1 ; fi update-po: check-gettext @find $(srcdir)/src/ -name "*.cpp" -print | sort > $(srcdir)/po/POTFILES.in.2 ; \ if diff $(srcdir)/po/POTFILES.in $(srcdir)/po/POTFILES.in.2 >/dev/null 2>&1 ; then \ rm -f $(srcdir)/po/POTFILES.in.2 ; \ else \ mv $(srcdir)/po/POTFILES.in.2 $(srcdir)/po/POTFILES.in ; \ fi cd po && $(MAKE) $(AM_MAKEFLAGS) update-po update-gmo: check-gettext cd po && $(MAKE) $(AM_MAKEFLAGS) update-gmo force-update-gmo: check-gettext touch po/*.po cd po && $(MAKE) $(AM_MAKEFLAGS) update-gmo force-update-gmo-%: check-gettext @language=`echo $@ | sed s/force-update-gmo-//` ; \ if test ! -f po/$$language.po ; then echo "file po/$$language.po does not exist" ; exit 1 ; fi ; \ touch po/$$language.po ; \ cd po && $(MAKE) $(AM_MAKEFLAGS) update-gmo .PHONY: check-gettext update-po update-gmo force-update-gmo |
configure.ac |
AC_PREREQ(2.59) AC_INIT(testproj, 0.1, j.t.kirk@ncc-1701.ufp) AC_CONFIG_SRCDIR([src/main.cpp]) AC_CONFIG_HEADER([config.h]) AM_INIT_AUTOMAKE AC_LIBTOOL_DLOPEN AC_PROG_LIBTOOL AM_GNU_GETTEXT([external]) # Checks for programs. AC_PROG_CXX AC_PROG_CC # Checks for libraries. # Checks for header files. # Checks for typedefs, structures, and compiler characteristics. # Checks for library functions. AC_CONFIG_FILES([Makefile src/Makefile src/testmodule/Makefile po/Makefile.in m4/Makefile]) AC_OUTPUT |
# cp po/Makevars.template po/Makevars |
po/Makevars |
... # These options get passed to xgettext. XGETTEXT_OPTIONS = --keyword=i18n --keyword=i18nM --keyword=i18nP:1,2 ... COPYRIGHT_HOLDER = James T. ... MSGID_BUGS_ADDRESS = j.t.kirk@ncc-1701.ufp ... |
# ${ACLOCAL} -I m4 ... lots of warnings # ${AUTOMAKE} m4/Makefile # ln -s /usr/local/share/gettext/gettext.h src |
src/Makefile.am |
SUBDIRS = testmodule bin_PROGRAMS = testproj testproj_SOURCES = main.cpp noinst_HEADERS = testproj.h i18n.h testproj_LDADD = $(top_srcdir)/src/testmodule/libtestmodule.a testproj_LDFLAGS = $(LTLIBINTL) localedir = $(datadir)/locale DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@ |
# touch src/i18n.h |
src/i18n.h |
#include "../config.h" #include "gettext.h" #define i18n(x) gettext(x) |
src/testmodule/testfunc.cpp |
#include <stdio.h> #include "testfunc.h" #include "../i18n.h" void printMessage() { printf(i18n("hello world!\n")); printf(i18n("Press a key\n")); getchar(); } |
src/main.cpp |
#include <locale.h> #include "testmodule/testfunc.h" #include "i18n.h" int main(int) { // initialize gettext setlocale (LC_ALL, ""); bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); printMessage(); } |
# gmake ... checking whether to use NLS... yes ... |
createFromCvs.freebsd |
#!/bin/sh libtoolize ln -s /usr/local/share/libtool/libltdl/acinclude.m4 acinclude.m4 cp configure.ac configure.ac~ cp Makefile.am Makefile.am~ gettextize mv configure.ac~ configure.ac mv Makefile.am~ Makefile.am ${ACLOCAL} -I m4 ${AUTOHEADER} ${AUTOCONF} ${AUTOMAKE} --add-missing ${AUTOMAKE} m4/Makefile ln -s /usr/local/share/gettext/gettext.h src |
createFromCvs.gentoo |
#!/bin/sh libtoolize ln -s /usr/share/libtool/libltdl/acinclude.m4 acinclude.m4 cp configure.ac configure.ac~ cp Makefile.am Makefile.am~ gettextize touch m4/Makefile.am touch mkinstalldirs mv configure.ac~ configure.ac mv Makefile.am~ Makefile.am aclocal -I m4 autoheader autoconf automake --add-missing automake m4/Makefile ln -s /usr/share/gettext/gettext.h src |
Prev | Home | Next |
gettext Overview | Using gettext |