Skip to content

Commit

Permalink
Call bindtextdomain() to ensure that translations are found in $(prefix)
Browse files Browse the repository at this point in the history
We may be installing to a location that libintl doesn't search by default.

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
  • Loading branch information
David Woodhouse authored and David Woodhouse committed Nov 24, 2011
1 parent 532b4cd commit 3b43fe1
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions Makefile.am
Expand Up @@ -11,6 +11,7 @@ lib_LTLIBRARIES = libopenconnect.la
sbin_PROGRAMS = openconnect
man8_MANS = openconnect.8

AM_CPPFLAGS = -DLOCALEDIR="\"$(localedir)\""
openconnect_SOURCES = xml.c main.c dtls.c cstp.c mainloop.c tun.c

openconnect_CFLAGS = $(OPENSSL_CFLAGS) $(LIBXML2_CFLAGS) $(LIBPROXY_CFLAGS) $(ZLIB_CFLAGS)
Expand Down
2 changes: 2 additions & 0 deletions configure.ac
Expand Up @@ -28,6 +28,7 @@ if test "$USE_NLS" = "yes"; then
#include <locale.h>
#include <libintl.h>],[
setlocale(LC_ALL, "");
bindtextdomain("openconnect", "/tmp");
(void)dgettext("openconnect", "foo");])],
[AC_MSG_RESULT(yes)],
[oldLIBS="$LIBS"
Expand All @@ -36,6 +37,7 @@ if test "$USE_NLS" = "yes"; then
#include <locale.h>
#include <libintl.h>],[
setlocale(LC_ALL, "");
bindtextdomain("openconnect", "/tmp");
(void)dgettext("openconnect", "foo");])],
[AC_MSG_RESULT(yes (with -lintl))]
LIBINTL="-lintl",
Expand Down
4 changes: 4 additions & 0 deletions library.c
Expand Up @@ -43,6 +43,10 @@ struct openconnect_info *openconnect_vpninfo_new_with_cbdata (char *useragent,
vpninfo->progress = progress;
vpninfo->cbdata = privdata?:vpninfo;

#ifdef ENABLE_NLS
bindtextdomain("openconnect", LOCALEDIR);
#endif

return vpninfo;
}

Expand Down
1 change: 1 addition & 0 deletions main.c
Expand Up @@ -247,6 +247,7 @@ int main(int argc, char **argv)
FILE *fp = NULL;

#ifdef ENABLE_NLS
bindtextdomain("openconnect", LOCALEDIR);
setlocale(LC_ALL, "");
#endif

Expand Down

0 comments on commit 3b43fe1

Please sign in to comment.