GtkApplication: Call setlocale early
authorMatthias Clasen <mclasen@redhat.com>
Mon, 6 Sep 2021 05:37:51 +0000 (01:37 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Sun, 31 Oct 2021 21:52:04 +0000 (17:52 -0400)
If we don't call setlocale early enough,
--help output may come out misformatted.

Fixes: #4234
gtk/gtkapplication.c
gtk/gtkmain.c
gtk/gtkprivate.h

index c26e15cadb641f82a2375f5eb50c13a0055e9b9a..1408c0d9d291ffce93f382a935351b2623675d44 100644 (file)
@@ -294,6 +294,9 @@ gtk_application_local_command_line (GApplication   *application,
                                     char         ***arguments,
                                     int            *exit_status)
 {
+  /* We need to call setlocale() here so --help output works */
+  setlocale_initialization ();
+
   return G_APPLICATION_CLASS (gtk_application_parent_class)->local_command_line (application, arguments, exit_status);
 }
 
index e49882221294ce24c1ccc388c8ebdaa75a6f4e57..6dd0f7e871cc6b882924f0076d05c5eb855d50cf 100644 (file)
@@ -362,7 +362,7 @@ enum_locale_proc (LPTSTR locale)
   
 #endif
 
-static void
+void
 setlocale_initialization (void)
 {
   static gboolean initialized = FALSE;
index 8cb11c761caac2d74e9c71b97522233543d28f4c..3495e07efcbee19c66ce2c0bae4f798b0a8cbcfc 100644 (file)
@@ -150,6 +150,8 @@ GBytes *get_emoji_data (void);
 
 char * _gtk_elide_underscores (const char *original);
 
+void setlocale_initialization (void);
+
 G_END_DECLS
 
 #endif /* __GTK_PRIVATE_H__ */