[Spice-devel] [spice-gtk] spicy-*: Remove translation support

Christophe Fergeau cfergeau at redhat.com
Thu Jun 18 08:50:16 PDT 2015


These are only meant to be test tools so they don't need to be
translated.
---
 po/POTFILES.in         |  4 ---
 src/spicy-connect.c    | 15 ++++-----
 src/spicy-screenshot.c | 27 +++++++---------
 src/spicy-stats.c      | 15 +++------
 src/spicy.c            | 86 ++++++++++++++++++++++++--------------------------
 5 files changed, 64 insertions(+), 83 deletions(-)

diff --git a/po/POTFILES.in b/po/POTFILES.in
index 793dd78..ad12609 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -3,10 +3,6 @@ src/desktop-integration.c
 src/spice-channel.c
 src/spice-cmdline.c
 src/spice-option.c
-src/spicy-screenshot.c
-src/spicy-stats.c
-src/spicy.c
-src/spicy-connect.c
 src/usb-device-manager.c
 src/usb-device-widget.c
 src/usbutil.c
diff --git a/src/spicy-connect.c b/src/spicy-connect.c
index 4fff75d..c471df5 100644
--- a/src/spicy-connect.c
+++ b/src/spicy-connect.c
@@ -17,7 +17,6 @@
 */
 
 #include <gtk/gtk.h>
-#include <glib/gi18n.h>
 #include <gdk/gdkkeysyms.h>
 #include "spice-common.h"
 #include "spicy-connect.h"
@@ -34,9 +33,9 @@ static struct {
     const char *prop;
     GtkWidget *entry;
 } connect_entries[] = {
-    { .text = N_("Hostname"),   .prop = "host"      },
-    { .text = N_("Port"),       .prop = "port"      },
-    { .text = N_("TLS Port"),   .prop = "tls-port"  },
+    { .text = "Hostname",   .prop = "host"      },
+    { .text = "Port",       .prop = "port"      },
+    { .text = "TLS Port",   .prop = "tls-port"  },
 };
 
 static gboolean can_connect(void)
@@ -153,7 +152,7 @@ gboolean spicy_connect_dialog(SpiceSession *session)
 
     /* Create the widgets */
     window = GTK_WINDOW(gtk_window_new(GTK_WINDOW_TOPLEVEL));
-    gtk_window_set_title(window, _("Connect to SPICE"));
+    gtk_window_set_title(window, "Connect to SPICE");
     gtk_window_set_resizable(window, FALSE);
     gtk_container_set_border_width(GTK_CONTAINER(window), 5);
 
@@ -186,7 +185,7 @@ gboolean spicy_connect_dialog(SpiceSession *session)
     gtk_box_pack_start(main_box, GTK_WIDGET(recent_box), TRUE, TRUE, 0);
     gtk_container_set_border_width(GTK_CONTAINER(recent_box), 5);
 
-    label = gtk_label_new(_("Recent connections:"));
+    label = gtk_label_new("Recent connections:");
     gtk_box_pack_start(recent_box, label, FALSE, TRUE, 0);
     gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
 
@@ -194,8 +193,8 @@ gboolean spicy_connect_dialog(SpiceSession *session)
     gtk_button_box_set_layout(GTK_BUTTON_BOX(button_box), GTK_BUTTONBOX_END);
     gtk_box_set_spacing(button_box, 5);
     gtk_container_set_border_width(GTK_CONTAINER(button_box), 5);
-    connect_button = gtk_button_new_with_label(_("Connect"));
-    cancel_button = gtk_button_new_with_label(_("Cancel"));
+    connect_button = gtk_button_new_with_label("Connect");
+    cancel_button = gtk_button_new_with_label("Cancel");
     gtk_box_pack_start(button_box, cancel_button, FALSE, TRUE, 0);
     gtk_box_pack_start(button_box, connect_button, FALSE, TRUE, 1);
 
diff --git a/src/spicy-screenshot.c b/src/spicy-screenshot.c
index e7835bf..d90d4e8 100644
--- a/src/spicy-screenshot.c
+++ b/src/spicy-screenshot.c
@@ -16,7 +16,6 @@
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
 #include "config.h"
-#include <glib/gi18n.h>
 
 #include "spice-client.h"
 #include "spice-common.h"
@@ -56,7 +55,7 @@ static int write_ppm_32(void)
 
     fp = fopen(outf,"w");
     if (NULL == fp) {
-	fprintf(stderr, _("%s: can't open %s: %s\n"), g_get_prgname(), outf, strerror(errno));
+	fprintf(stderr, "%s: can't open %s: %s\n", g_get_prgname(), outf, strerror(errno));
 	return -1;
     }
     fprintf(fp, "P6\n%d %d\n255\n",
@@ -84,12 +83,12 @@ static void invalidate(SpiceChannel *channel,
         rc = write_ppm_32();
         break;
     default:
-        fprintf(stderr, _("unsupported spice surface format %d\n"), d_format);
+        fprintf(stderr, "unsupported spice surface format %d\n", d_format);
         rc = -1;
         break;
     }
     if (rc == 0)
-        fprintf(stderr, _("wrote screen shot to %s\n"), outf);
+        fprintf(stderr, "wrote screen shot to %s\n", outf);
     g_main_loop_quit(mainloop);
 }
 
@@ -137,14 +136,14 @@ static GOptionEntry app_entries[] = {
         .short_name       = 'o',
         .arg              = G_OPTION_ARG_FILENAME,
         .arg_data         = &outf,
-        .description      = N_("Output file name (default spicy-screenshot.ppm)"),
-        .arg_description  = N_("<filename>"),
+        .description      = "Output file name (default spicy-screenshot.ppm)",
+        .arg_description  = "<filename>",
     },
     {
         .long_name        = "version",
         .arg              = G_OPTION_ARG_NONE,
         .arg_data         = &version,
-        .description      = N_("Display version and quit"),
+        .description      = "Display version and quit",
     },
     {
         /* end of list */
@@ -156,18 +155,14 @@ int main(int argc, char *argv[])
     GError *error = NULL;
     GOptionContext *context;
 
-    bindtextdomain(GETTEXT_PACKAGE, SPICE_GTK_LOCALEDIR);
-    bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
-    textdomain(GETTEXT_PACKAGE);
-
     /* parse opts */
-    context = g_option_context_new(_(" - make screen shots"));
-    g_option_context_set_summary(context, _("A Spice server client to take screenshots in ppm format."));
-    g_option_context_set_description(context, _("Report bugs to " PACKAGE_BUGREPORT "."));
+    context = g_option_context_new(" - make screen shots");
+    g_option_context_set_summary(context, "A Spice server client to take screenshots in ppm format.");
+    g_option_context_set_description(context, "Report bugs to " PACKAGE_BUGREPORT ".");
     g_option_context_set_main_group(context, spice_cmdline_get_option_group());
     g_option_context_add_main_entries(context, app_entries, NULL);
     if (!g_option_context_parse (context, &argc, &argv, &error)) {
-        g_print(_("option parsing failed: %s\n"), error->message);
+        g_print("option parsing failed: %s\n", error->message);
         exit(1);
     }
 
@@ -187,7 +182,7 @@ int main(int argc, char *argv[])
     spice_cmdline_session_setup(session);
 
     if (!spice_session_connect(session)) {
-        fprintf(stderr, _("spice_session_connect failed\n"));
+        fprintf(stderr, "spice_session_connect failed\n");
         exit(1);
     }
 
diff --git a/src/spicy-stats.c b/src/spicy-stats.c
index c98148d..d8a4706 100644
--- a/src/spicy-stats.c
+++ b/src/spicy-stats.c
@@ -16,7 +16,6 @@
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
 #include "config.h"
-#include <glib/gi18n.h>
 
 #include "spice-client.h"
 #include "spice-common.h"
@@ -68,7 +67,7 @@ static GOptionEntry app_entries[] = {
         .long_name        = "version",
         .arg              = G_OPTION_ARG_NONE,
         .arg_data         = &version,
-        .description      = N_("Display version and quit"),
+        .description      = "Display version and quit",
     },
     {
         /* end of list */
@@ -88,18 +87,14 @@ int main(int argc, char *argv[])
 
     signal(SIGINT, signal_handler);
 
-    bindtextdomain(GETTEXT_PACKAGE, SPICE_GTK_LOCALEDIR);
-    bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
-    textdomain(GETTEXT_PACKAGE);
-
     /* parse opts */
     context = g_option_context_new(NULL);
-    g_option_context_set_summary(context, _("A Spice client used for testing and measurements."));
-    g_option_context_set_description(context, _("Report bugs to " PACKAGE_BUGREPORT "."));
+    g_option_context_set_summary(context, "A Spice client used for testing and measurements.");
+    g_option_context_set_description(context, "Report bugs to " PACKAGE_BUGREPORT ".");
     g_option_context_set_main_group(context, spice_cmdline_get_option_group());
     g_option_context_add_main_entries(context, app_entries, NULL);
     if (!g_option_context_parse (context, &argc, &argv, &error)) {
-        g_print(_("option parsing failed: %s\n"), error->message);
+        g_print("option parsing failed: %s\n", error->message);
         exit(1);
     }
 
@@ -119,7 +114,7 @@ int main(int argc, char *argv[])
     spice_cmdline_session_setup(session);
 
     if (!spice_session_connect(session)) {
-        fprintf(stderr, _("spice_session_connect failed\n"));
+        fprintf(stderr, "spice_session_connect failed\n");
         exit(1);
     }
 
diff --git a/src/spicy.c b/src/spicy.c
index 15ef377..f48a220 100644
--- a/src/spicy.c
+++ b/src/spicy.c
@@ -17,7 +17,7 @@
 */
 
 #include "config.h"
-#include <glib/gi18n.h>
+#include <glib.h>
 
 #include <sys/stat.h>
 #ifdef HAVE_TERMIOS_H
@@ -185,10 +185,10 @@ static void update_status_window(SpiceWindow *win)
     if (win->mouse_grabbed) {
         SpiceGrabSequence *sequence = spice_display_get_grab_keys(SPICE_DISPLAY(win->spice));
         gchar *seq = spice_grab_sequence_as_string(sequence);
-        status = g_strdup_printf(_("Use %s to ungrab mouse."), seq);
+        status = g_strdup_printf("Use %s to ungrab mouse.", seq);
         g_free(seq);
     } else {
-        status = g_strdup_printf(_("mouse: %s, agent: %s"),
+        status = g_strdup_printf("mouse: %s, agent: %s",
                  win->conn->mouse_state, win->conn->agent_state);
     }
 
@@ -364,7 +364,7 @@ static void menu_cb_select_usb_devices(GtkAction *action, void *data)
 
     /* Create the widgets */
     dialog = gtk_dialog_new_with_buttons(
-                    _("Select USB devices for redirection"),
+                    "Select USB devices for redirection",
                     GTK_WINDOW(win->toplevel),
                     GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
                     GTK_STOCK_CLOSE, GTK_RESPONSE_ACCEPT,
@@ -400,7 +400,7 @@ static void menu_cb_bool_prop(GtkToggleAction *action, gpointer data)
     gpointer object;
 
     name = gtk_action_get_name(GTK_ACTION(action));
-    SPICE_DEBUG("%s: %s = %s", __FUNCTION__, name, state ? _("yes") : _("no"));
+    SPICE_DEBUG("%s: %s = %s", __FUNCTION__, name, state ? "yes" : "no");
 
     g_key_file_set_boolean(keyfile, "general", name, state);
 
@@ -446,8 +446,8 @@ static void menu_cb_statusbar(GtkToggleAction *action, gpointer data)
 
 static void menu_cb_about(GtkAction *action, void *data)
 {
-    char *comments = _("gtk test client app for the\n"
-        "spice remote desktop protocol");
+    char *comments = "gtk test client app for the\n"
+        "spice remote desktop protocol";
     static const char *copyright = "(c) 2010 Red Hat";
     static const char *website = "http://www.spice-space.org";
     static const char *authors[] = { "Gerd Hoffmann <kraxel at redhat.com>",
@@ -635,12 +635,12 @@ static const GtkActionEntry entries[] = {
         /* File menu */
         .name        = "Connect",
         .stock_id    = GTK_STOCK_CONNECT,
-        .label       = N_("_Connect ..."),
+        .label       = "_Connect ...",
         .callback    = G_CALLBACK(menu_cb_connect),
     },{
         .name        = "Close",
         .stock_id    = GTK_STOCK_CLOSE,
-        .label       = N_("_Close"),
+        .label       = "_Close",
         .callback    = G_CALLBACK(menu_cb_close),
         .accelerator = "", /* none (disable default "<control>W") */
     },{
@@ -648,13 +648,13 @@ static const GtkActionEntry entries[] = {
         /* Edit menu */
         .name        = "CopyToGuest",
         .stock_id    = GTK_STOCK_COPY,
-        .label       = N_("_Copy to guest"),
+        .label       = "_Copy to guest",
         .callback    = G_CALLBACK(menu_cb_copy),
         .accelerator = "", /* none (disable default "<control>C") */
     },{
         .name        = "PasteFromGuest",
         .stock_id    = GTK_STOCK_PASTE,
-        .label       = N_("_Paste from guest"),
+        .label       = "_Paste from guest",
         .callback    = G_CALLBACK(menu_cb_paste),
         .accelerator = "", /* none (disable default "<control>V") */
     },{
@@ -662,18 +662,18 @@ static const GtkActionEntry entries[] = {
         /* View menu */
         .name        = "Fullscreen",
         .stock_id    = GTK_STOCK_FULLSCREEN,
-        .label       = N_("_Fullscreen"),
+        .label       = "_Fullscreen",
         .callback    = G_CALLBACK(menu_cb_fullscreen),
         .accelerator = "<shift>F11",
     },{
 #ifdef USE_SMARTCARD
 	.name        = "InsertSmartcard",
-	.label       = N_("_Insert Smartcard"),
+	.label       = "_Insert Smartcard",
 	.callback    = G_CALLBACK(menu_cb_insert_smartcard),
         .accelerator = "<shift>F8",
     },{
 	.name        = "RemoveSmartcard",
-	.label       = N_("_Remove Smartcard"),
+	.label       = "_Remove Smartcard",
 	.callback    = G_CALLBACK(menu_cb_remove_smartcard),
         .accelerator = "<shift>F9",
     },{
@@ -681,7 +681,7 @@ static const GtkActionEntry entries[] = {
 
 #ifdef USE_USBREDIR
         .name        = "SelectUsbDevices",
-        .label       = N_("_Select USB Devices for redirection"),
+        .label       = "_Select USB Devices for redirection",
         .callback    = G_CALLBACK(menu_cb_select_usb_devices),
         .accelerator = "<shift>F10",
     },{
@@ -690,7 +690,7 @@ static const GtkActionEntry entries[] = {
         /* Help menu */
         .name        = "About",
         .stock_id    = GTK_STOCK_ABOUT,
-        .label       = N_("_About ..."),
+        .label       = "_About ...",
         .callback    = G_CALLBACK(menu_cb_about),
     }
 };
@@ -711,39 +711,39 @@ static const char *spice_gtk_session_properties[] = {
 static const GtkToggleActionEntry tentries[] = {
     {
         .name        = "grab-keyboard",
-        .label       = N_("Grab keyboard when active and focused"),
+        .label       = "Grab keyboard when active and focused",
         .callback    = G_CALLBACK(menu_cb_bool_prop),
     },{
         .name        = "grab-mouse",
-        .label       = N_("Grab mouse in server mode (no tabled/vdagent)"),
+        .label       = "Grab mouse in server mode (no tabled/vdagent)",
         .callback    = G_CALLBACK(menu_cb_bool_prop),
     },{
         .name        = "resize-guest",
-        .label       = N_("Resize guest to match window size"),
+        .label       = "Resize guest to match window size",
         .callback    = G_CALLBACK(menu_cb_bool_prop),
     },{
         .name        = "scaling",
-        .label       = N_("Scale display"),
+        .label       = "Scale display",
         .callback    = G_CALLBACK(menu_cb_bool_prop),
     },{
         .name        = "disable-inputs",
-        .label       = N_("Disable inputs"),
+        .label       = "Disable inputs",
         .callback    = G_CALLBACK(menu_cb_bool_prop),
     },{
         .name        = "auto-clipboard",
-        .label       = N_("Automagic clipboard sharing between host and guest"),
+        .label       = "Automagic clipboard sharing between host and guest",
         .callback    = G_CALLBACK(menu_cb_bool_prop),
     },{
         .name        = "auto-usbredir",
-        .label       = N_("Auto redirect newly plugged in USB devices"),
+        .label       = "Auto redirect newly plugged in USB devices",
         .callback    = G_CALLBACK(menu_cb_bool_prop),
     },{
         .name        = "Statusbar",
-        .label       = N_("Statusbar"),
+        .label       = "Statusbar",
         .callback    = G_CALLBACK(menu_cb_statusbar),
     },{
         .name        = "Toolbar",
-        .label       = N_("Toolbar"),
+        .label       = "Toolbar",
         .callback    = G_CALLBACK(menu_cb_toolbar),
     }
 };
@@ -874,7 +874,7 @@ static SpiceWindow *create_spice_window(spice_connection *conn, SpiceChannel *ch
     /* toplevel */
     win->toplevel = gtk_window_new(GTK_WINDOW_TOPLEVEL);
     if (spicy_title == NULL) {
-        snprintf(title, sizeof(title), _("spice display %d:%d"), id, monitor_id);
+        snprintf(title, sizeof(title), "spice display %d:%d", id, monitor_id);
     } else {
         snprintf(title, sizeof(title), "%s", spicy_title);
     }
@@ -951,7 +951,7 @@ static SpiceWindow *create_spice_window(spice_connection *conn, SpiceChannel *ch
     gtk_container_add(GTK_CONTAINER(frame), win->status);
 
     for (i = 0; i < STATE_MAX; i++) {
-        win->st[i] = gtk_label_new(_("?"));
+        win->st[i] = gtk_label_new("?");
         gtk_label_set_width_chars(GTK_LABEL(win->st[i]), 5);
         frame = gtk_frame_new(NULL);
         gtk_box_pack_end(GTK_BOX(win->statusbar), frame, FALSE, FALSE, 0);
@@ -1125,8 +1125,8 @@ static void main_channel_event(SpiceChannel *channel, SpiceChannelEvent event,
         g_warning("main channel: auth failure (wrong password?)");
         strcpy(password, "");
         /* FIXME i18 */
-        rc = ask_user(NULL, _("Authentication"),
-                      _("Please enter the spice server password"),
+        rc = ask_user(NULL, "Authentication",
+                      "Please enter the spice server password",
                       password, sizeof(password), true);
         if (rc == 0) {
             g_object_set(conn->session, "password", password, NULL);
@@ -1168,7 +1168,7 @@ static void main_agent_update(SpiceChannel *channel, gpointer data)
     spice_connection *conn = data;
 
     g_object_get(channel, "agent-connected", &conn->agent_connected, NULL);
-    conn->agent_state = conn->agent_connected ? _("yes") : _("no");
+    conn->agent_state = conn->agent_connected ? "yes" : "no";
     update_status(conn);
     update_edit_menu(conn);
 }
@@ -1184,11 +1184,11 @@ static void inputs_modifiers(SpiceChannel *channel, gpointer data)
             continue;
 
         gtk_label_set_text(GTK_LABEL(conn->wins[i]->st[STATE_SCROLL_LOCK]),
-                           m & SPICE_KEYBOARD_MODIFIER_FLAGS_SCROLL_LOCK ? _("SCROLL") : "");
+                           m & SPICE_KEYBOARD_MODIFIER_FLAGS_SCROLL_LOCK ? "SCROLL" : "");
         gtk_label_set_text(GTK_LABEL(conn->wins[i]->st[STATE_CAPS_LOCK]),
-                           m & SPICE_KEYBOARD_MODIFIER_FLAGS_CAPS_LOCK ? _("CAPS") : "");
+                           m & SPICE_KEYBOARD_MODIFIER_FLAGS_CAPS_LOCK ? "CAPS" : "");
         gtk_label_set_text(GTK_LABEL(conn->wins[i]->st[STATE_NUM_LOCK]),
-                           m & SPICE_KEYBOARD_MODIFIER_FLAGS_NUM_LOCK ? _("NUM") : "");
+                           m & SPICE_KEYBOARD_MODIFIER_FLAGS_NUM_LOCK ? "NUM" : "");
     }
 }
 
@@ -1556,18 +1556,18 @@ static GOptionEntry cmd_entries[] = {
         .short_name       = 'f',
         .arg              = G_OPTION_ARG_NONE,
         .arg_data         = &fullscreen,
-        .description      = N_("Open in full screen mode"),
+        .description      = "Open in full screen mode",
     },{
         .long_name        = "version",
         .arg              = G_OPTION_ARG_NONE,
         .arg_data         = &version,
-        .description      = N_("Display version and quit"),
+        .description      = "Display version and quit",
     },{
         .long_name        = "title",
         .arg              = G_OPTION_ARG_STRING,
         .arg_data         = &spicy_title,
-        .description      = N_("Set the window title"),
-        .arg_description  = N_("<title>"),
+        .description      = "Set the window title",
+        .arg_description  = "<title>",
     },{
         /* end of list */
     }
@@ -1637,10 +1637,6 @@ int main(int argc, char *argv[])
 #if !GLIB_CHECK_VERSION(2,31,18)
     g_thread_init(NULL);
 #endif
-    bindtextdomain(GETTEXT_PACKAGE, SPICE_GTK_LOCALEDIR);
-    bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
-    textdomain(GETTEXT_PACKAGE);
-
     keyfile = g_key_file_new();
 
     int mode = S_IRWXU;
@@ -1658,15 +1654,15 @@ int main(int argc, char *argv[])
 
     /* parse opts */
     gtk_init(&argc, &argv);
-    context = g_option_context_new(_("- spice client test application"));
-    g_option_context_set_summary(context, _("Gtk+ test client to connect to Spice servers."));
-    g_option_context_set_description(context, _("Report bugs to " PACKAGE_BUGREPORT "."));
+    context = g_option_context_new("- spice client test application");
+    g_option_context_set_summary(context, "Gtk+ test client to connect to Spice servers.");
+    g_option_context_set_description(context, "Report bugs to " PACKAGE_BUGREPORT ".");
     g_option_context_add_group(context, spice_get_option_group());
     g_option_context_set_main_group(context, spice_cmdline_get_option_group());
     g_option_context_add_main_entries(context, cmd_entries, NULL);
     g_option_context_add_group(context, gtk_get_option_group(TRUE));
     if (!g_option_context_parse (context, &argc, &argv, &error)) {
-        g_print(_("option parsing failed: %s\n"), error->message);
+        g_print("option parsing failed: %s\n", error->message);
         exit(1);
     }
     g_option_context_free(context);
-- 
2.4.3



More information about the Spice-devel mailing list