aboutsummaryrefslogtreecommitdiff
path: root/src/util/os_installation.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/os_installation.c')
-rw-r--r--src/util/os_installation.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/util/os_installation.c b/src/util/os_installation.c
index 9dcfa5ef1..f51bfd287 100644
--- a/src/util/os_installation.c
+++ b/src/util/os_installation.c
@@ -64,6 +64,9 @@ static const struct GNUNET_OS_ProjectData default_pd = {
64 .homepage = "http://www.gnu.org/s/gnunet/", 64 .homepage = "http://www.gnu.org/s/gnunet/",
65 .config_file = "gnunet.conf", 65 .config_file = "gnunet.conf",
66 .user_config_file = "~/.config/gnunet.conf", 66 .user_config_file = "~/.config/gnunet.conf",
67 .is_gnu = 1,
68 .gettext_domain = PACKAGE,
69 .gettext_path = NULL,
67}; 70};
68 71
69/** 72/**
@@ -73,6 +76,13 @@ static const struct GNUNET_OS_ProjectData default_pd = {
73static const struct GNUNET_OS_ProjectData *current_pd = &default_pd; 76static const struct GNUNET_OS_ProjectData *current_pd = &default_pd;
74 77
75/** 78/**
79 * Wether or not gettext has been initialized for the library.
80 * Note that the gettext initialization done within
81 * GNUNET_PROGRAM_run2 is for the specific application.
82 */
83static int gettextinit = 0;
84
85/**
76 * Return default project data used by 'libgnunetutil' for GNUnet. 86 * Return default project data used by 'libgnunetutil' for GNUnet.
77 */ 87 */
78const struct GNUNET_OS_ProjectData * 88const struct GNUNET_OS_ProjectData *
@@ -88,6 +98,14 @@ GNUNET_OS_project_data_default (void)
88const struct GNUNET_OS_ProjectData * 98const struct GNUNET_OS_ProjectData *
89GNUNET_OS_project_data_get () 99GNUNET_OS_project_data_get ()
90{ 100{
101 if (0 == gettextinit)
102 {
103 char *path = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_LOCALEDIR);
104 if (NULL != path)
105 BINDTEXTDOMAIN (PACKAGE, path);
106 GNUNET_free(path);
107 gettextinit = 1;
108 }
91 return current_pd; 109 return current_pd;
92} 110}
93 111
@@ -100,6 +118,14 @@ GNUNET_OS_project_data_get ()
100void 118void
101GNUNET_OS_init (const struct GNUNET_OS_ProjectData *pd) 119GNUNET_OS_init (const struct GNUNET_OS_ProjectData *pd)
102{ 120{
121 if (0 == gettextinit)
122 {
123 char *path = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_LOCALEDIR);
124 if (NULL != path)
125 BINDTEXTDOMAIN (PACKAGE, path);
126 GNUNET_free(path);
127 gettextinit = 1;
128 }
103 GNUNET_assert (NULL != pd); 129 GNUNET_assert (NULL != pd);
104 current_pd = pd; 130 current_pd = pd;
105} 131}