Bug 628883 — Add localisation support
authorPhilip Withnall <philip.withnall@collabora.co.uk>
Mon, 6 Sep 2010 13:32:16 +0000 (14:32 +0100)
committerTravis Reitter <travis.reitter@collabora.co.uk>
Thu, 4 Nov 2010 16:21:00 +0000 (09:21 -0700)
Add gettext/intltool build system support, but don't mark any strings for
translation yet. Helps: bgo#628883

Makefile.am
autogen.sh
configure.ac
folks/build-conf.vapi
po/LINGUAS [new file with mode: 0644]
po/POTFILES.in [new file with mode: 0644]
po/POTFILES.skip [new file with mode: 0644]
tools/Makefile.am
tools/import.vala

index 5f0a32a..dc8f8b1 100644 (file)
@@ -5,6 +5,7 @@ SUBDIRS = \
        backends \
        tests \
        tools \
+       po \
        $(NULL)
 
 if ENABLE_DOCS
index 5b32d48..2886af5 100755 (executable)
@@ -15,6 +15,8 @@ elif automake-1.11 --version >/dev/null 2>/dev/null && \
 fi
 
 autoreconf -i -f
+autopoint --force || exit $?
+intltoolize --force --copy --automake
 
 run_configure=true
 for arg in $*; do
index d748a89..7dc8135 100644 (file)
@@ -149,6 +149,17 @@ AS_IF([test "x$enable_docs" != xno],
              [AC_MSG_ERROR([valadoc not found])])])
 
 # -----------------------------------------------------------
+# Gettext
+# -----------------------------------------------------------
+
+GETTEXT_PACKAGE=AC_PACKAGE_NAME
+AC_SUBST(GETTEXT_PACKAGE)
+AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, ["$GETTEXT_PACKAGE"], [Define the gettext package to be used])
+AM_GNU_GETTEXT_VERSION([0.17])
+AM_GNU_GETTEXT([external])
+IT_PROG_INTLTOOL([0.35.0])
+
+# -----------------------------------------------------------
 # Error flags
 # -----------------------------------------------------------
 
@@ -218,6 +229,7 @@ AC_CONFIG_FILES([
     backends/telepathy/lib/Makefile
     folks/Makefile
     docs/Makefile
+    po/Makefile.in
     tests/Makefile
     tests/folks/Makefile
     tests/key-file/Makefile
index 41793c7..82c36c3 100644 (file)
@@ -38,4 +38,10 @@ public class Folks.BuildConf
 
   [CCode (cname = "PACKAGE_STRING")]
   public static const string PACKAGE_STRING;
+
+  [CCode (cname = "GETTEXT_PACKAGE")]
+  public static const string GETTEXT_PACKAGE;
+
+  [CCode (cname = "LOCALE_DIR")]
+  public static const string LOCALE_DIR;
 }
diff --git a/po/LINGUAS b/po/LINGUAS
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/po/POTFILES.in b/po/POTFILES.in
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/po/POTFILES.skip b/po/POTFILES.skip
new file mode 100644 (file)
index 0000000..e69de29
index a538a99..17ab8e7 100644 (file)
@@ -2,11 +2,17 @@ if ENABLE_IMPORT_TOOL
 bin_PROGRAMS = folks-import
 endif
 
+AM_CPPFLAGS = \
+       -include $(CONFIG_HEADER) \
+       -DLOCALE_DIR=\"$(pkgdatadir)/locale\" \
+       $(NULL)
+
 VALAFLAGS = \
        --vapidir=$(top_builddir)/folks \
        --pkg=gee-1.0 \
        --pkg=libxml-2.0 \
        --pkg=folks \
+       --pkg=build-conf \
        $(NULL)
 
 folks_import_SOURCES = \
index 451290f..7e060c3 100644 (file)
@@ -48,6 +48,9 @@ public class Folks.ImportTool : Object
 
   public static int main (string[] args)
     {
+      Intl.bindtextdomain (BuildConf.GETTEXT_PACKAGE, BuildConf.LOCALE_DIR);
+      Intl.textdomain (BuildConf.GETTEXT_PACKAGE);
+
       OptionContext context = new OptionContext ("— import meta-contact " +
           "information to libfolks");
       context.add_main_entries (ImportTool.options, "folks");