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>
This commit is contained in:
Jonas Ådahl 2021-03-02 10:51:18 +01:00
parent 6e4d3e0f85
commit c45a1619f5

View File

@ -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");
}