[epiphany] Reduce use of markup in translatable strings



commit 6f489f39b2e6cc0550364a8f822e33ef9a0cd76e
Author: Michael Catanzaro <mcatanzaro igalia com>
Date:   Sun Aug 6 17:52:38 2017 -0500

    Reduce use of markup in translatable strings
    
    https://bugzilla.gnome.org/show_bug.cgi?id=671425

 embed/ephy-about-handler.c |    2 +-
 embed/ephy-web-view.c      |   26 +++++++++++++++-----------
 2 files changed, 16 insertions(+), 12 deletions(-)
---
diff --git a/embed/ephy-about-handler.c b/embed/ephy-about-handler.c
index fc550fb..47a98e3 100644
--- a/embed/ephy-about-handler.c
+++ b/embed/ephy-about-handler.c
@@ -576,7 +576,7 @@ ephy_about_handler_handle_incognito (EphyAboutHandler       *handler,
                           gtk_widget_get_default_direction () == GTK_TEXT_DIR_RTL ? "rtl" : "ltr",
                           _("Private Browsing"),
                           _("Private Browsing"),
-                          _("You are currently browsing <em>incognito</em>. Pages viewed in this "
+                          _("You are currently browsing incognito. Pages viewed in this "
                             "mode will not show up in your browsing history and all stored "
                             "information will be cleared when you close the window. Files you "
                             "download will be kept."),
diff --git a/embed/ephy-web-view.c b/embed/ephy-web-view.c
index 7328c9e..4301591 100644
--- a/embed/ephy-web-view.c
+++ b/embed/ephy-web-view.c
@@ -1413,6 +1413,7 @@ show_permission_request_info_bar (WebKitWebView           *web_view,
   GtkWidget *label;
   char *message;
   char *origin;
+  char *bold_origin;
 
   info_bar = gtk_info_bar_new_with_buttons (_("Deny"), GTK_RESPONSE_NO,
                                             _("Allow"), GTK_RESPONSE_YES,
@@ -1427,26 +1428,28 @@ show_permission_request_info_bar (WebKitWebView           *web_view,
   if (origin == NULL)
     return;
 
+  bold_origin = g_markup_printf_escaped ("<b>%s</b>", origin);
+
   switch (permission_type) {
   case EPHY_PERMISSION_TYPE_SHOW_NOTIFICATIONS:
     /* Translators: Notification policy for a specific site. */
-    message = g_markup_printf_escaped (_("The page at <b>%s</b> wants to show desktop notifications."),
-                                       origin);
+    message = g_strdup_printf (_("The page at %s wants to show desktop notifications."),
+                               bold_origin);
     break;
   case EPHY_PERMISSION_TYPE_ACCESS_LOCATION:
     /* Translators: Geolocation policy for a specific site. */
-    message = g_markup_printf_escaped (_("The page at <b>%s</b> wants to know your location."),
-                                       origin);
+    message = g_strdup_printf (_("The page at %s wants to know your location."),
+                               bold_origin);
     break;
   case EPHY_PERMISSION_TYPE_ACCESS_MICROPHONE:
     /* Translators: Microphone policy for a specific site. */
-    message = g_markup_printf_escaped (_("The page at <b>%s</b> wants to use your microphone."),
-                                       origin);
+    message = g_strdup_printf (_("The page at %s wants to use your microphone."),
+                               bold_origin);
     break;
   case EPHY_PERMISSION_TYPE_ACCESS_WEBCAM:
     /* Translators: Webcam policy for a specific site. */
-    message = g_markup_printf_escaped (_("The page at <b>%s</b> wants to use your webcam."),
-                                       origin);
+    message = g_strdup_printf (_("The page at %s wants to use your webcam."),
+                               bold_origin);
     break;
   case EPHY_PERMISSION_TYPE_SAVE_PASSWORD:
   default:
@@ -1457,8 +1460,6 @@ show_permission_request_info_bar (WebKitWebView           *web_view,
   gtk_label_set_markup (GTK_LABEL (label), message);
   gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
 
-  g_free (message);
-
   content_area = gtk_info_bar_get_content_area (GTK_INFO_BAR (info_bar));
   gtk_container_add (GTK_CONTAINER (content_area), label);
 
@@ -1470,7 +1471,6 @@ show_permission_request_info_bar (WebKitWebView           *web_view,
                     G_CALLBACK (decide_on_permission_request),
                     data);
   g_object_weak_ref (G_OBJECT (info_bar), (GWeakNotify)permission_request_info_bar_destroyed_cb, data);
-  g_free (origin);
 
   switch (permission_type) {
   case EPHY_PERMISSION_TYPE_SHOW_NOTIFICATIONS:
@@ -1493,6 +1493,10 @@ show_permission_request_info_bar (WebKitWebView           *web_view,
   ephy_embed_add_top_widget (EPHY_GET_EMBED_FROM_EPHY_WEB_VIEW (web_view),
                              info_bar,
                              EPHY_EMBED_TOP_WIDGET_POLICY_DESTROY_ON_TRANSITION);
+
+  g_free (message);
+  g_free (origin);
+  g_free (bold_origin);
 }
 
 static gboolean


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