From 548a41a24d1fa675181585dbb186a51c1355354b Mon Sep 17 00:00:00 2001 From: Andrea Zagli Date: Sun, 6 Sep 2009 19:54:33 +0200 Subject: [PATCH] Initial support for i18n and l10n through gettext. --- .gitignore | 41 ++++++++++---------- ChangeLog | 14 +++++++ Makefile.am | 4 +- autogen.sh | 101 +++++++------------------------------------------ config.h.in | 18 +++++++++ configure.ac | 11 +++++- po/ChangeLog | 12 ++++++ po/POTFILES.in | 16 ++++++++ 8 files changed, 104 insertions(+), 113 deletions(-) create mode 100644 po/ChangeLog create mode 100644 po/POTFILES.in diff --git a/.gitignore b/.gitignore index ecd4e08..262a56b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,46 +1,43 @@ +*~ +*.rpath +*.pot +*.mo +*.gmo +*.o +*.lo +*.la +*.bak +*.stamp +*.tar.gz +*.pc +.libs +.deps +ABOUT-NLS INSTALL +Makefile Makefile.in +Makefile.in.in aclocal.m4 autom4te.cache/ config.guess -config.h.in~ config.log config.sub configure depcomp -docs/Makefile.in -docs/reference/Makefile.in gtk-doc.make install-sh ltmain.sh m4/ missing -src/Makefile.in -test/Makefile.in -Makefile config.h config.status -docs/Makefile -docs/reference/Makefile docs/reference/version.xml -docs/reference/.libs/ docs/reference/html/ docs/reference/xml/ -libgtkform.pc libtool -src/.deps/ -src/Makefile stamp-h1 -test/.deps/ -test/Makefile -*.o -*.lo -src/.libs/ -src/libgtkform.la -test/.libs/ test/test test/from_xml test/from_xml_with_db -*.bak -*.stamp -*.tar.gz +POTFILES +mkinstalldirs diff --git a/ChangeLog b/ChangeLog index 9819050..6f6fe9c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2009-09-06 gettextize + + * m4/gettext.m4: New file, from gettext-0.17. + * m4/iconv.m4: New file, from gettext-0.17. + * m4/lib-ld.m4: New file, from gettext-0.17. + * m4/lib-link.m4: New file, from gettext-0.17. + * m4/lib-prefix.m4: New file, from gettext-0.17. + * m4/nls.m4: New file, from gettext-0.17. + * m4/po.m4: New file, from gettext-0.17. + * m4/progtest.m4: New file, from gettext-0.17. + * Makefile.am (SUBDIRS): Add po. + (EXTRA_DIST): Add config.rpath. + * configure.ac (AC_CONFIG_FILES): Add po/Makefile.in. + commit 6fa9f1b3d2febf69b2cde145fca1b6af6db28e98 Author: Andrea Zagli Date: 2009-08-01 diff --git a/Makefile.am b/Makefile.am index 0e206f1..6946772 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,10 +1,10 @@ DISTCHECK_CONFIGURE_FLAGS = --enable-gtk-doc -SUBDIRS = src test docs data +SUBDIRS = po src test docs data ACLOCAL_AMFLAGS = -I m4 -EXTRA_DIST = libgtkform.pc.in +EXTRA_DIST = config.rpath libgtkform.pc.in pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = libgtkform.pc diff --git a/autogen.sh b/autogen.sh index 5db08f7..aa48604 100755 --- a/autogen.sh +++ b/autogen.sh @@ -1,98 +1,23 @@ -#!/bin/sh +#!/bin/bash # Run this to generate all the initial makefiles, etc. srcdir=`dirname $0` test -z "$srcdir" && srcdir=. -ORIGDIR=`pwd` -cd $srcdir -PROJECT=libgtkform -TEST_TYPE=-f -FILE=configure.ac +PKG_NAME="libgtkform" -DIE=0 - -have_libtool=false -if libtoolize --version < /dev/null > /dev/null 2>&1 ; then - libtool_version=`libtoolize --version | sed 's/^.*[ ]\([0-9.]*[a-z]*\).*$/\1/'` - case $libtool_version in - 2.*) - have_libtool=true - ;; - esac -fi -if $have_libtool ; then : ; else - echo - echo "You must have libtool >= 2 installed to compile $PROJECT." - echo "Install the appropriate package for your distribution," - echo "or get the source tarball at http://ftp.gnu.org/gnu/libtool/" - DIE=1 -fi - -(gtkdocize --version) < /dev/null > /dev/null 2>&1 || { - echo - echo "You must have gtk-doc installed to compile $PROJECT." - echo "Install the appropriate package for your distribution," - echo "or get the source tarball at http://ftp.gnome.org/pub/GNOME/sources/gtk-doc/" - DIE=1 +(test -f $srcdir/configure.ac \ + && test -d $srcdir/src \ + && test -f $srcdir/src/form.h) || { + echo -n "**Error**: Directory "\`$srcdir\'" does not look like the" + echo " top-level libgtkform directory" + exit 1 } -(autoconf --version) < /dev/null > /dev/null 2>&1 || { - echo - echo "You must have autoconf installed to compile $PROJECT." - echo "Install the appropriate package for your distribution," - echo "or get the source tarball at http://ftp.gnu.org/gnu/autoconf/" - DIE=1 +which gnome-autogen.sh || { + echo "You need to install gnome-common from GNOME and make" + echo "sure the gnome-autogen.sh script is in your \$PATH." + exit 1 } -if automake --version < /dev/null > /dev/null 2>&1 ; then - AUTOMAKE=automake - ACLOCAL=aclocal -else - echo - echo "You must have automake 1.7.x installed to compile $PROJECT." - echo "Install the appropriate package for your distribution," - echo "or get the source tarball at http://ftp.gnu.org/gnu/automake/" - DIE=1 -fi - -if test "$DIE" -eq 1; then - exit 1 -fi - -test $TEST_TYPE $FILE || { - echo "You must run this script in the top-level $PROJECT directory" - exit 1 -} - -if test -z "$AUTOGEN_SUBDIR_MODE"; then - if test -z "$*"; then - echo "I am going to run ./configure with no arguments - if you wish " - echo "to pass any to it, please specify them on the $0 command line." - fi -fi - -rm -rf autom4te.cache - -# README and INSTALL are required by automake, but may be deleted by clean -# up rules. to get automake to work, simply touch these here, they will be -# regenerated from their corresponding *.in files by ./configure anyway. -touch README INSTALL - -$ACLOCAL || exit $? - -libtoolize --force || exit $? -gtkdocize || exit $? - -autoheader || exit $? - -$AUTOMAKE --add-missing || exit $? -autoconf || exit $? -cd $ORIGDIR || exit $? - -if test -z "$AUTOGEN_SUBDIR_MODE"; then - $srcdir/configure --enable-maintainer-mode $AUTOGEN_CONFIGURE_ARGS "$@" || exit $? - - echo - echo "Now type 'make' to compile $PROJECT." -fi +USE_GNOME2_MACROS=1 . gnome-autogen.sh diff --git a/config.h.in b/config.h.in index 4388cd2..6299cd3 100644 --- a/config.h.in +++ b/config.h.in @@ -1,11 +1,29 @@ /* config.h.in. Generated from configure.ac by autoheader. */ +/* always defined to indicate that i18n is enabled */ +#undef ENABLE_NLS + +/* The prefix for our gettext translation domains. */ +#undef GETTEXT_PACKAGE + +/* Define to 1 if you have the `bind_textdomain_codeset' function. */ +#undef HAVE_BIND_TEXTDOMAIN_CODESET + +/* Define to 1 if you have the `dcgettext' function. */ +#undef HAVE_DCGETTEXT + /* Define to 1 if you have the header file. */ #undef HAVE_DLFCN_H +/* Define if the GNU gettext() function is already present or preinstalled. */ +#undef HAVE_GETTEXT + /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H +/* Define if your file defines LC_MESSAGES. */ +#undef HAVE_LC_MESSAGES + /* Define to 1 if you have the `localeconv' function. */ #undef HAVE_LOCALECONV diff --git a/configure.ac b/configure.ac index 3557fcc..6a43099 100644 --- a/configure.ac +++ b/configure.ac @@ -28,6 +28,15 @@ AC_PROG_LIBTOOL GTK_DOC_CHECK +dnl ****************************** +dnl Translations +dnl ****************************** +GETTEXT_PACKAGE=libgtkform +AC_SUBST(GETTEXT_PACKAGE) +AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", + [The prefix for our gettext translation domains.]) +AM_GLIB_GNU_GETTEXT + # Checks for libraries. PKG_CHECK_MODULES(GTKFORM, [gtk+-2.0 >= 2.12.0 libxml-2.0 >= 2.0.0 @@ -49,7 +58,7 @@ AC_FUNC_STRTOD AC_FUNC_MALLOC # Checks for library functions. -AC_CONFIG_FILES([ +AC_CONFIG_FILES([ po/Makefile.in libgtkform.pc Makefile src/Makefile diff --git a/po/ChangeLog b/po/ChangeLog new file mode 100644 index 0000000..a63c00b --- /dev/null +++ b/po/ChangeLog @@ -0,0 +1,12 @@ +2009-09-06 gettextize + + * Makefile.in.in: New file, from gettext-0.17. + * boldquot.sed: New file, from gettext-0.17. + * en@boldquot.header: New file, from gettext-0.17. + * en@quot.header: New file, from gettext-0.17. + * insert-header.sin: New file, from gettext-0.17. + * quot.sed: New file, from gettext-0.17. + * remove-potcdate.sin: New file, from gettext-0.17. + * Rules-quot: New file, from gettext-0.17. + * POTFILES.in: New file. + diff --git a/po/POTFILES.in b/po/POTFILES.in new file mode 100644 index 0000000..efb956a --- /dev/null +++ b/po/POTFILES.in @@ -0,0 +1,16 @@ +# List of source files which contain translatable strings. +src/fieldboolean.c +src/field.c +src/fielddatetime.c +src/fieldfloat.c +src/fieldinteger.c +src/fieldtext.c +src/form.c +src/key.c +src/widget.c +src/widgetcheck.c +src/widgetcombobox.c +src/widgetentry.c +src/widgetlabel.c +src/widgetspin.c +src/widgettextview.c -- 2.49.0