[gnc-locale-name] Use setlocale(LC_MONETARY, NULL) to retrieve name.

Instead of setlocale(LC_ALL, NULL). The uses for the string either create
an ICU locale or sort between German and US TXF reports. On some OSes
where the user has different locales set for one or more categories LC_ALL
produces a dump of all of the LC_FOO variables and their values. That's
not useful for comparing to de_DE and it's too long for ICU, which
crashes.

Meanwhile in dialog-print-checks the RV of setlocale was ignored,
rendering the call a no-op.
pull/2108/head
John Ralls 8 months ago
parent 29b1330e5b
commit d8c68cce9e

@ -2074,7 +2074,6 @@ draw_date_format(GtkPrintContext *context, const gchar *date_format,
const gchar *c;
GString *cdn_fmt;
setlocale(LC_ALL, NULL);
if ( !data->print_date_format ) return;
date_desc = pango_font_description_copy_static(default_desc);

@ -156,7 +156,7 @@ gchar *gnc_locale_name (void)
# ifdef G_OS_WIN32
return g_win32_getlocale();
# else /* !G_OS_WIN32 */
return g_strdup (setlocale(LC_ALL, NULL));
return g_strdup (setlocale(LC_MONETARY, NULL));
# endif /* G_OS_WIN32 */
}

@ -36,7 +36,7 @@
#include <guile-mappings.h>
#include <gnc-guile-utils.h>
#include "gnc-locale-tax.h"
#include <gnc-locale-utils.h>
void
@ -50,7 +50,7 @@ gnc_locale_tax_init(void)
gboolean is_de_DE = (strncmp(thislocale, "de_DE", 5) == 0);
g_free(thislocale);
# else /* !G_OS_WIN32 */
const char *thislocale = setlocale(LC_ALL, NULL);
const char *thislocale = gnc_locale_name();
gboolean is_de_DE = (strncmp(thislocale, "de_DE", 5) == 0);
# endif /* G_OS_WIN32 */
if (is_de_DE)

Loading…
Cancel
Save