FIXME: How to handle _GNU_SOURCE / xlocale.h properly?

	* gtk/gtkcalendar.c (locales_init): Use nl_langinfo_l() if available
	and get monthnames / weekday abbrevations from the locale defined by
	LC_MESSAGES (#343415)
---
 gtk/gtkcalendar.c |   24 ++++++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)

Index: gtk/gtkcalendar.c
===================================================================
--- gtk/gtkcalendar.c.orig
+++ gtk/gtkcalendar.c
@@ -31,6 +31,10 @@
 
 #include <config.h>
 
+/* FIXME */
+#define _GNU_SOURCE
+#define HAVE_NL_LANGINFO_L
+
 #ifdef HAVE_SYS_TIME_H
 #include <sys/time.h>
 #endif
@@ -377,12 +381,21 @@ locales_init (void)
   gint i;
 #ifdef G_OS_WIN32
   wchar_t wbuffer[100];
+#elif defined(HAVE_NL_LANGINFO_L)
+  locale_t msglocale;
+#endif
+
+#ifdef HAVE_NL_LANGINFO_L
+  msglocale = newlocale (LC_TIME_MASK, setlocale (LC_MESSAGES, NULL), NULL);
 #endif
 
   if (!default_abbreviated_dayname[0])
     for (i=0; i<7; i++)
       {
-#ifndef G_OS_WIN32
+#ifdef HAVE_NL_LANGINFO_L
+	default_abbreviated_dayname[i] = g_locale_to_utf8 (nl_langinfo_l (ABDAY_1 + i, msglocale), -1,
+							   NULL, NULL, NULL);
+#elif !defined(G_OS_WIN32)
 	default_abbreviated_dayname[i] = g_locale_to_utf8 (nl_langinfo (ABDAY_1 + i), -1,
 							   NULL, NULL, NULL);
 #else
@@ -409,7 +422,10 @@ locales_init (void)
   if (!default_monthname[0])
     for (i=0; i<12; i++)
       {
-#ifndef G_OS_WIN32
+#ifdef HAVE_NL_LANGINFO_L
+	default_monthname[i] = g_locale_to_utf8 (nl_langinfo_l (MON_1 + i, msglocale), -1,
+						 NULL, NULL, NULL);
+#elif !defined(G_OS_WIN32)
 	default_monthname[i] = g_locale_to_utf8 (nl_langinfo (MON_1 + i), -1,
 						 NULL, NULL, NULL);
 #else
@@ -432,6 +448,10 @@ locales_init (void)
 	  }
 #endif
       }
+
+#ifdef HAVE_NL_LANGINFO_L
+  freelocale (msglocale);
+#endif
 }
 
 static void
