[PATCH] Kconfig i18n support
[safe/jmp/linux-2.6] / scripts / kconfig / gconf.c
index 6fdbe6e..ad6b120 100644 (file)
@@ -41,7 +41,7 @@ static gboolean resizeable = FALSE;
 static gboolean config_changed = FALSE;
 
 static char nohelp_text[] =
-    "Sorry, no help available for this option yet.\n";
+    N_("Sorry, no help available for this option yet.\n");
 
 GtkWidget *main_wnd = NULL;
 GtkWidget *tree1_w = NULL;     // left  frame
@@ -193,7 +193,7 @@ void init_main_window(const gchar * glade_file)
 
        xml = glade_xml_new(glade_file, "window1", NULL);
        if (!xml)
-               g_error("GUI loading failed !\n");
+               g_error(_("GUI loading failed !\n"));
        glade_xml_signal_autoconnect(xml);
 
        main_wnd = glade_xml_get_widget(xml, "window1");
@@ -275,7 +275,7 @@ void init_main_window(const gchar * glade_file)
                                          /*"style", PANGO_STYLE_OBLIQUE, */
                                          NULL);
 
-       sprintf(title, "Linux Kernel v%s Configuration",
+       sprintf(title, _("Linux Kernel v%s Configuration"),
                getenv("KERNELRELEASE"));
        gtk_window_set_title(GTK_WINDOW(main_wnd), title);
 
@@ -325,7 +325,7 @@ void init_left_tree(void)
        
        column = gtk_tree_view_column_new();
        gtk_tree_view_append_column(view, column);
-       gtk_tree_view_column_set_title(column, "Options");
+       gtk_tree_view_column_set_title(column, _("Options"));
 
        renderer = gtk_cell_renderer_toggle_new();
        gtk_tree_view_column_pack_start(GTK_TREE_VIEW_COLUMN(column),
@@ -370,7 +370,7 @@ void init_right_tree(void)
 
        column = gtk_tree_view_column_new();
        gtk_tree_view_append_column(view, column);
-       gtk_tree_view_column_set_title(column, "Options");
+       gtk_tree_view_column_set_title(column, _("Options"));
 
        renderer = gtk_cell_renderer_pixbuf_new();
        gtk_tree_view_column_pack_start(GTK_TREE_VIEW_COLUMN(column),
@@ -401,7 +401,7 @@ void init_right_tree(void)
 
        renderer = gtk_cell_renderer_text_new();
        gtk_tree_view_insert_column_with_attributes(view, -1,
-                                                   "Name", renderer,
+                                                   _("Name"), renderer,
                                                    "text", COL_NAME,
                                                    "foreground-gdk",
                                                    COL_COLOR, NULL);
@@ -425,7 +425,7 @@ void init_right_tree(void)
                                                    COL_COLOR, NULL);
        renderer = gtk_cell_renderer_text_new();
        gtk_tree_view_insert_column_with_attributes(view, -1,
-                                                   "Value", renderer,
+                                                   _("Value"), renderer,
                                                    "text", COL_VALUE,
                                                    "editable",
                                                    COL_EDIT,
@@ -466,15 +466,15 @@ static void text_insert_help(struct menu *menu)
        GtkTextIter start, end;
        const char *prompt = menu_get_prompt(menu);
        gchar *name;
-       const char *help = nohelp_text;
+       const char *help = _(nohelp_text);
 
        if (!menu->sym)
                help = "";
        else if (menu->sym->help)
-               help = menu->sym->help;
+               help = _(menu->sym->help);
 
        if (menu->sym && menu->sym->name)
-               name = g_strdup_printf(menu->sym->name);
+               name = g_strdup_printf(_(menu->sym->name));
        else
                name = g_strdup("");
 
@@ -530,7 +530,7 @@ gboolean on_window1_delete_event(GtkWidget * widget, GdkEvent * event,
        if (config_changed == FALSE)
                return FALSE;
 
-       dialog = gtk_dialog_new_with_buttons("Warning !",
+       dialog = gtk_dialog_new_with_buttons(_("Warning !"),
                                             GTK_WINDOW(main_wnd),
                                             (GtkDialogFlags)
                                             (GTK_DIALOG_MODAL |
@@ -544,7 +544,7 @@ gboolean on_window1_delete_event(GtkWidget * widget, GdkEvent * event,
        gtk_dialog_set_default_response(GTK_DIALOG(dialog),
                                        GTK_RESPONSE_CANCEL);
 
-       label = gtk_label_new("\nSave configuration ?\n");
+       label = gtk_label_new(_("\nSave configuration ?\n"));
        gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), label);
        gtk_widget_show(label);
 
@@ -604,7 +604,7 @@ load_filename(GtkFileSelection * file_selector, gpointer user_data)
                                             (user_data));
 
        if (conf_read(fn))
-               text_insert_msg("Error", "Unable to load configuration !");
+               text_insert_msg(_("Error"), _("Unable to load configuration !"));
        else
                display_tree(&rootmenu);
 }
@@ -613,7 +613,7 @@ void on_load1_activate(GtkMenuItem * menuitem, gpointer user_data)
 {
        GtkWidget *fs;
 
-       fs = gtk_file_selection_new("Load file...");
+       fs = gtk_file_selection_new(_("Load file..."));
        g_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(fs)->ok_button),
                         "clicked",
                         G_CALLBACK(load_filename), (gpointer) fs);
@@ -632,7 +632,7 @@ void on_load1_activate(GtkMenuItem * menuitem, gpointer user_data)
 void on_save1_activate(GtkMenuItem * menuitem, gpointer user_data)
 {
        if (conf_write(NULL))
-               text_insert_msg("Error", "Unable to save configuration !");
+               text_insert_msg(_("Error"), _("Unable to save configuration !"));
 
        config_changed = FALSE;
 }
@@ -647,7 +647,7 @@ store_filename(GtkFileSelection * file_selector, gpointer user_data)
                                             (user_data));
 
        if (conf_write(fn))
-               text_insert_msg("Error", "Unable to save configuration !");
+               text_insert_msg(_("Error"), _("Unable to save configuration !"));
 
        gtk_widget_destroy(GTK_WIDGET(user_data));
 }
@@ -656,7 +656,7 @@ void on_save_as1_activate(GtkMenuItem * menuitem, gpointer user_data)
 {
        GtkWidget *fs;
 
-       fs = gtk_file_selection_new("Save file as...");
+       fs = gtk_file_selection_new(_("Save file as..."));
        g_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(fs)->ok_button),
                         "clicked",
                         G_CALLBACK(store_filename), (gpointer) fs);
@@ -740,7 +740,7 @@ on_show_debug_info1_activate(GtkMenuItem * menuitem, gpointer user_data)
 void on_introduction1_activate(GtkMenuItem * menuitem, gpointer user_data)
 {
        GtkWidget *dialog;
-       const gchar *intro_text =
+       const gchar *intro_text = _(
            "Welcome to gkc, the GTK+ graphical kernel configuration tool\n"
            "for Linux.\n"
            "For each option, a blank box indicates the feature is disabled, a\n"
@@ -756,7 +756,7 @@ void on_introduction1_activate(GtkMenuItem * menuitem, gpointer user_data)
            "option.\n"
            "\n"
            "Toggling Show Debug Info under the Options menu will show \n"
-           "the dependencies, which you can then match by examining other options.";
+           "the dependencies, which you can then match by examining other options.");
 
        dialog = gtk_message_dialog_new(GTK_WINDOW(main_wnd),
                                        GTK_DIALOG_DESTROY_WITH_PARENT,
@@ -773,8 +773,8 @@ void on_about1_activate(GtkMenuItem * menuitem, gpointer user_data)
 {
        GtkWidget *dialog;
        const gchar *about_text =
-           "gkc is copyright (c) 2002 Romain Lievin <roms@lpg.ticalc.org>.\n"
-           "Based on the source code from Roman Zippel.\n";
+           _("gkc is copyright (c) 2002 Romain Lievin <roms@lpg.ticalc.org>.\n"
+             "Based on the source code from Roman Zippel.\n");
 
        dialog = gtk_message_dialog_new(GTK_WINDOW(main_wnd),
                                        GTK_DIALOG_DESTROY_WITH_PARENT,
@@ -791,9 +791,9 @@ void on_license1_activate(GtkMenuItem * menuitem, gpointer user_data)
 {
        GtkWidget *dialog;
        const gchar *license_text =
-           "gkc is released under the terms of the GNU GPL v2.\n"
-           "For more information, please see the source code or\n"
-           "visit http://www.fsf.org/licenses/licenses.html\n";
+           _("gkc is released under the terms of the GNU GPL v2.\n"
+             "For more information, please see the source code or\n"
+             "visit http://www.fsf.org/licenses/licenses.html\n");
 
        dialog = gtk_message_dialog_new(GTK_WINDOW(main_wnd),
                                        GTK_DIALOG_DESTROY_WITH_PARENT,
@@ -1579,6 +1579,10 @@ int main(int ac, char *av[])
        kconfig_load();
 #endif
 
+       bindtextdomain(PACKAGE, LOCALEDIR);
+       bind_textdomain_codeset(PACKAGE, "UTF-8");
+       textdomain(PACKAGE);
+
        /* GTK stuffs */
        gtk_set_locale();
        gtk_init(&ac, &av);