[mutter/bilelmoussaoui/gdk-x11-only: 4/6] core: Copy gtk_get_default_locale




commit 96aa171e73f7ace66b3059a3ec090b3150c24630
Author: Bilal Elmoussaoui <belmouss redhat com>
Date:   Mon May 9 11:29:11 2022 +0200

    core: Copy gtk_get_default_locale
    
    In order to drop the gtk requirement for building libmutter

 src/core/util.c | 24 ++++++++++++++----------
 1 file changed, 14 insertions(+), 10 deletions(-)
---
diff --git a/src/core/util.c b/src/core/util.c
index 10c59ed7db..1eaaefa82e 100644
--- a/src/core/util.c
+++ b/src/core/util.c
@@ -505,16 +505,20 @@ meta_external_binding_name_for_action (guint keybinding_action)
 MetaLocaleDirection
 meta_get_locale_direction (void)
 {
-  switch (gtk_get_locale_direction ())
-    {
-    case GTK_TEXT_DIR_LTR:
-      return META_LOCALE_DIRECTION_LTR;
-    case GTK_TEXT_DIR_RTL:
-      return META_LOCALE_DIRECTION_RTL;
-    default:
-      g_assert_not_reached ();
-      return 0;
-    }
+  /* Translate to default:RTL if you want your widgets
+   * to be RTL, otherwise translate to default:LTR.
+   * Do *not* translate it to "predefinito:LTR", if it
+   * it isn't default:LTR or default:RTL it will not work
+   */
+  char                *e   = _("default:LTR");
+  MetaLocaleDirection  dir = META_LOCALE_DIRECTION_LTR;
+
+  if (g_strcmp0 (e, "default:RTL") == 0)
+    dir = META_LOCALE_DIRECTION_RTL;
+  else if (g_strcmp0 (e, "default:LTR") != 0)
+    g_warning ("Whoever translated default:LTR did so wrongly. Defaulting to LTR.");
+
+  return dir;
 }
 
 char *


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