Skip to content

Commit

Permalink
j4status: Always call setlocale()
Browse files Browse the repository at this point in the history
Also actually check for NLS support in configure.ac.

This makes GLib charset detection work and fix using UTF-8 in formats.
Thanks to Maciek Borzecki for this fix.

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
  • Loading branch information
sardemff7 committed Mar 29, 2015
1 parent f8d726e commit cba3cdf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE], ["$GETTEXT_PACKAGE"], [Gettext Package])
AC_SUBST(GETTEXT_PACKAGE)
dnl Not yet useful
dnl IT_PROG_INTLTOOL([0.40.0])
AM_GLIB_GNU_GETTEXT

AC_PROG_INSTALL

Expand Down
8 changes: 7 additions & 1 deletion main/src/j4status.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,14 @@
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif /* HAVE_UNISTD_H */
#ifdef HAVE_LOCALE_H
#include <locale.h>
#endif /* HAVE_LOCALE_H */

#include <glib.h>
#ifdef ENABLE_NLS
#include <glib/gi18n.h>
#endif /* ENABLE_NLS */
#include <glib-object.h>
#include <glib/gstdio.h>
#ifdef G_OS_UNIX
Expand Down Expand Up @@ -293,8 +299,8 @@ main(int argc, char *argv[])
g_setenv("G_MESSAGES_DEBUG", "all", FALSE);
#endif /* ! DEBUG */

#if ENABLE_NLS
setlocale(LC_ALL, "");
#ifdef ENABLE_NLS
bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR);
bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
#endif /* ENABLE_NLS */
Expand Down

0 comments on commit cba3cdf

Please # to comment.