[mutter] context: Set up locale on init



commit c45a1619f5982c02a90b4d041ddd1d6c4a78deb6
Author: Jonas Ã…dahl <jadahl gmail com>
Date:   Tue Mar 2 10:51:18 2021 +0100

    context: Set up locale on init
    
    Taken from main.c, which does that when getting the main option context,
    which happens to happen early in a process's lifetime.
    
    Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861>

 src/core/meta-context.c | 6 ++++++
 1 file changed, 6 insertions(+)
---
diff --git a/src/core/meta-context.c b/src/core/meta-context.c
index a816f561eb..33cc875314 100644
--- a/src/core/meta-context.c
+++ b/src/core/meta-context.c
@@ -22,6 +22,8 @@
 
 #include "core/meta-context-private.h"
 
+#include <locale.h>
+
 #include "core/util-private.h"
 
 enum
@@ -147,4 +149,8 @@ meta_context_class_init (MetaContextClass *klass)
 static void
 meta_context_init (MetaContext *context)
 {
+  if (!setlocale (LC_ALL, ""))
+    g_warning ("Locale not understood by C library");
+  bindtextdomain (GETTEXT_PACKAGE, MUTTER_LOCALEDIR);
+  bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]