[gupnp-tools] universal-cp: mark messages as translatable



commit dfe7d03f5b952b44917160f56735a2e177b6c720
Author: Jiro Matsuzawa <jmatsuzawa gnome org>
Date:   Tue Jan 8 00:04:56 2013 +0900

    universal-cp: mark messages as translatable
    
    https://bugzilla.gnome.org/show_bug.cgi?id=690635

 data/gupnp-universal-cp.ui          |   16 +++---
 src/universal-cp/action-dialog.c    |    3 +-
 src/universal-cp/details-treeview.c |   81 ++++++++++++++++++-----------------
 src/universal-cp/device-treeview.c  |   36 +++++++++++----
 src/universal-cp/event-treeview.c   |   11 +++--
 5 files changed, 83 insertions(+), 64 deletions(-)
---
diff --git a/data/gupnp-universal-cp.ui b/data/gupnp-universal-cp.ui
index e069f9e..173c960 100644
--- a/data/gupnp-universal-cp.ui
+++ b/data/gupnp-universal-cp.ui
@@ -403,7 +403,7 @@ Inspired by Intel Tools for UPnP.</property>
         <property name="visible">True</property>
         <property name="can_focus">False</property>
         <property name="use_action_appearance">False</property>
-        <property name="label" translatable="yes">Expand all devices</property>
+        <property name="label" translatable="yes">_Expand all devices</property>
         <property name="use_underline">True</property>
         <signal name="activate" handler="on_expand_devices_activate" swapped="no"/>
       </object>
@@ -413,7 +413,7 @@ Inspired by Intel Tools for UPnP.</property>
         <property name="visible">True</property>
         <property name="can_focus">False</property>
         <property name="use_action_appearance">False</property>
-        <property name="label" translatable="yes">Collapse all devices</property>
+        <property name="label" translatable="yes">_Collapse all devices</property>
         <property name="use_underline">True</property>
         <signal name="activate" handler="on_collapse_devices_activate" swapped="no"/>
       </object>
@@ -452,7 +452,7 @@ Inspired by Intel Tools for UPnP.</property>
         <property name="visible">True</property>
         <property name="can_focus">False</property>
         <property name="use_action_appearance">False</property>
-        <property name="label" translatable="yes">Clear event log</property>
+        <property name="label" translatable="yes">_Clear event log</property>
         <property name="use_underline">True</property>
         <signal name="activate" handler="on_clear_event_log_activate" swapped="no"/>
       </object>
@@ -482,7 +482,7 @@ Inspired by Intel Tools for UPnP.</property>
                     <property name="can_focus">False</property>
                     <child>
                       <object class="GtkImageMenuItem" id="clear_event_log">
-                        <property name="label">Clear event log</property>
+                        <property name="label" translatable="yes">_Clear event log</property>
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
                         <property name="use_action_appearance">False</property>
@@ -517,7 +517,7 @@ Inspired by Intel Tools for UPnP.</property>
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
                 <property name="use_action_appearance">False</property>
-                <property name="label" translatable="yes">View</property>
+                <property name="label" translatable="yes">_View</property>
                 <property name="use_underline">True</property>
                 <child type="submenu">
                   <object class="GtkMenu" id="view_menuitem_menu">
@@ -527,7 +527,7 @@ Inspired by Intel Tools for UPnP.</property>
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
                         <property name="use_action_appearance">False</property>
-                        <property name="label" translatable="yes">Expand all devices</property>
+                        <property name="label" translatable="yes">_Expand all devices</property>
                         <property name="use_underline">True</property>
                         <signal name="activate" handler="on_expand_devices_activate" swapped="no"/>
                       </object>
@@ -537,7 +537,7 @@ Inspired by Intel Tools for UPnP.</property>
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
                         <property name="use_action_appearance">False</property>
-                        <property name="label" translatable="yes">Collapse all devices</property>
+                        <property name="label" translatable="yes">_Collapse all devices</property>
                         <property name="use_underline">True</property>
                         <signal name="activate" handler="on_collapse_devices_activate" swapped="no"/>
                       </object>
@@ -553,7 +553,7 @@ Inspired by Intel Tools for UPnP.</property>
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
                         <property name="use_action_appearance">False</property>
-                        <property name="label" translatable="yes">Event log</property>
+                        <property name="label" translatable="yes">Event _log</property>
                         <property name="use_underline">True</property>
                         <property name="active">True</property>
                         <signal name="activate" handler="on_event_log_activate" swapped="no"/>
diff --git a/src/universal-cp/action-dialog.c b/src/universal-cp/action-dialog.c
index 515f3f0..fa3823e 100644
--- a/src/universal-cp/action-dialog.c
+++ b/src/universal-cp/action-dialog.c
@@ -25,6 +25,7 @@
 #include <config.h>
 
 #include <gmodule.h>
+#include <glib/gi18n.h>
 
 #include "gui.h"
 #include "device-treeview.h"
@@ -710,7 +711,7 @@ on_action_complete (GUPnPServiceProxy       *proxy,
                                         GTK_DIALOG_MODAL,
                                         GTK_MESSAGE_ERROR,
                                         GTK_BUTTONS_CLOSE,
-                                        "Action failed.\n\nError %d: %s",
+                                        _("Action failed.\n\nError %d: %s"),
                                         error->code,
                                         error->message);
 
diff --git a/src/universal-cp/details-treeview.c b/src/universal-cp/details-treeview.c
index 91e7da5..b6c4e4a 100644
--- a/src/universal-cp/details-treeview.c
+++ b/src/universal-cp/details-treeview.c
@@ -23,6 +23,7 @@
 #include <config.h>
 
 #include <gmodule.h>
+#include <glib/gi18n.h>
 
 #include "details-treeview.h"
 #include "gui.h"
@@ -176,17 +177,17 @@ show_action_arg_details (GUPnPServiceActionArgInfo *info)
         char *details[32];
         int   i = 0;
 
-        details[i++] = "Name";
+        details[i++] = _("Name");
         details[i++] = g_strdup (info->name);
-        details[i++] = "Direction";
+        details[i++] = _("Direction");
         if (info->direction == GUPNP_SERVICE_ACTION_ARG_DIRECTION_IN)
                 details[i++] = g_strdup ("in");
         else
                 details[i++] = g_strdup ("out");
-        details[i++] = "Related State Variable";
+        details[i++] = _("Related State Variable");
         details[i++] = g_strdup (info->related_state_variable);
-        details[i++] = "Is Return Value";
-        details[i++] = g_strdup (info->retval? "Yes": "No");
+        details[i++] = _("Is Return Value");
+        details[i++] = g_strdup (info->retval? _("Yes"): _("No"));
         details[i] = NULL;
 
         update_details ((const char **) details);
@@ -204,9 +205,9 @@ show_action_details (GUPnPServiceActionInfo *info)
         char *details[32];
         int   i = 0;
 
-        details[i++] = "Name";
+        details[i++] = _("Name");
         details[i++] = g_strdup (info->name);
-        details[i++] = "Number of Arguments";
+        details[i++] = _("Number of Arguments");
         details[i++] = g_strdup_printf ("%u",
                                         g_list_length (info->arguments));
         details[i] = NULL;
@@ -230,28 +231,28 @@ show_state_variable_details (GUPnPServiceStateVariableInfo *info)
         memset (&str_value, 0, sizeof (GValue));
         g_value_init (&str_value, G_TYPE_STRING);
 
-        details[i++] = "Name";
+        details[i++] = _("Name");
         details[i++] = g_strdup (info->name);
-        details[i++] = "Send Events";
-        details[i++] = g_strdup (info->send_events? "Yes": "No");
-        details[i++] = "GType";
+        details[i++] = _("Send Events");
+        details[i++] = g_strdup (info->send_events? _("Yes"): _("No"));
+        details[i++] = _("GType");
         details[i++] = g_strdup (g_type_name (info->type));
 
-        details[i++] = "Default Value";
+        details[i++] = _("Default Value");
         g_value_transform (&info->default_value,
                            &str_value);
         details[i++] = g_value_dup_string (&str_value);
 
         if (info->is_numeric) {
-                details[i++] = "Minimum";
+                details[i++] = _("Minimum");
                 g_value_transform (&info->minimum,
                                    &str_value);
                 details[i++] = g_value_dup_string (&str_value);
-                details[i++] = "Maximum";
+                details[i++] = _("Maximum");
                 g_value_transform (&info->maximum,
                                    &str_value);
                 details[i++] = g_value_dup_string (&str_value);
-                details[i++] = "Step";
+                details[i++] = _("Step");
                 g_value_transform (&info->step,
                                    &str_value);
                 details[i++] = g_value_dup_string (&str_value);
@@ -271,7 +272,7 @@ show_state_variable_details (GUPnPServiceStateVariableInfo *info)
                 }
                 valuesv[j] = NULL;
 
-                details[i++] = "Allowed Values";
+                details[i++] = _("Allowed Values");
                 details[i++] = g_strjoinv (", ", valuesv);
         }
 
@@ -295,33 +296,33 @@ show_service_details (GUPnPServiceInfo *info)
         const char    *str;
         int            i = 0;
 
-        details[i++] = "Location";
+        details[i++] = _("Location");
         str = gupnp_service_info_get_location (info);
         if (str)
                 details[i++] = g_strdup (str);
 
-        details[i++] = "UDN";
+        details[i++] = _("UDN");
         str = gupnp_service_info_get_udn (info);
         if (str)
                 details[i++] = g_strdup (str);
 
-        details[i++] = "Type";
+        details[i++] = _("Type");
         str = gupnp_service_info_get_service_type (info);
         if (str)
                 details[i++] = g_strdup (str);
 
-        details[i++] = "Base URL";
+        details[i++] = _("Base URL");
         uri = gupnp_service_info_get_url_base (info);
         if (uri)
                 details[i++] = soup_uri_to_string ((SoupURI *) uri, FALSE);
 
-        details[i++] = "Service ID";
+        details[i++] = _("Service ID");
         details[i++] = gupnp_service_info_get_id (info);
-        details[i++] = "Service URL";
+        details[i++] = _("Service URL");
         details[i++] = gupnp_service_info_get_scpd_url (info);
-        details[i++] = "Control URL";
+        details[i++] = _("Control URL");
         details[i++] = gupnp_service_info_get_control_url (info);
-        details[i++] = "Event Subscription URL";
+        details[i++] = _("Event Subscription URL");
         details[i++] = gupnp_service_info_get_event_subscription_url (info);
         details[i] = NULL;
 
@@ -342,45 +343,45 @@ show_device_details (GUPnPDeviceInfo *info)
         const char    *str;
         int            i = 0;
 
-        details[i++] = "Location";
+        details[i++] = _("Location");
         str = gupnp_device_info_get_location (info);
         if (str)
                 details[i++] = g_strdup (str);
 
-        details[i++] = "UDN";
+        details[i++] = _("UDN");
         str = gupnp_device_info_get_udn (info);
         if (str)
                 details[i++] = g_strdup (str);
 
-        details[i++] = "Type";
+        details[i++] = _("Type");
         str = gupnp_device_info_get_device_type (info);
         if (str)
                 details[i++] = g_strdup (str);
 
-        details[i++] = "Base URL";
+        details[i++] = _("Base URL");
         uri = gupnp_device_info_get_url_base (info);
         if (uri)
                 details[i++] = soup_uri_to_string ((SoupURI *) uri, FALSE);
 
-        details[i++] = "Friendly Name";
+        details[i++] = _("Friendly Name");
         details[i++] = gupnp_device_info_get_friendly_name (info);
-        details[i++] = "Manufacturer";
+        details[i++] = _("Manufacturer");
         details[i++] = gupnp_device_info_get_manufacturer (info);
-        details[i++] = "Manufacturer URL";
+        details[i++] = _("Manufacturer URL");
         details[i++] = gupnp_device_info_get_manufacturer_url (info);
-        details[i++] = "Model Description";
+        details[i++] = _("Model Description");
         details[i++] = gupnp_device_info_get_model_description (info);
-        details[i++] = "Model Name";
+        details[i++] = _("Model Name");
         details[i++] = gupnp_device_info_get_model_name (info);
-        details[i++] = "Model Number";
+        details[i++] = _("Model Number");
         details[i++] = gupnp_device_info_get_model_number (info);
-        details[i++] = "Model URL";
+        details[i++] = _("Model URL");
         details[i++] = gupnp_device_info_get_model_url (info);
-        details[i++] = "Serial Number";
+        details[i++] = _("Serial Number");
         details[i++] = gupnp_device_info_get_serial_number (info);
-        details[i++] = "UPC";
+        details[i++] = _("UPC");
         details[i++] = gupnp_device_info_get_upc (info);
-        details[i++] = "Presentation URL";
+        details[i++] = _("Presentation URL");
         details[i++] = gupnp_device_info_get_presentation_url (info);
         details[i] = NULL;
 
@@ -409,8 +410,8 @@ void
 setup_details_treeview (GtkBuilder *builder)
 {
         GtkTreeModel *model;
-        char         *headers[3] = { "Name",
-                                     "Value",
+        char         *headers[3] = { _("Name"),
+                                     _("Value"),
                                      NULL };
 
         treeview = GTK_WIDGET (gtk_builder_get_object (builder,
diff --git a/src/universal-cp/device-treeview.c b/src/universal-cp/device-treeview.c
index 41bb3e2..b1a20d1 100644
--- a/src/universal-cp/device-treeview.c
+++ b/src/universal-cp/device-treeview.c
@@ -23,6 +23,7 @@
 #include <config.h>
 
 #include <gmodule.h>
+#include <glib/gi18n.h>
 
 #include "gui.h"
 #include "icons.h"
@@ -30,10 +31,9 @@
 #include "details-treeview.h"
 #include "main.h"
 
-static const char *default_details[] = {
-        "Software", "GUPnP Universal Control Point",
-        "Version", VERSION,
-        "Author", "Zeeshan Ali (Khattak) <zeeshanak gnome org>", NULL};
+/* default details */
+#define SOFTWARE_INFO   N_("GUPnP Universal Control Point")
+#define AUTHOR_INFO     "Zeeshan Ali (Khattak) <zeeshanak gnome org>"
 
 static GtkWidget *treeview;
 static GtkWidget *popup;
@@ -43,6 +43,22 @@ static GtkWidget *separator;
 
 static gboolean   expanded;
 
+static void
+show_default_details ()
+{
+        const char *details[32];
+        int         i = 0;
+
+        details[i++] = _("Software");
+        details[i++] = _(SOFTWARE_INFO);
+        details[i++] = _("Version");
+        details[i++] = VERSION;
+        details[i++] = _("Author");
+        details[i++] = AUTHOR_INFO;
+        details[i] = NULL;
+        update_details (details);
+}
+
 gboolean
 find_device (GtkTreeModel *model,
              const char   *udn,
@@ -260,11 +276,11 @@ on_something_selected (GtkTreeSelection *selection,
                         gtk_tree_model_get (model, &iter, 4, &info, -1);
                         show_action_arg_details (info);
                 } else
-                        update_details (default_details);
+                        show_default_details ();
         }
 
         else
-                update_details (default_details);
+                show_default_details ();
 }
 
 void
@@ -440,7 +456,7 @@ append_state_variables (GUPnPServiceProxy *proxy,
                                            &variables_iter,
                                            service_iter, -1,
                                            0, get_icon_by_id (ICON_VARIABLES),
-                                           1, "State variables",
+                                           1, _("State variables"),
                                            5, ICON_VARIABLES,
                                            -1);
 
@@ -480,7 +496,7 @@ append_introspection (GUPnPServiceProxy         *proxy,
                 gtk_tree_store_insert_with_values (store,
                                  NULL, service_iter, -1,
                                  0, get_icon_by_id (ICON_MISSING),
-                                 1, "Information not available",
+                                 1, _("Information not available"),
                                  5, ICON_MISSING,
                                  -1);
 
@@ -657,7 +673,7 @@ create_device_treemodel (void)
 
         gtk_tree_store_insert_with_values (store, NULL, NULL, 0,
                                         0, get_icon_by_id (ICON_NETWORK),
-                                        1, "UPnP Network",
+                                        1, _("UPnP Network"),
                                         5, ICON_NETWORK,
                                         -1);
         return GTK_TREE_MODEL (store);
@@ -670,7 +686,7 @@ setup_device_treeview (GtkBuilder *builder)
         GtkTreeSelection  *selection;
         GtkCellRenderer   *renderer;
         GtkTreeViewColumn *column;
-        char              *headers[] = { "Device", NULL};
+        char              *headers[] = { _("Device"), NULL};
 
         treeview = GTK_WIDGET (gtk_builder_get_object (builder,
                                                        "device-treeview"));
diff --git a/src/universal-cp/event-treeview.c b/src/universal-cp/event-treeview.c
index ca8db3b..82cbf96 100644
--- a/src/universal-cp/event-treeview.c
+++ b/src/universal-cp/event-treeview.c
@@ -23,6 +23,7 @@
 #include <config.h>
 
 #include <gmodule.h>
+#include <glib/gi18n.h>
 
 #include "event-treeview.h"
 #include "gui.h"
@@ -368,11 +369,11 @@ void
 setup_event_treeview (GtkBuilder *builder)
 {
         GtkTreeModel *model;
-        char         *headers[6] = {"Time",
-                                   "Device",
-                                   "Service",
-                                   "State Variable",
-                                   "Value",
+        char         *headers[6] = {_("Time"),
+                                   _("Device"),
+                                   _("Service"),
+                                   _("State Variable"),
+                                   _("Value"),
                                    NULL };
 
         treeview = GTK_WIDGET (gtk_builder_get_object (builder,



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