[folks] Bug 628883 — Add localisation support



commit affa69029fe409b60de0fdf1bef7429c51c2907b
Author: Philip Withnall <philip withnall collabora co uk>
Date:   Mon Sep 6 14:32:16 2010 +0100

    Bug 628883 â?? Add localisation support
    
    Add gettext/intltool build system support, but don't mark any strings for
    translation yet. Helps: bgo#628883

 Makefile.am           |    1 +
 autogen.sh            |    2 ++
 configure.ac          |   12 ++++++++++++
 folks/build-conf.vapi |    6 ++++++
 tools/Makefile.am     |    6 ++++++
 tools/import.vala     |    3 +++
 6 files changed, 30 insertions(+), 0 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 5f0a32a..dc8f8b1 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -5,6 +5,7 @@ SUBDIRS = \
 	backends \
 	tests \
 	tools \
+	po \
 	$(NULL)
 
 if ENABLE_DOCS
diff --git a/autogen.sh b/autogen.sh
index 5b32d48..2886af5 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -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
diff --git a/configure.ac b/configure.ac
index d748a89..7dc8135 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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
diff --git a/folks/build-conf.vapi b/folks/build-conf.vapi
index 41793c7..82c36c3 100644
--- a/folks/build-conf.vapi
+++ b/folks/build-conf.vapi
@@ -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
index 0000000..e69de29
diff --git a/po/POTFILES.in b/po/POTFILES.in
new file mode 100644
index 0000000..e69de29
diff --git a/po/POTFILES.skip b/po/POTFILES.skip
new file mode 100644
index 0000000..e69de29
diff --git a/tools/Makefile.am b/tools/Makefile.am
index a538a99..17ab8e7 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -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 = \
diff --git a/tools/import.vala b/tools/import.vala
index 451290f..7e060c3 100644
--- a/tools/import.vala
+++ b/tools/import.vala
@@ -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");



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]