aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSchanzenbach, Martin <mschanzenbach@posteo.de>2019-09-01 13:26:01 +0200
committerSchanzenbach, Martin <mschanzenbach@posteo.de>2019-09-01 13:26:01 +0200
commit394dd1a50989a7096511a604ff0d8a0a7f8a5fe2 (patch)
treedd36141ea30e75fec402fe58bf480fff21cf9080
parentdca05d8804fa5de0db1694d2ecb31f8a3075d901 (diff)
downloadgnunet-ext-394dd1a50989a7096511a604ff0d8a0a7f8a5fe2.tar.gz
gnunet-ext-394dd1a50989a7096511a604ff0d8a0a7f8a5fe2.zip
Added patch by AV from ML
Currently, gettext doesn't work for out-of-tree applications. This is because GNUnet forcibly set the text domain to "GNUnet" (which apparently is also incorrect), so applications can't be localized unless their localizations are distributed in-tree by GNUnet itself. The attached patch tries to fix this by adding two more fields to GNUNET_OS_ProjectData: one field is the gettext domain of the application. As the documentation says, if it's NULL gettext is disabled so that applications can use their preferred localization method without having gettext interfering; the other field is essentially the locale directory, so applications can specify a different path if they want to, instead of having GNUnet infer it for them. Because some GNUnet libraries also use gettext internally (the util lib is a prominent example), gettext has to be initialized before the application takes over. I placed such initialization in `GNUNET_OS_init' and `GNUNET_OS_project_data_get' because those are two functions which are very likely to be called (especially the second one, since it's used in `GNUNET_PROGRAM_run2'.) If there is a better place (or some places where this is not enough) I can change it and resubmit it for review. I also changed gnunet-ext to keep it consitent with the patch. In particular, it adds a header which is required for a successful compilation, so you might want to at least make that change. Thank you, A.V. P.S. I'm still not subscribed to the list... yet.
-rw-r--r--src/ext/gnunet-ext.c6
-rw-r--r--src/ext/gnunet-service-ext.c4
-rw-r--r--src/ext/test_ext_api.c4
3 files changed, 14 insertions, 0 deletions
diff --git a/src/ext/gnunet-ext.c b/src/ext/gnunet-ext.c
index f18e351..00195e0 100644
--- a/src/ext/gnunet-ext.c
+++ b/src/ext/gnunet-ext.c
@@ -34,6 +34,10 @@
34#define SOCKTYPE int 34#define SOCKTYPE int
35#endif 35#endif
36 36
37#if HAVE_NETINET_IN_H
38#include <netinet/in.h>
39#endif
40
37#include <gnunet/gettext.h> 41#include <gnunet/gettext.h>
38#include <gnunet/gnunet_util_lib.h> 42#include <gnunet/gnunet_util_lib.h>
39#include "gnunet_ext_service.h" 43#include "gnunet_ext_service.h"
@@ -56,6 +60,8 @@ static const struct GNUNET_OS_ProjectData gnunetext_pd =
56 .user_config_file = "~/.config/gnunet-ext.conf", 60 .user_config_file = "~/.config/gnunet-ext.conf",
57 .version = "1.0", 61 .version = "1.0",
58 .is_gnu = 1, 62 .is_gnu = 1,
63 .gettext_domain = PACKAGE,
64 .gettext_path = NULL,
59 }; 65 };
60 66
61/** 67/**
diff --git a/src/ext/gnunet-service-ext.c b/src/ext/gnunet-service-ext.c
index aa43933..4ebcdf2 100644
--- a/src/ext/gnunet-service-ext.c
+++ b/src/ext/gnunet-service-ext.c
@@ -34,6 +34,10 @@
34#define SOCKTYPE int 34#define SOCKTYPE int
35#endif 35#endif
36 36
37#if HAVE_NETINET_IN_H
38#include <netinet/in.h>
39#endif
40
37#include <gnunet/gnunet_util_lib.h> 41#include <gnunet/gnunet_util_lib.h>
38#include "gnunet_protocols_ext.h" 42#include "gnunet_protocols_ext.h"
39 43
diff --git a/src/ext/test_ext_api.c b/src/ext/test_ext_api.c
index e69dca0..6a95d04 100644
--- a/src/ext/test_ext_api.c
+++ b/src/ext/test_ext_api.c
@@ -32,6 +32,10 @@
32#define SOCKTYPE int 32#define SOCKTYPE int
33#endif 33#endif
34 34
35#if HAVE_NETINET_IN_H
36#include <netinet/in.h>
37#endif
38
35#include <gnunet/gnunet_util_lib.h> 39#include <gnunet/gnunet_util_lib.h>
36#include "gnunet_ext_service.h" 40#include "gnunet_ext_service.h"
37 41