[libsoup] Add gettext support
- From: Dan Winship <danw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libsoup] Add gettext support
- Date: Tue, 17 Apr 2012 13:59:16 +0000 (UTC)
commit 02dcd6378070347f2b3cc59a82e79e60afa0583d
Author: Dan Winship <danw gnome org>
Date: Thu Apr 12 20:17:06 2012 -0400
Add gettext support
There were already error messages in soup-request.c and
soup-requester.c marked for translation, and we'll be adding more
soon.
.gitignore | 8 ++++++--
Makefile.am | 2 +-
configure.ac | 11 +++++++++++
libsoup/Makefile.am | 1 +
libsoup/soup-request.c | 2 +-
libsoup/soup-requester.c | 2 +-
libsoup/soup-session.c | 15 ++++++++++++++-
po/POTFILES.in | 2 ++
tests/test-utils.c | 2 ++
9 files changed, 39 insertions(+), 6 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 8d77197..111bffd 100644
--- a/.gitignore
+++ b/.gitignore
@@ -50,11 +50,15 @@ libsoup/SoupGNOME-2.4.typelib
libtool
ltmain.sh
m4/gtk-doc.m4
+m4/intltool.m4
m4/libtool.m4
m4/lt*.m4
missing
-python/COPYING
-python/m4
+mkinstalldirs
+po/libsoup.pot
+po/Makefile.in.in
+po/POTFILES
+po/stamp-it
stamp-h1
tests/*-test
tests/date
diff --git a/Makefile.am b/Makefile.am
index 8b86fb7..6b9c6a8 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,7 +1,7 @@
## Process this file with automake to produce Makefile.in
ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
-SUBDIRS = libsoup tests docs
+SUBDIRS = libsoup po tests docs
EXTRA_DIST = \
libsoup-2.4.pc.in \
diff --git a/configure.ac b/configure.ac
index 4ff639e..84d3ec6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -103,6 +103,15 @@ esac
AC_MSG_RESULT([$os_win32])
AM_CONDITIONAL(OS_WIN32, [test $os_win32 = yes])
+dnl ************************
+dnl *** gettext/intltool ***
+dnl ************************
+IT_PROG_INTLTOOL([0.35.0])
+GETTEXT_PACKAGE=libsoup
+AC_SUBST([GETTEXT_PACKAGE])
+AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],["$GETTEXT_PACKAGE"],[The gettext domain name])
+AM_GLIB_GNU_GETTEXT
+
dnl *******************
dnl *** Misc checks ***
dnl *******************
@@ -347,6 +356,8 @@ AC_CONFIG_FILES([
Makefile
libsoup-zip
libsoup/Makefile
+ po/Makefile.in
+ po/Makefile
tests/Makefile
tests/httpd.conf
docs/Makefile
diff --git a/libsoup/Makefile.am b/libsoup/Makefile.am
index aa13eec..2b36a86 100644
--- a/libsoup/Makefile.am
+++ b/libsoup/Makefile.am
@@ -8,6 +8,7 @@ endif
INCLUDES = \
-DG_LOG_DOMAIN=\"libsoup\" \
+ -DLOCALEDIR=\"$(localedir)\" \
-I$(top_srcdir) \
$(SOUP_DEBUG_FLAGS) \
$(SOUP_MAINTAINER_FLAGS) \
diff --git a/libsoup/soup-request.c b/libsoup/soup-request.c
index 06fe7ff..5e97841 100644
--- a/libsoup/soup-request.c
+++ b/libsoup/soup-request.c
@@ -25,7 +25,7 @@
#include <config.h>
#endif
-#include <glib/gi18n.h>
+#include <glib/gi18n-lib.h>
#define LIBSOUP_USE_UNSTABLE_REQUEST_API
diff --git a/libsoup/soup-requester.c b/libsoup/soup-requester.c
index d71d447..5897ed2 100644
--- a/libsoup/soup-requester.c
+++ b/libsoup/soup-requester.c
@@ -22,7 +22,7 @@
#include "config.h"
-#include <glib/gi18n.h>
+#include <glib/gi18n-lib.h>
#define LIBSOUP_USE_UNSTABLE_REQUEST_API
diff --git a/libsoup/soup-session.c b/libsoup/soup-session.c
index 2cfcc27..fa95f7e 100644
--- a/libsoup/soup-session.c
+++ b/libsoup/soup-session.c
@@ -13,6 +13,8 @@
#include <string.h>
#include <stdlib.h>
+#include <glib/gi18n-lib.h>
+
#include "soup-auth.h"
#include "soup-auth-basic.h"
#include "soup-auth-digest.h"
@@ -58,6 +60,15 @@
* #SoupSessionSync.
**/
+static void
+soup_init (void)
+{
+ bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
+#ifdef HAVE_BIND_TEXTDOMAIN_CODESET
+ bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+#endif
+}
+
typedef struct {
SoupURI *uri;
SoupAddress *addr;
@@ -132,7 +143,9 @@ static void auth_manager_authenticate (SoupAuthManager *manager,
#define SOUP_SESSION_USER_AGENT_BASE "libsoup/" PACKAGE_VERSION
-G_DEFINE_ABSTRACT_TYPE (SoupSession, soup_session, G_TYPE_OBJECT)
+G_DEFINE_ABSTRACT_TYPE_WITH_CODE (SoupSession, soup_session, G_TYPE_OBJECT,
+ soup_init ();
+ )
enum {
REQUEST_QUEUED,
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..c43b943
--- /dev/null
+++ b/po/POTFILES.in
@@ -0,0 +1,2 @@
+libsoup/soup-request.c
+libsoup/soup-requester.c
diff --git a/tests/test-utils.c b/tests/test-utils.c
index 47f1db0..fee671a 100644
--- a/tests/test-utils.c
+++ b/tests/test-utils.c
@@ -5,6 +5,7 @@
#include "test-utils.h"
#include "libsoup/soup.h"
+#include <locale.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
@@ -81,6 +82,7 @@ test_init (int argc, char **argv, GOptionEntry *entries)
GError *error = NULL;
GTlsBackend *tls_backend;
+ setlocale (LC_ALL, "");
g_type_init ();
name = strrchr (argv[0], '/');
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]