1
0
Jelajahi Sumber

Mark strings for translation

Héctor García 10 tahun lalu
induk
melakukan
85db02715a
3 mengubah file dengan 33 tambahan dan 28 penghapusan
  1. 18 15
      src/mssh-pref.c
  2. 9 9
      src/mssh-window.c
  3. 6 4
      src/mssh.c

+ 18 - 15
src/mssh-pref.c

@@ -1,5 +1,8 @@
 #include <gconf/gconf-client.h>
 
+#define GETTEXT_PACKAGE "mssh"
+#include <glib/gi18n-lib.h>
+
 #include "mssh-gconf.h"
 
 #include "mssh-pref.h"
@@ -209,49 +212,49 @@ static void mssh_pref_init(MSSHPref* pref)
     GtkWidget *content = gtk_box_new(GTK_ORIENTATION_VERTICAL, 4);
 
     GtkWidget *font_hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 10);
-    GtkWidget *font_label = gtk_label_new("Font:");
+    GtkWidget *font_label = gtk_label_new(_("Font:"));
     GtkWidget *font_select = gtk_font_button_new();
 
     GtkWidget *colour_table = gtk_grid_new();
-    GtkWidget *bg_colour_label = gtk_label_new("Background:");
+    GtkWidget *bg_colour_label = gtk_label_new(_("Background:"));
     GtkWidget *bg_colour_select = gtk_color_button_new();
-    GtkWidget *fg_colour_label = gtk_label_new("Foreground:");
+    GtkWidget *fg_colour_label = gtk_label_new(_("Foreground:"));
     GtkWidget *fg_colour_select = gtk_color_button_new();
 
     GtkWidget *recolor_focused_check = gtk_check_button_new_with_label(
-        "Use different color for focused window");
+        _("Use different color for focused window"));
 
     GtkWidget *colour_table_focus = gtk_grid_new();
-    GtkWidget *bg_colour_label_focus = gtk_label_new("Background for focused window:");
+    GtkWidget *bg_colour_label_focus = gtk_label_new(_("Background for focused window:"));
     GtkWidget *bg_colour_select_focus = gtk_color_button_new();
-    GtkWidget *fg_colour_label_focus = gtk_label_new("Foreground for focused window:");
+    GtkWidget *fg_colour_label_focus = gtk_label_new(_("Foreground for focused window:"));
     GtkWidget *fg_colour_select_focus = gtk_color_button_new();
     GtkWidget *exit_check = gtk_check_button_new_with_label(
-        "Quit after all sessions have ended");
+        _("Quit after all sessions have ended"));
     GtkWidget *close_check = gtk_check_button_new_with_label(
-        "Close ended sessions");
+        _("Close ended sessions"));
 
     GtkWidget *timeout_hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 10);
     GtkWidget *timeout_label1 = gtk_label_new(
-        "Closed ended sessions after");
+        _("Closed ended sessions after"));
     GtkAdjustment *timeout_adj = gtk_adjustment_new(3, 0, 100, 1, 10, 0);
     GtkWidget *timeout_select = gtk_spin_button_new(
         GTK_ADJUSTMENT(timeout_adj), 1, 0);
-    GtkWidget *timeout_label2 = gtk_label_new("seconds");
+    GtkWidget *timeout_label2 = gtk_label_new(_("seconds"));
 
     GtkWidget *columns_hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 10);
-    GtkWidget *columns_label = gtk_label_new("Columns:");
+    GtkWidget *columns_label = gtk_label_new(_("Columns:"));
     GtkAdjustment *columns_adj = gtk_adjustment_new(2, 1, 10, 1, 10, 0);
     GtkWidget *columns_select = gtk_spin_button_new(
         GTK_ADJUSTMENT(columns_adj), 1, 0);
 
     GtkWidget *backscroll_buffer_size_hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 10);
-    GtkWidget *backscroll_buffer_size_label = gtk_label_new("Scrollback Lines:");
+    GtkWidget *backscroll_buffer_size_label = gtk_label_new(_("Scrollback Lines:"));
     GtkAdjustment *backscroll_buffer_size_adj = gtk_adjustment_new(5000, -1, 65535, 1, 100, 0);
     GtkWidget *backscroll_buffer_size_select = gtk_spin_button_new(
         GTK_ADJUSTMENT(backscroll_buffer_size_adj), 1, 0);  
     GtkWidget *mod_hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 10);
-    GtkWidget *mod_label = gtk_label_new("Modifier:");
+    GtkWidget *mod_label = gtk_label_new(_("Modifier:"));
     GtkWidget *mod_ctrl_check = gtk_check_button_new_with_label("Ctrl");
     GtkWidget *mod_alt_check = gtk_check_button_new_with_label("Alt");
     GtkWidget *mod_shift_check = gtk_check_button_new_with_label("Shift");
@@ -261,7 +264,7 @@ static void mssh_pref_init(MSSHPref* pref)
     GtkWidget *close_button = gtk_button_new_from_stock(GTK_STOCK_CLOSE);
 
     GtkWidget *dir_focus_check = gtk_check_button_new_with_label(
-        "Use directional focus");
+        _("Use directional focus"));
 
     pref->ctrl = mod_ctrl_check;
     pref->shift = mod_shift_check;
@@ -339,7 +342,7 @@ static void mssh_pref_init(MSSHPref* pref)
 
     gtk_container_set_border_width(GTK_CONTAINER(content), 6);
     gtk_container_set_border_width(GTK_CONTAINER(pref), 15);
-    gtk_window_set_title(GTK_WINDOW(pref), "Preferences");
+    gtk_window_set_title(GTK_WINDOW(pref), _("Preferences"));
     gtk_window_set_resizable(GTK_WINDOW(pref), FALSE);
 
     g_signal_connect(G_OBJECT(font_select), "font-set",

+ 9 - 9
src/mssh-window.c

@@ -6,7 +6,7 @@
 #include <gdk/gdkkeysyms.h>
 #include <gtk/gtk.h>
 
-#define GETTEXT_PACKAGE "gtk20"
+#define GETTEXT_PACKAGE "mssh"
 #include <glib/gi18n-lib.h>
 
 #include "mssh-terminal.h"
@@ -268,7 +268,7 @@ static gboolean mssh_window_session_close(gpointer data)
     if(idx == -1)
     {
         fprintf(stderr,
-            "mssh: Fatal Error: Can't find terminal to remove!\n");
+            _("mssh: Fatal Error: Can't find terminal to remove!\n"));
     }
     else
     {
@@ -478,14 +478,14 @@ static void mssh_window_init(MSSHWindow* window)
     GtkWidget *server_item = gtk_menu_item_new_with_label(_("Servers"));
     GtkWidget *command_item = gtk_menu_item_new_with_label(_("Commands"));
 
-    GtkWidget *file_quit = gtk_image_menu_item_new_with_label(
+    GtkWidget *file_quit = gtk_menu_item_new_with_label(
         _("Quit"));
-    GtkWidget *file_sendhost = gtk_image_menu_item_new_with_label(
+    GtkWidget *file_sendhost = gtk_menu_item_new_with_label(
         _("Send hostname"));
     GtkWidget *file_add = gtk_menu_item_new_with_label(
         _("Add session"));
 
-    GtkWidget *edit_pref = gtk_image_menu_item_new_with_label(
+    GtkWidget *edit_pref = gtk_menu_item_new_with_label(
         _("Edit"));
 
     GtkAccelGroup *accel = gtk_accel_group_new();
@@ -816,7 +816,7 @@ static void mssh_window_add(GtkWidget *widget, gpointer data)
     content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
 
     /* label for text */
-    label = gtk_label_new ("Add new session with hostname: ");
+    label = gtk_label_new (_("Add new session with hostname: "));
 
     /* Add the label and entry, and show everything we've added to the dialog */
     new_session_entry = gtk_entry_new();
@@ -826,8 +826,8 @@ static void mssh_window_add(GtkWidget *widget, gpointer data)
     gtk_container_add (GTK_CONTAINER (content_area), label);
     gtk_container_add (GTK_CONTAINER (content_area), new_session_entry);
     /* add two buttons */
-    button_add = gtk_dialog_add_button(GTK_DIALOG(dialog), "Add", GTK_RESPONSE_ACCEPT);
-    gtk_dialog_add_button(GTK_DIALOG(dialog), "Cancel", GTK_RESPONSE_CANCEL);
+    button_add = gtk_dialog_add_button(GTK_DIALOG(dialog), _("Add"), GTK_RESPONSE_ACCEPT);
+    gtk_dialog_add_button(GTK_DIALOG(dialog), _("Cancel"), GTK_RESPONSE_CANCEL);
     /* make the add button the default */
     gtk_widget_grab_default(button_add);
     /* set dialog properties (modal, etc) */
@@ -835,7 +835,7 @@ static void mssh_window_add(GtkWidget *widget, gpointer data)
     gtk_window_set_destroy_with_parent(GTK_WINDOW(dialog), TRUE);
     gtk_window_set_transient_for (GTK_WINDOW(dialog), GTK_WINDOW(window));
     /* set it's title */
-    gtk_window_set_title(GTK_WINDOW(dialog), "Add new session");
+    gtk_window_set_title(GTK_WINDOW(dialog), _("Add new session"));
 
     /* catch the activate signal (hitting enter) */
     g_signal_connect(G_OBJECT(new_session_entry), "activate",

+ 6 - 4
src/mssh.c

@@ -4,7 +4,7 @@
 #include <getopt.h>
 #include <errno.h>
 
-#define GETTEXT_PACKAGE "gtk20"
+#define GETTEXT_PACKAGE "mssh"
 #include <glib/gi18n-lib.h>
 
 #include <gtk/gtk.h>
@@ -246,9 +246,6 @@ int main(int argc, char* argv[], char* env[])
         {0, 0, 0, 0}
     };
 
-    bindtextdomain(GETTEXT_PACKAGE, PROGRAMNAME_LOCALEDIR);
-    bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
-    textdomain(GETTEXT_PACKAGE);
 
     if((home = getenv("HOME")) != NULL)
     {
@@ -355,6 +352,11 @@ int main(int argc, char* argv[], char* env[])
 
     gtk_init(&argc, &argv);
 
+    setlocale (LC_ALL, "");
+    bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR);
+    bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
+    textdomain(GETTEXT_PACKAGE);
+
     window = GTK_WIDGET(mssh_window_new());
 
     g_signal_connect(G_OBJECT(window), "destroy",