r22295 - gnucash/branches/2.4/src/bin - [r22293][Bug 680613] Date format setting seems to be ignored since version 2.4.9

John Ralls jralls at code.gnucash.org
Wed Aug 8 01:42:23 EDT 2012


Author: jralls
Date: 2012-08-08 01:42:23 -0400 (Wed, 08 Aug 2012)
New Revision: 22295
Trac: http://svn.gnucash.org/trac/changeset/22295

Modified:
   gnucash/branches/2.4/src/bin/gnucash-bin.c
Log:
[r22293][Bug 680613] Date format setting seems to be ignored since version 2.4.9

Work around strange side-effect of r21665 which caused LC_TIME to be
changed after it had been set by setlocale(LC_ALL) in set_mac_locale().

Modified: gnucash/branches/2.4/src/bin/gnucash-bin.c
===================================================================
--- gnucash/branches/2.4/src/bin/gnucash-bin.c	2012-08-08 05:38:44 UTC (rev 22294)
+++ gnucash/branches/2.4/src/bin/gnucash-bin.c	2012-08-08 05:42:23 UTC (rev 22295)
@@ -285,9 +285,11 @@
 			    [locale objectForKey: NSLocaleCountryCode]];
 /* If we didn't get a valid current locale, the string will be just "_" */
     if ([locale_str isEqualToString: @"_"])
-	setlocale(LC_ALL, "en_US");
-    else
-	setlocale(LC_ALL, [locale_str UTF8String]);
+	locale_str = @"en_US";
+
+    setlocale(LC_ALL, [locale_str UTF8String]);
+    if (g_getenv("LANG") == NULL)
+	g_setenv("LANG", [locale_str UTF8String], TRUE);
 /* If the currency doesn't match the base locale, we need to find a locale that does match, because setlocale won't know what to do with just a currency identifier. */
     if (![[locale objectForKey: NSLocaleCurrencyCode] isEqualToString:
 	  [[[NSLocale alloc] initWithLocaleIdentifier: locale_str] objectForKey: NSLocaleCurrencyCode]]) {



More information about the gnucash-changes mailing list