aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/kconfig/gconf.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@ghostprotocols.net>2005-05-05 18:09:46 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-05-05 18:24:00 -0400
commit3b9fa0931dd86a1fe5507311ee8031650f5d0e8c (patch)
treeb40a8a09aca2b52f40d548b34c48ea46ba10b90f /scripts/kconfig/gconf.c
parentf403b7f452e4347f6af14c1f3c47bce758eb6337 (diff)
[PATCH] Kconfig i18n support
This patch adds i18n support for make *config, allowing users to have the config process in their own language. No printk was harmed in the process, don't worry, so all the bug reports, kernel messages, etc, remain in english, just the user tools to configure the kernel are internationalized. Users not interested in translations can just unset the related LANG, LC_ALL, etc env variables and have the config process in plain english, something like: LANG= make menuconfig is enough for having the whole config process in english. Or just don't install any translation file. Translations for brazilian portuguese are being done by a team of volunteers at: http://www.visionflex.inf.br/kernel_ptbr/pmwiki.php/Principal/Traducoes To start the translation process: make update-po-config This will generate the pot template named scripts/kconfig/linux.pot, copy it to, say, ~/es.po, to start the translation for spanish. To test your translation, as root issue this command: msgfmt -o /usr/share/locale/es/LC_MESSAGES/linux.mo ~/es.po Replace "es" with your language code. Then execute, for instance: make menuconfig The current patch doesn't use any optimization to reduce the size of the generated .mo file, it is possible to use the config option as a key, but this doesn't prevent the current patch from being used or the translations done under the current scheme to be in any way lost if we chose to do any kind of keying. Thanks to Fabricio Vaccari for starting the pt_BR (brazilian portuguese) translation effort, Thiago Maciera for helping me with the gconf.cc (QT frontent) i18n coding and to all the volunteers that are already working on the first translation, to pt_BR. I left the question on whether to ship the translations with the stock kernel sources to be discussed here, please share your suggestions. Signed-off-by: Arnaldo Carvalho de Melo <acme@conectiva.com.br> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org Signed-off-by: Andrew Morton <akpm@osdl.org>
Diffstat (limited to 'scripts/kconfig/gconf.c')
-rw-r--r--scripts/kconfig/gconf.c52
1 files changed, 28 insertions, 24 deletions
diff --git a/scripts/kconfig/gconf.c b/scripts/kconfig/gconf.c
index 6fdbe6e3ce0d..ad6b12043874 100644
--- a/scripts/kconfig/gconf.c
+++ b/scripts/kconfig/gconf.c
@@ -41,7 +41,7 @@ static gboolean resizeable = FALSE;
41static gboolean config_changed = FALSE; 41static gboolean config_changed = FALSE;
42 42
43static char nohelp_text[] = 43static char nohelp_text[] =
44 "Sorry, no help available for this option yet.\n"; 44 N_("Sorry, no help available for this option yet.\n");
45 45
46GtkWidget *main_wnd = NULL; 46GtkWidget *main_wnd = NULL;
47GtkWidget *tree1_w = NULL; // left frame 47GtkWidget *tree1_w = NULL; // left frame
@@ -193,7 +193,7 @@ void init_main_window(const gchar * glade_file)
193 193
194 xml = glade_xml_new(glade_file, "window1", NULL); 194 xml = glade_xml_new(glade_file, "window1", NULL);
195 if (!xml) 195 if (!xml)
196 g_error("GUI loading failed !\n"); 196 g_error(_("GUI loading failed !\n"));
197 glade_xml_signal_autoconnect(xml); 197 glade_xml_signal_autoconnect(xml);
198 198
199 main_wnd = glade_xml_get_widget(xml, "window1"); 199 main_wnd = glade_xml_get_widget(xml, "window1");
@@ -275,7 +275,7 @@ void init_main_window(const gchar * glade_file)
275 /*"style", PANGO_STYLE_OBLIQUE, */ 275 /*"style", PANGO_STYLE_OBLIQUE, */
276 NULL); 276 NULL);
277 277
278 sprintf(title, "Linux Kernel v%s Configuration", 278 sprintf(title, _("Linux Kernel v%s Configuration"),
279 getenv("KERNELRELEASE")); 279 getenv("KERNELRELEASE"));
280 gtk_window_set_title(GTK_WINDOW(main_wnd), title); 280 gtk_window_set_title(GTK_WINDOW(main_wnd), title);
281 281
@@ -325,7 +325,7 @@ void init_left_tree(void)
325 325
326 column = gtk_tree_view_column_new(); 326 column = gtk_tree_view_column_new();
327 gtk_tree_view_append_column(view, column); 327 gtk_tree_view_append_column(view, column);
328 gtk_tree_view_column_set_title(column, "Options"); 328 gtk_tree_view_column_set_title(column, _("Options"));
329 329
330 renderer = gtk_cell_renderer_toggle_new(); 330 renderer = gtk_cell_renderer_toggle_new();
331 gtk_tree_view_column_pack_start(GTK_TREE_VIEW_COLUMN(column), 331 gtk_tree_view_column_pack_start(GTK_TREE_VIEW_COLUMN(column),
@@ -370,7 +370,7 @@ void init_right_tree(void)
370 370
371 column = gtk_tree_view_column_new(); 371 column = gtk_tree_view_column_new();
372 gtk_tree_view_append_column(view, column); 372 gtk_tree_view_append_column(view, column);
373 gtk_tree_view_column_set_title(column, "Options"); 373 gtk_tree_view_column_set_title(column, _("Options"));
374 374
375 renderer = gtk_cell_renderer_pixbuf_new(); 375 renderer = gtk_cell_renderer_pixbuf_new();
376 gtk_tree_view_column_pack_start(GTK_TREE_VIEW_COLUMN(column), 376 gtk_tree_view_column_pack_start(GTK_TREE_VIEW_COLUMN(column),
@@ -401,7 +401,7 @@ void init_right_tree(void)
401 401
402 renderer = gtk_cell_renderer_text_new(); 402 renderer = gtk_cell_renderer_text_new();
403 gtk_tree_view_insert_column_with_attributes(view, -1, 403 gtk_tree_view_insert_column_with_attributes(view, -1,
404 "Name", renderer, 404 _("Name"), renderer,
405 "text", COL_NAME, 405 "text", COL_NAME,
406 "foreground-gdk", 406 "foreground-gdk",
407 COL_COLOR, NULL); 407 COL_COLOR, NULL);
@@ -425,7 +425,7 @@ void init_right_tree(void)
425 COL_COLOR, NULL); 425 COL_COLOR, NULL);
426 renderer = gtk_cell_renderer_text_new(); 426 renderer = gtk_cell_renderer_text_new();
427 gtk_tree_view_insert_column_with_attributes(view, -1, 427 gtk_tree_view_insert_column_with_attributes(view, -1,
428 "Value", renderer, 428 _("Value"), renderer,
429 "text", COL_VALUE, 429 "text", COL_VALUE,
430 "editable", 430 "editable",
431 COL_EDIT, 431 COL_EDIT,
@@ -466,15 +466,15 @@ static void text_insert_help(struct menu *menu)
466 GtkTextIter start, end; 466 GtkTextIter start, end;
467 const char *prompt = menu_get_prompt(menu); 467 const char *prompt = menu_get_prompt(menu);
468 gchar *name; 468 gchar *name;
469 const char *help = nohelp_text; 469 const char *help = _(nohelp_text);
470 470
471 if (!menu->sym) 471 if (!menu->sym)
472 help = ""; 472 help = "";
473 else if (menu->sym->help) 473 else if (menu->sym->help)
474 help = menu->sym->help; 474 help = _(menu->sym->help);
475 475
476 if (menu->sym && menu->sym->name) 476 if (menu->sym && menu->sym->name)
477 name = g_strdup_printf(menu->sym->name); 477 name = g_strdup_printf(_(menu->sym->name));
478 else 478 else
479 name = g_strdup(""); 479 name = g_strdup("");
480 480
@@ -530,7 +530,7 @@ gboolean on_window1_delete_event(GtkWidget * widget, GdkEvent * event,
530 if (config_changed == FALSE) 530 if (config_changed == FALSE)
531 return FALSE; 531 return FALSE;
532 532
533 dialog = gtk_dialog_new_with_buttons("Warning !", 533 dialog = gtk_dialog_new_with_buttons(_("Warning !"),
534 GTK_WINDOW(main_wnd), 534 GTK_WINDOW(main_wnd),
535 (GtkDialogFlags) 535 (GtkDialogFlags)
536 (GTK_DIALOG_MODAL | 536 (GTK_DIALOG_MODAL |
@@ -544,7 +544,7 @@ gboolean on_window1_delete_event(GtkWidget * widget, GdkEvent * event,
544 gtk_dialog_set_default_response(GTK_DIALOG(dialog), 544 gtk_dialog_set_default_response(GTK_DIALOG(dialog),
545 GTK_RESPONSE_CANCEL); 545 GTK_RESPONSE_CANCEL);
546 546
547 label = gtk_label_new("\nSave configuration ?\n"); 547 label = gtk_label_new(_("\nSave configuration ?\n"));
548 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), label); 548 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), label);
549 gtk_widget_show(label); 549 gtk_widget_show(label);
550 550
@@ -604,7 +604,7 @@ load_filename(GtkFileSelection * file_selector, gpointer user_data)
604 (user_data)); 604 (user_data));
605 605
606 if (conf_read(fn)) 606 if (conf_read(fn))
607 text_insert_msg("Error", "Unable to load configuration !"); 607 text_insert_msg(_("Error"), _("Unable to load configuration !"));
608 else 608 else
609 display_tree(&rootmenu); 609 display_tree(&rootmenu);
610} 610}
@@ -613,7 +613,7 @@ void on_load1_activate(GtkMenuItem * menuitem, gpointer user_data)
613{ 613{
614 GtkWidget *fs; 614 GtkWidget *fs;
615 615
616 fs = gtk_file_selection_new("Load file..."); 616 fs = gtk_file_selection_new(_("Load file..."));
617 g_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(fs)->ok_button), 617 g_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(fs)->ok_button),
618 "clicked", 618 "clicked",
619 G_CALLBACK(load_filename), (gpointer) fs); 619 G_CALLBACK(load_filename), (gpointer) fs);
@@ -632,7 +632,7 @@ void on_load1_activate(GtkMenuItem * menuitem, gpointer user_data)
632void on_save1_activate(GtkMenuItem * menuitem, gpointer user_data) 632void on_save1_activate(GtkMenuItem * menuitem, gpointer user_data)
633{ 633{
634 if (conf_write(NULL)) 634 if (conf_write(NULL))
635 text_insert_msg("Error", "Unable to save configuration !"); 635 text_insert_msg(_("Error"), _("Unable to save configuration !"));
636 636
637 config_changed = FALSE; 637 config_changed = FALSE;
638} 638}
@@ -647,7 +647,7 @@ store_filename(GtkFileSelection * file_selector, gpointer user_data)
647 (user_data)); 647 (user_data));
648 648
649 if (conf_write(fn)) 649 if (conf_write(fn))
650 text_insert_msg("Error", "Unable to save configuration !"); 650 text_insert_msg(_("Error"), _("Unable to save configuration !"));
651 651
652 gtk_widget_destroy(GTK_WIDGET(user_data)); 652 gtk_widget_destroy(GTK_WIDGET(user_data));
653} 653}
@@ -656,7 +656,7 @@ void on_save_as1_activate(GtkMenuItem * menuitem, gpointer user_data)
656{ 656{
657 GtkWidget *fs; 657 GtkWidget *fs;
658 658
659 fs = gtk_file_selection_new("Save file as..."); 659 fs = gtk_file_selection_new(_("Save file as..."));
660 g_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(fs)->ok_button), 660 g_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(fs)->ok_button),
661 "clicked", 661 "clicked",
662 G_CALLBACK(store_filename), (gpointer) fs); 662 G_CALLBACK(store_filename), (gpointer) fs);
@@ -740,7 +740,7 @@ on_show_debug_info1_activate(GtkMenuItem * menuitem, gpointer user_data)
740void on_introduction1_activate(GtkMenuItem * menuitem, gpointer user_data) 740void on_introduction1_activate(GtkMenuItem * menuitem, gpointer user_data)
741{ 741{
742 GtkWidget *dialog; 742 GtkWidget *dialog;
743 const gchar *intro_text = 743 const gchar *intro_text = _(
744 "Welcome to gkc, the GTK+ graphical kernel configuration tool\n" 744 "Welcome to gkc, the GTK+ graphical kernel configuration tool\n"
745 "for Linux.\n" 745 "for Linux.\n"
746 "For each option, a blank box indicates the feature is disabled, a\n" 746 "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)
756 "option.\n" 756 "option.\n"
757 "\n" 757 "\n"
758 "Toggling Show Debug Info under the Options menu will show \n" 758 "Toggling Show Debug Info under the Options menu will show \n"
759 "the dependencies, which you can then match by examining other options."; 759 "the dependencies, which you can then match by examining other options.");
760 760
761 dialog = gtk_message_dialog_new(GTK_WINDOW(main_wnd), 761 dialog = gtk_message_dialog_new(GTK_WINDOW(main_wnd),
762 GTK_DIALOG_DESTROY_WITH_PARENT, 762 GTK_DIALOG_DESTROY_WITH_PARENT,
@@ -773,8 +773,8 @@ void on_about1_activate(GtkMenuItem * menuitem, gpointer user_data)
773{ 773{
774 GtkWidget *dialog; 774 GtkWidget *dialog;
775 const gchar *about_text = 775 const gchar *about_text =
776 "gkc is copyright (c) 2002 Romain Lievin <roms@lpg.ticalc.org>.\n" 776 _("gkc is copyright (c) 2002 Romain Lievin <roms@lpg.ticalc.org>.\n"
777 "Based on the source code from Roman Zippel.\n"; 777 "Based on the source code from Roman Zippel.\n");
778 778
779 dialog = gtk_message_dialog_new(GTK_WINDOW(main_wnd), 779 dialog = gtk_message_dialog_new(GTK_WINDOW(main_wnd),
780 GTK_DIALOG_DESTROY_WITH_PARENT, 780 GTK_DIALOG_DESTROY_WITH_PARENT,
@@ -791,9 +791,9 @@ void on_license1_activate(GtkMenuItem * menuitem, gpointer user_data)
791{ 791{
792 GtkWidget *dialog; 792 GtkWidget *dialog;
793 const gchar *license_text = 793 const gchar *license_text =
794 "gkc is released under the terms of the GNU GPL v2.\n" 794 _("gkc is released under the terms of the GNU GPL v2.\n"
795 "For more information, please see the source code or\n" 795 "For more information, please see the source code or\n"
796 "visit http://www.fsf.org/licenses/licenses.html\n"; 796 "visit http://www.fsf.org/licenses/licenses.html\n");
797 797
798 dialog = gtk_message_dialog_new(GTK_WINDOW(main_wnd), 798 dialog = gtk_message_dialog_new(GTK_WINDOW(main_wnd),
799 GTK_DIALOG_DESTROY_WITH_PARENT, 799 GTK_DIALOG_DESTROY_WITH_PARENT,
@@ -1579,6 +1579,10 @@ int main(int ac, char *av[])
1579 kconfig_load(); 1579 kconfig_load();
1580#endif 1580#endif
1581 1581
1582 bindtextdomain(PACKAGE, LOCALEDIR);
1583 bind_textdomain_codeset(PACKAGE, "UTF-8");
1584 textdomain(PACKAGE);
1585
1582 /* GTK stuffs */ 1586 /* GTK stuffs */
1583 gtk_set_locale(); 1587 gtk_set_locale();
1584 gtk_init(&ac, &av); 1588 gtk_init(&ac, &av);