[Xfce4-commits] <terminal:master> Initialize locale for console warnings.

Nick Schermer noreply at xfce.org
Wed Dec 26 01:18:02 CET 2012


Updating branch refs/heads/master
         to de3e1c70cc532ff04f0a40d0100ac73f0fb80be2 (commit)
       from 80920c79cf60bd44c6262ac3e385a0c4d5cad2b0 (commit)

commit de3e1c70cc532ff04f0a40d0100ac73f0fb80be2
Author: Nick Schermer <nick at xfce.org>
Date:   Wed Dec 26 01:17:24 2012 +0100

    Initialize locale for console warnings.

 configure.ac.in |    2 +-
 terminal/main.c |   13 ++++++++++---
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/configure.ac.in b/configure.ac.in
index 8b18c25..0f7bbcb 100644
--- a/configure.ac.in
+++ b/configure.ac.in
@@ -66,7 +66,7 @@ AC_PROG_LIBTOOL()
 dnl **********************************
 dnl *** Check for standard headers ***
 dnl **********************************
-AC_CHECK_HEADERS([ctype.h errno.h limits.h pwd.h signal.h time.h unistd.h])
+AC_CHECK_HEADERS([ctype.h errno.h limits.h pwd.h signal.h time.h unistd.h locale.h stdlib.h])
 
 dnl ******************************
 dnl *** Check for i18n support ***
diff --git a/terminal/main.c b/terminal/main.c
index 5f23bf0..f4a400b 100644
--- a/terminal/main.c
+++ b/terminal/main.c
@@ -25,7 +25,12 @@
 #ifdef HAVE_SIGNAL_H
 #include <signal.h>
 #endif
+#ifdef HAVE_LOCALE_H
+#include <locale.h>
+#endif
+#ifdef HAVE_STDLIB_H
 #include <stdlib.h>
+#endif
 
 #include <terminal/terminal-app.h>
 #include <terminal/terminal-private.h>
@@ -171,6 +176,11 @@ main (int argc, char **argv)
   signal (SIGPIPE, SIG_IGN);
 
   xfce_textdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR, "UTF-8");
+
+  /* initializes internationalization support */
+  if (setlocale (LC_ALL, "") == NULL)
+    g_warning ("Locale not supported by C library.");
+
   g_set_application_name (_("Xfce Terminal"));
 
 #ifdef G_ENABLE_DEBUG
@@ -185,9 +195,6 @@ main (int argc, char **argv)
 
   if (G_UNLIKELY (show_version))
     {
-      /* set locale for the translations below */
-      gtk_set_locale ();
-
       g_print ("%s %s (Xfce %s)\n\n", PACKAGE_NAME, PACKAGE_VERSION, xfce_version_string ());
       g_print ("%s\n", "Copyright (c) 2003-2012");
       g_print ("\t%s\n\n", _("The Xfce development team. All rights reserved."));


More information about the Xfce4-commits mailing list