Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add translation support
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
  • Loading branch information
David Woodhouse authored and David Woodhouse committed Sep 22, 2011
1 parent d8a12f5 commit 7d75b93
Show file tree
Hide file tree
Showing 9 changed files with 46 additions and 3 deletions.
9 changes: 9 additions & 0 deletions .gitignore
Expand Up @@ -7,3 +7,12 @@ version.c
openconnect
nm-openconnect-auth-dialog
Make.config
/po/Makefile
/po/Makefile.in
/po/Makefile.in.in
/po/*.gmo
/po/*.mo
/po/POTFILES
/po/.intltool-merge-cache
/po/stamp-it
/po/openconnect.pot
3 changes: 3 additions & 0 deletions Makefile.am
@@ -1,4 +1,7 @@

if USE_NLS
SUBDIRS = po
endif

lib_LTLIBRARIES = libopenconnect.la
bin_PROGRAMS = openconnect
Expand Down
1 change: 1 addition & 0 deletions autogen.sh
@@ -1,5 +1,6 @@
#!/bin/sh

intltoolize --force --copy --automake && \
aclocal && \
libtoolize --automake --copy --force && \
automake --foreign --add-missing && \
Expand Down
9 changes: 8 additions & 1 deletion configure.ac
Expand Up @@ -5,6 +5,13 @@ AC_LANG_C
AM_INIT_AUTOMAKE([foreign])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])

IT_PROG_INTLTOOL
AC_SUBST(GETTEXT_PACKAGE, [openconnect])
AM_CONDITIONAL(USE_NLS, [test "$USE_NLS" = "yes"])
if (test "$USE_NLS" = "yes"); then
AC_DEFINE(ENABLE_NLS, 1)
fi

AS_COMPILER_FLAGS(CFLAGS,
"-Wall
-Wextra
Expand Down Expand Up @@ -77,4 +84,4 @@ AC_CHECK_LIB(ssl, dtls1_stop_timer,
AC_DEFINE(HAVE_DTLS1_STOP_TIMER, [1], [OpenSSL has dtls1_stop_timer() function]),
,,${OPENSSL_LIBS})

AC_OUTPUT(Makefile openconnect.pc)
AC_OUTPUT(Makefile openconnect.pc po/Makefile.in)
5 changes: 5 additions & 0 deletions main.c
Expand Up @@ -236,6 +236,11 @@ int main(int argc, char **argv)
char *pidfile = NULL;
FILE *fp = NULL;

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

openconnect_init_openssl();

vpninfo = malloc(sizeof(*vpninfo));
Expand Down
7 changes: 6 additions & 1 deletion openconnect-internal.h
Expand Up @@ -39,7 +39,12 @@
#ifdef LIBPROXY_HDR
#include LIBPROXY_HDR
#endif

#ifdef ENABLE_NLS
#include <libintl.h>
#define _(s) gettext(s)
#else
#define _(s) s
#endif

/****************************************************************************/

Expand Down
3 changes: 2 additions & 1 deletion openconnect.html
Expand Up @@ -183,6 +183,7 @@ <H2>Release Notes / Changelog</H2>
<UL>
<LI><B>OpenConnect HEAD</B><BR>
<UL>
<LI>Add localisation support.</LI>
<LI>Fix build on Debian systems where <TT>dtls1_stop_timer()</TT> is not available.</LI>
<LI>Fix libproxy detection.</LI>
<LI>Enable a useful set of compiler warnings by default.</LI>
Expand Down Expand Up @@ -508,6 +509,6 @@ <H3>FreeBSD</H3>
<hr>
<address>David Woodhouse &lt;<A HREF="mailto:dwmw2@infradead.org">dwmw2@infradead.org</A>&gt;</address>
<!-- hhmts start -->
Last modified: Thu Sep 22 14:39:12 BST 2011
Last modified: Thu Sep 22 15:51:17 BST 2011
<!-- hhmts end -->
</body> </html>
Empty file added po/LINGUAS
Whitespace-only changes.
12 changes: 12 additions & 0 deletions po/POTFILES.in
@@ -0,0 +1,12 @@
# List of source files containing translatable strings.
# Please keep this list in alphabetic order.
[encoding: UTF-8]
auth.c
cstp.c
dtls.c
http.c
main.c
mainloop.c
ssl.c
tun.c
xml.c

0 comments on commit 7d75b93

Please sign in to comment.