[gnome-control-center/gnome-3-8] region: Translate restart notification into the target language



commit 930b144cf79b0344be6f516bed4300bbe314b57a
Author: Rui Matos <tiagomatos gmail com>
Date:   Sun Mar 10 02:52:54 2013 +0100

    region: Translate restart notification into the target language
    
    We used to do this before the panel re-design.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=695534

 panels/region/cc-region-panel.c |   18 +++++++++++++++---
 1 files changed, 15 insertions(+), 3 deletions(-)
---
diff --git a/panels/region/cc-region-panel.c b/panels/region/cc-region-panel.c
index ea15e30..c85c1df 100644
--- a/panels/region/cc-region-panel.c
+++ b/panels/region/cc-region-panel.c
@@ -209,16 +209,23 @@ restart_now (CcRegionPanel *self)
 }
 
 static void
-show_restart_notification (CcRegionPanel *self)
+show_restart_notification (CcRegionPanel *self,
+                           const gchar   *locale)
 {
        CcRegionPanelPrivate *priv = self->priv;
         GtkWidget *box;
         GtkWidget *label;
         GtkWidget *button;
+        gchar *current_locale;
 
         if (priv->notification)
                 return;
 
+        if (locale) {
+                current_locale = g_strdup (setlocale (LC_MESSAGES, NULL));
+                setlocale (LC_MESSAGES, locale);
+        }
+
         priv->notification = gd_notification_new ();
         g_object_add_weak_pointer (G_OBJECT (priv->notification),
                                    (gpointer *)&priv->notification);
@@ -238,6 +245,11 @@ show_restart_notification (CcRegionPanel *self)
         gtk_container_add (GTK_CONTAINER (priv->notification), box);
         gtk_overlay_add_overlay (GTK_OVERLAY (self->priv->overlay), priv->notification);
         gtk_widget_show (priv->notification);
+
+        if (locale) {
+                setlocale (LC_MESSAGES, current_locale);
+                g_free (current_locale);
+        }
 }
 
 static void
@@ -296,7 +308,7 @@ language_response (GtkDialog     *chooser,
         gtk_widget_destroy (GTK_WIDGET (chooser));
 
         if (changed)
-                show_restart_notification (self);
+                show_restart_notification (self, language);
 }
 
 static gboolean
@@ -330,7 +342,7 @@ format_response (GtkDialog *chooser,
         gtk_widget_destroy (GTK_WIDGET (chooser));
 
         if (changed)
-                show_restart_notification (self);
+                show_restart_notification (self, NULL);
 }
 
 static void


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