Set the LC_NUMERIC locale category on startup.
authorJohn Darrington <john@darrington.wattle.id.au>
Mon, 10 Dec 2012 17:32:25 +0000 (18:32 +0100)
committerJohn Darrington <john@darrington.wattle.id.au>
Wed, 26 Dec 2012 12:15:04 +0000 (13:15 +0100)
Previously, for rather unsatisfactory reasons, pspp and psppire set all locale
categories except LC_NUMERIC.  The reasons for doing this have now been
resolved.  So this change sets all locale categories including LC_NUMERIC.

src/libpspp/i18n.c

index 0819299d37abaae54e4f666f046e798818c53a7a..754c9321f3c25b0638c62eb7f229fb2d1f217fe3 100644 (file)
@@ -545,12 +545,7 @@ recode_substring_pool (const char *to, const char *from,
 void
 i18n_init (void)
 {
-  setlocale (LC_CTYPE, "");
-  setlocale (LC_COLLATE, "");
-  setlocale (LC_MESSAGES, "");
-#if HAVE_LC_PAPER
-  setlocale (LC_PAPER, "");
-#endif
+  setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, relocate(locale_dir));
   textdomain (PACKAGE);
 
@@ -598,7 +593,6 @@ set_encoding_from_locale (const char *loc)
       ok = false;
     }
 
-
   setlocale (LC_CTYPE, tmp);
 
   free (tmp);
@@ -660,9 +654,6 @@ get_system_decimal (void)
 {
   char radix_char;
 
-  char *ol = xstrdup (setlocale (LC_NUMERIC, NULL));
-  setlocale (LC_NUMERIC, "");
-
 #if HAVE_NL_LANGINFO
   radix_char = nl_langinfo (RADIXCHAR)[0];
 #else
@@ -673,10 +664,6 @@ get_system_decimal (void)
   }
 #endif
 
-  /* We MUST leave LC_NUMERIC untouched, since it would
-     otherwise interfere with data_{in,out} */
-  setlocale (LC_NUMERIC, ol);
-  free (ol);
   return radix_char;
 }