[epiphany/wip/ephy-sync] ephy-sync: Avoid including markup in translatable comments



commit c40572dc1ca8665b27e4d1d1d704b37dc5b504e2
Author: Gabriel Ivascu <ivascu gabriel59 gmail com>
Date:   Sun Aug 28 21:17:27 2016 +0300

    ephy-sync: Avoid including markup in translatable comments

 lib/widgets/ephy-password-notification.c |   10 +++++--
 src/prefs-dialog.c                       |   41 ++++++++++++++++++++++-------
 src/resources/prefs-dialog.ui            |    4 +-
 3 files changed, 40 insertions(+), 15 deletions(-)
---
diff --git a/lib/widgets/ephy-password-notification.c b/lib/widgets/ephy-password-notification.c
index 13644e2..d725f51 100644
--- a/lib/widgets/ephy-password-notification.c
+++ b/lib/widgets/ephy-password-notification.c
@@ -50,13 +50,17 @@ ephy_password_notification_constructed (GObject *object)
   char *account;
   char *text;
 
-  text = g_strdup_printf (_("We noticed that the password of your Firefox "
-                            "Account <b>%s</b> has been changed."),
-                          self->user);
+  account = g_strdup_printf ("<b>%s</b>", self->user);
+  text = g_strdup_printf (_("The password of your Firefox account %s "
+                            "seems to have been changed."),
+                          account);
+
   gtk_label_set_markup (GTK_LABEL (self->note), text);
   gtk_label_set_text (GTK_LABEL (self->suggestion),
                       _("Please visit Preferences and sign in with the new "
                         "password to continue the sync process."));
+
+  g_free (account);
   g_free (text);
 
   G_OBJECT_CLASS (ephy_password_notification_parent_class)->constructed (object);
diff --git a/src/prefs-dialog.c b/src/prefs-dialog.c
index 6a12728..316daf5 100644
--- a/src/prefs-dialog.c
+++ b/src/prefs-dialog.c
@@ -224,6 +224,7 @@ server_message_received_cb (WebKitUserContentManager *manager,
     const char *sessionToken = json_object_get_string_member (data, "sessionToken");
     const char *keyFetchToken = json_object_get_string_member (data, "keyFetchToken");
     const char *unwrapBKey = json_object_get_string_member (data, "unwrapBKey");
+    char *account;
     char *text;
 
     inject_data_to_server (dialog, "message", "login", NULL);
@@ -234,10 +235,14 @@ server_message_received_cb (WebKitUserContentManager *manager,
       g_warning ("Ignoring login with keyFetchToken or unwrapBKey missing!"
                  "Cannot retrieve sync keys with one of them missing.");
       ephy_sync_service_destroy_session (service, sessionToken);
-      gtk_label_set_markup (GTK_LABEL (dialog->sync_sign_in_details),
-                          _("<span fgcolor='#e6780b'>Something went wrong, please try again.</span>"));
+
+      text = g_strdup_printf ("<span fgcolor='#e6780b'>%s</span>",
+                              _("Something went wrong, please try again."));
+      gtk_label_set_markup (GTK_LABEL (dialog->sync_sign_in_details), text);
       gtk_widget_set_visible (dialog->sync_sign_in_details, TRUE);
       g_timeout_add_seconds (3, (GSourceFunc) sync_fxa_load_sign_in_url, dialog);
+
+      g_free (text);
       goto out;
     }
 
@@ -245,10 +250,14 @@ server_message_received_cb (WebKitUserContentManager *manager,
     if (json_object_get_boolean_member (data, "verified") == FALSE) {
       g_warning ("Attempt to operate on an unverified account, giving up.");
       ephy_sync_service_destroy_session (service, sessionToken);
-      gtk_label_set_markup (GTK_LABEL (dialog->sync_sign_in_details),
-                          _("<span fgcolor='#e6780b'>Please verify your account before you sign 
in.</span>"));
+
+      text = g_strdup_printf ("<span fgcolor='#e6780b'>%s</span>",
+                              _("Please verify your account before you sign in."));
+      gtk_label_set_markup (GTK_LABEL (dialog->sync_sign_in_details), text);
       gtk_widget_set_visible (dialog->sync_sign_in_details, TRUE);
       g_timeout_add_seconds (3, (GSourceFunc) sync_fxa_load_sign_in_url, dialog);
+
+      g_free (text);
       goto out;
     }
 
@@ -256,10 +265,14 @@ server_message_received_cb (WebKitUserContentManager *manager,
     if (ephy_sync_service_fetch_sync_keys (service, email, keyFetchToken, unwrapBKey) == FALSE) {
       g_warning ("Failed to retrieve the sync keys, giving up.");
       ephy_sync_service_destroy_session (service, sessionToken);
-      gtk_label_set_markup (GTK_LABEL (dialog->sync_sign_in_details),
-                          _("<span fgcolor='#e6780b'>Something went wrong, please try again.</span>"));
+
+      text = g_strdup_printf ("<span fgcolor='#e6780b'>%s</span>",
+                              _("Something went wrong, please try again."));
+      gtk_label_set_markup (GTK_LABEL (dialog->sync_sign_in_details), text);
       gtk_widget_set_visible (dialog->sync_sign_in_details, TRUE);
       g_timeout_add_seconds (3, (GSourceFunc) sync_fxa_load_sign_in_url, dialog);
+
+      g_free (text);
       goto out;
     }
 
@@ -274,15 +287,19 @@ server_message_received_cb (WebKitUserContentManager *manager,
     ephy_sync_service_sync_bookmarks (service, TRUE);
     ephy_sync_service_start_periodical_sync (service, FALSE);
 
+    account = g_strdup_printf ("<b>%s</b>", email);
     /* Translators: the %s refers to the email of the currently logged in user. */
-    text = g_strdup_printf (_("Currently logged in as <b>%s</b>"), email);
+    text = g_strdup_printf (_("Currently logged in as %s"), account);
     gtk_label_set_markup (GTK_LABEL (dialog->sync_sign_out_details), text);
-    g_free (text);
+
     gtk_container_remove (GTK_CONTAINER (dialog->sync_authenticate_box),
                           dialog->sync_sign_in_box);
     gtk_box_pack_start (GTK_BOX (dialog->sync_authenticate_box),
                         dialog->sync_sign_out_box,
                         TRUE, TRUE, 0);
+
+    g_free (text);
+    g_free (account);
   } else if (g_strcmp0 (command, "session_status") == 0) {
     /* We are not signed in at this time, which we signal by returning an error. */
     inject_data_to_server (dialog, "message", "error", NULL);
@@ -1474,6 +1491,7 @@ static void
 setup_sync_page (PrefsDialog *dialog)
 {
   EphySyncService *service;
+  char *account;
   char *text;
 
   service = ephy_shell_get_sync_service (ephy_shell_get_default ());
@@ -1485,11 +1503,14 @@ setup_sync_page (PrefsDialog *dialog)
   } else {
     gtk_container_remove (GTK_CONTAINER (dialog->sync_authenticate_box),
                           dialog->sync_sign_in_box);
+
+    account = g_strdup_printf ("<b>%s</b>", ephy_sync_service_get_user_email (service));
     /* Translators: the %s refers to the email of the currently logged in user. */
-    text = g_strdup_printf (_("Currently logged in as <b>%s</b>"),
-                            ephy_sync_service_get_user_email (service));
+    text = g_strdup_printf (_("Currently logged in as %s"), account);
     gtk_label_set_markup (GTK_LABEL (dialog->sync_sign_out_details), text);
+
     g_free (text);
+    g_free (account);
   }
 }
 
diff --git a/src/resources/prefs-dialog.ui b/src/resources/prefs-dialog.ui
index ad2f036..863a801 100644
--- a/src/resources/prefs-dialog.ui
+++ b/src/resources/prefs-dialog.ui
@@ -769,7 +769,7 @@
                                 <property name="visible">True</property>
                                 <property name="halign">start</property>
                                 <property name="use-markup">True</property>
-                                <property name="label" translatable="yes">Sign in with your &lt;b&gt;Firefox 
Account&lt;/b&gt; and have your bookmarks synced across all your devices.</property>
+                                <property name="label" translatable="yes">Sign in with your Firefox account 
and have your bookmarks synced across all your devices.</property>
                               </object>
                             </child>
                             <child>
@@ -777,7 +777,7 @@
                                 <property name="visible">True</property>
                                 <property name="halign">start</property>
                                 <property name="use-markup">True</property>
-                                <property name="label" translatable="yes">Note that you must own an already 
&lt;b&gt;verified&lt;/b&gt; account to be able to login.</property>
+                                <property name="label" translatable="yes">Note that you must own an already 
verified account to be able to login.</property>
                               </object>
                             </child>
                           </object>


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