diff options
author | Arnaldo Carvalho de Melo <acme@ghostprotocols.net> | 2005-05-05 18:09:46 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-05-05 18:24:00 -0400 |
commit | 3b9fa0931dd86a1fe5507311ee8031650f5d0e8c (patch) | |
tree | b40a8a09aca2b52f40d548b34c48ea46ba10b90f | |
parent | f403b7f452e4347f6af14c1f3c47bce758eb6337 (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>
-rw-r--r-- | scripts/kconfig/Makefile | 14 | ||||
-rw-r--r-- | scripts/kconfig/POTFILES.in | 5 | ||||
-rw-r--r-- | scripts/kconfig/conf.c | 20 | ||||
-rw-r--r-- | scripts/kconfig/confdata.c | 16 | ||||
-rw-r--r-- | scripts/kconfig/gconf.c | 52 | ||||
-rw-r--r-- | scripts/kconfig/kxgettext.c | 221 | ||||
-rw-r--r-- | scripts/kconfig/lkc.h | 8 | ||||
-rw-r--r-- | scripts/kconfig/mconf.c | 120 | ||||
-rw-r--r-- | scripts/kconfig/menu.c | 4 | ||||
-rw-r--r-- | scripts/kconfig/qconf.cc | 59 |
10 files changed, 395 insertions, 124 deletions
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile index 5a5ddc40f36c..09abb891d11f 100644 --- a/scripts/kconfig/Makefile +++ b/scripts/kconfig/Makefile | |||
@@ -2,7 +2,7 @@ | |||
2 | # Kernel configuration targets | 2 | # Kernel configuration targets |
3 | # These targets are used from top-level makefile | 3 | # These targets are used from top-level makefile |
4 | 4 | ||
5 | .PHONY: oldconfig xconfig gconfig menuconfig config silentoldconfig | 5 | .PHONY: oldconfig xconfig gconfig menuconfig config silentoldconfig update-po-config |
6 | 6 | ||
7 | xconfig: $(obj)/qconf | 7 | xconfig: $(obj)/qconf |
8 | $< arch/$(ARCH)/Kconfig | 8 | $< arch/$(ARCH)/Kconfig |
@@ -23,6 +23,13 @@ oldconfig: $(obj)/conf | |||
23 | silentoldconfig: $(obj)/conf | 23 | silentoldconfig: $(obj)/conf |
24 | $< -s arch/$(ARCH)/Kconfig | 24 | $< -s arch/$(ARCH)/Kconfig |
25 | 25 | ||
26 | update-po-config: $(obj)/kxgettext | ||
27 | xgettext --default-domain=linux \ | ||
28 | --add-comments --keyword=_ --keyword=N_ \ | ||
29 | --files-from=scripts/kconfig/POTFILES.in \ | ||
30 | -o scripts/kconfig/linux.pot | ||
31 | scripts/kconfig/kxgettext arch/$(ARCH)/Kconfig >> scripts/kconfig/linux.pot | ||
32 | |||
26 | .PHONY: randconfig allyesconfig allnoconfig allmodconfig defconfig | 33 | .PHONY: randconfig allyesconfig allnoconfig allmodconfig defconfig |
27 | 34 | ||
28 | randconfig: $(obj)/conf | 35 | randconfig: $(obj)/conf |
@@ -72,9 +79,10 @@ help: | |||
72 | # Based on GTK which needs to be installed to compile it | 79 | # Based on GTK which needs to be installed to compile it |
73 | # object files used by all kconfig flavours | 80 | # object files used by all kconfig flavours |
74 | 81 | ||
75 | hostprogs-y := conf mconf qconf gconf | 82 | hostprogs-y := conf mconf qconf gconf kxgettext |
76 | conf-objs := conf.o zconf.tab.o | 83 | conf-objs := conf.o zconf.tab.o |
77 | mconf-objs := mconf.o zconf.tab.o | 84 | mconf-objs := mconf.o zconf.tab.o |
85 | kxgettext-objs := kxgettext.o zconf.tab.o | ||
78 | 86 | ||
79 | ifeq ($(MAKECMDGOALS),xconfig) | 87 | ifeq ($(MAKECMDGOALS),xconfig) |
80 | qconf-target := 1 | 88 | qconf-target := 1 |
@@ -107,7 +115,7 @@ HOSTLOADLIBES_gconf = `pkg-config gtk+-2.0 gmodule-2.0 libglade-2.0 --libs` | |||
107 | HOSTCFLAGS_gconf.o = `pkg-config gtk+-2.0 gmodule-2.0 libglade-2.0 --cflags` \ | 115 | HOSTCFLAGS_gconf.o = `pkg-config gtk+-2.0 gmodule-2.0 libglade-2.0 --cflags` \ |
108 | -D LKC_DIRECT_LINK | 116 | -D LKC_DIRECT_LINK |
109 | 117 | ||
110 | $(obj)/conf.o $(obj)/mconf.o $(obj)/qconf.o $(obj)/gconf.o: $(obj)/zconf.tab.h | 118 | $(obj)/conf.o $(obj)/mconf.o $(obj)/qconf.o $(obj)/gconf.o $(obj)/kxgettext: $(obj)/zconf.tab.h |
111 | 119 | ||
112 | $(obj)/zconf.tab.h: $(src)/zconf.tab.h_shipped | 120 | $(obj)/zconf.tab.h: $(src)/zconf.tab.h_shipped |
113 | $(obj)/zconf.tab.c: $(src)/zconf.tab.c_shipped | 121 | $(obj)/zconf.tab.c: $(src)/zconf.tab.c_shipped |
diff --git a/scripts/kconfig/POTFILES.in b/scripts/kconfig/POTFILES.in new file mode 100644 index 000000000000..cc94e46a79e8 --- /dev/null +++ b/scripts/kconfig/POTFILES.in | |||
@@ -0,0 +1,5 @@ | |||
1 | scripts/kconfig/mconf.c | ||
2 | scripts/kconfig/conf.c | ||
3 | scripts/kconfig/confdata.c | ||
4 | scripts/kconfig/gconf.c | ||
5 | scripts/kconfig/qconf.cc | ||
diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c index a494d1aeb9f9..70e7264c6942 100644 --- a/scripts/kconfig/conf.c +++ b/scripts/kconfig/conf.c | |||
@@ -34,7 +34,7 @@ static int conf_cnt; | |||
34 | static signed char line[128]; | 34 | static signed char line[128]; |
35 | static struct menu *rootEntry; | 35 | static struct menu *rootEntry; |
36 | 36 | ||
37 | static char nohelp_text[] = "Sorry, no help available for this option yet.\n"; | 37 | static char nohelp_text[] = N_("Sorry, no help available for this option yet.\n"); |
38 | 38 | ||
39 | static void strip(signed char *str) | 39 | static void strip(signed char *str) |
40 | { | 40 | { |
@@ -56,9 +56,9 @@ static void strip(signed char *str) | |||
56 | static void check_stdin(void) | 56 | static void check_stdin(void) |
57 | { | 57 | { |
58 | if (!valid_stdin && input_mode == ask_silent) { | 58 | if (!valid_stdin && input_mode == ask_silent) { |
59 | printf("aborted!\n\n"); | 59 | printf(_("aborted!\n\n")); |
60 | printf("Console input/output is redirected. "); | 60 | printf(_("Console input/output is redirected. ")); |
61 | printf("Run 'make oldconfig' to update configuration.\n\n"); | 61 | printf(_("Run 'make oldconfig' to update configuration.\n\n")); |
62 | exit(1); | 62 | exit(1); |
63 | } | 63 | } |
64 | } | 64 | } |
@@ -470,7 +470,7 @@ static void check_conf(struct menu *menu) | |||
470 | if (sym) { | 470 | if (sym) { |
471 | if (sym_is_changable(sym) && !sym_has_value(sym)) { | 471 | if (sym_is_changable(sym) && !sym_has_value(sym)) { |
472 | if (!conf_cnt++) | 472 | if (!conf_cnt++) |
473 | printf("*\n* Restart config...\n*\n"); | 473 | printf(_("*\n* Restart config...\n*\n")); |
474 | rootEntry = menu_get_parent_menu(menu); | 474 | rootEntry = menu_get_parent_menu(menu); |
475 | conf(rootEntry); | 475 | conf(rootEntry); |
476 | } | 476 | } |
@@ -504,7 +504,7 @@ int main(int ac, char **av) | |||
504 | input_mode = set_default; | 504 | input_mode = set_default; |
505 | defconfig_file = av[i++]; | 505 | defconfig_file = av[i++]; |
506 | if (!defconfig_file) { | 506 | if (!defconfig_file) { |
507 | printf("%s: No default config file specified\n", | 507 | printf(_("%s: No default config file specified\n"), |
508 | av[0]); | 508 | av[0]); |
509 | exit(1); | 509 | exit(1); |
510 | } | 510 | } |
@@ -530,7 +530,7 @@ int main(int ac, char **av) | |||
530 | } | 530 | } |
531 | name = av[i]; | 531 | name = av[i]; |
532 | if (!name) { | 532 | if (!name) { |
533 | printf("%s: Kconfig file missing\n", av[0]); | 533 | printf(_("%s: Kconfig file missing\n"), av[0]); |
534 | } | 534 | } |
535 | conf_parse(name); | 535 | conf_parse(name); |
536 | //zconfdump(stdout); | 536 | //zconfdump(stdout); |
@@ -547,12 +547,12 @@ int main(int ac, char **av) | |||
547 | break; | 547 | break; |
548 | case ask_silent: | 548 | case ask_silent: |
549 | if (stat(".config", &tmpstat)) { | 549 | if (stat(".config", &tmpstat)) { |
550 | printf("***\n" | 550 | printf(_("***\n" |
551 | "*** You have not yet configured your kernel!\n" | 551 | "*** You have not yet configured your kernel!\n" |
552 | "***\n" | 552 | "***\n" |
553 | "*** Please run some configurator (e.g. \"make oldconfig\" or\n" | 553 | "*** Please run some configurator (e.g. \"make oldconfig\" or\n" |
554 | "*** \"make menuconfig\" or \"make xconfig\").\n" | 554 | "*** \"make menuconfig\" or \"make xconfig\").\n" |
555 | "***\n"); | 555 | "***\n")); |
556 | exit(1); | 556 | exit(1); |
557 | } | 557 | } |
558 | case ask_all: | 558 | case ask_all: |
@@ -576,7 +576,7 @@ int main(int ac, char **av) | |||
576 | check_conf(&rootmenu); | 576 | check_conf(&rootmenu); |
577 | } while (conf_cnt); | 577 | } while (conf_cnt); |
578 | if (conf_write(NULL)) { | 578 | if (conf_write(NULL)) { |
579 | fprintf(stderr, "\n*** Error during writing of the kernel configuration.\n\n"); | 579 | fprintf(stderr, _("\n*** Error during writing of the kernel configuration.\n\n")); |
580 | return 1; | 580 | return 1; |
581 | } | 581 | } |
582 | return 0; | 582 | return 0; |
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c index 1e82ae390a69..2755c459d780 100644 --- a/scripts/kconfig/confdata.c +++ b/scripts/kconfig/confdata.c | |||
@@ -88,9 +88,9 @@ int conf_read(const char *name) | |||
88 | name = conf_expand_value(name); | 88 | name = conf_expand_value(name); |
89 | in = zconf_fopen(name); | 89 | in = zconf_fopen(name); |
90 | if (in) { | 90 | if (in) { |
91 | printf("#\n" | 91 | printf(_("#\n" |
92 | "# using defaults found in %s\n" | 92 | "# using defaults found in %s\n" |
93 | "#\n", name); | 93 | "#\n"), name); |
94 | break; | 94 | break; |
95 | } | 95 | } |
96 | } | 96 | } |
@@ -312,11 +312,11 @@ int conf_write(const char *name) | |||
312 | if (env && *env) | 312 | if (env && *env) |
313 | use_timestamp = 0; | 313 | use_timestamp = 0; |
314 | 314 | ||
315 | fprintf(out, "#\n" | 315 | fprintf(out, _("#\n" |
316 | "# Automatically generated make config: don't edit\n" | 316 | "# Automatically generated make config: don't edit\n" |
317 | "# Linux kernel version: %s\n" | 317 | "# Linux kernel version: %s\n" |
318 | "%s%s" | 318 | "%s%s" |
319 | "#\n", | 319 | "#\n"), |
320 | sym_get_string_value(sym), | 320 | sym_get_string_value(sym), |
321 | use_timestamp ? "# " : "", | 321 | use_timestamp ? "# " : "", |
322 | use_timestamp ? ctime(&now) : ""); | 322 | use_timestamp ? ctime(&now) : ""); |
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; | |||
41 | static gboolean config_changed = FALSE; | 41 | static gboolean config_changed = FALSE; |
42 | 42 | ||
43 | static char nohelp_text[] = | 43 | static 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 | ||
46 | GtkWidget *main_wnd = NULL; | 46 | GtkWidget *main_wnd = NULL; |
47 | GtkWidget *tree1_w = NULL; // left frame | 47 | GtkWidget *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) | |||
632 | void on_save1_activate(GtkMenuItem * menuitem, gpointer user_data) | 632 | void 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) | |||
740 | void on_introduction1_activate(GtkMenuItem * menuitem, gpointer user_data) | 740 | void 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); |
diff --git a/scripts/kconfig/kxgettext.c b/scripts/kconfig/kxgettext.c new file mode 100644 index 000000000000..1c88d7c6d5a7 --- /dev/null +++ b/scripts/kconfig/kxgettext.c | |||
@@ -0,0 +1,221 @@ | |||
1 | /* | ||
2 | * Arnaldo Carvalho de Melo <acme@conectiva.com.br>, 2005 | ||
3 | * | ||
4 | * Released under the terms of the GNU GPL v2.0 | ||
5 | */ | ||
6 | |||
7 | #include <stdlib.h> | ||
8 | #include <string.h> | ||
9 | |||
10 | #define LKC_DIRECT_LINK | ||
11 | #include "lkc.h" | ||
12 | |||
13 | static char *escape(const char* text, char *bf, int len) | ||
14 | { | ||
15 | char *bfp = bf; | ||
16 | int multiline = strchr(text, '\n') != NULL; | ||
17 | |||
18 | *bfp++ = '"'; | ||
19 | --len; | ||
20 | |||
21 | if (multiline) { | ||
22 | *bfp++ = '"'; | ||
23 | *bfp++ = '\n'; | ||
24 | *bfp++ = '"'; | ||
25 | len -= 3; | ||
26 | } | ||
27 | |||
28 | while (*text != '\0' && len > 1) { | ||
29 | if (*text == '"') | ||
30 | *bfp++ = '\\'; | ||
31 | else if (*text == '\n') { | ||
32 | *bfp++ = '\\'; | ||
33 | *bfp++ = 'n'; | ||
34 | *bfp++ = '"'; | ||
35 | *bfp++ = '\n'; | ||
36 | *bfp++ = '"'; | ||
37 | len -= 5; | ||
38 | ++text; | ||
39 | goto next; | ||
40 | } | ||
41 | *bfp++ = *text++; | ||
42 | next: | ||
43 | --len; | ||
44 | } | ||
45 | |||
46 | if (multiline) | ||
47 | bfp -= 3; | ||
48 | |||
49 | *bfp++ = '"'; | ||
50 | *bfp = '\0'; | ||
51 | |||
52 | return bf; | ||
53 | } | ||
54 | |||
55 | struct file_line { | ||
56 | struct file_line *next; | ||
57 | char* file; | ||
58 | int lineno; | ||
59 | }; | ||
60 | |||
61 | static struct file_line *file_line__new(char *file, int lineno) | ||
62 | { | ||
63 | struct file_line *self = malloc(sizeof(*self)); | ||
64 | |||
65 | if (self == NULL) | ||
66 | goto out; | ||
67 | |||
68 | self->file = file; | ||
69 | self->lineno = lineno; | ||
70 | self->next = NULL; | ||
71 | out: | ||
72 | return self; | ||
73 | } | ||
74 | |||
75 | struct message { | ||
76 | const char *msg; | ||
77 | const char *option; | ||
78 | struct message *next; | ||
79 | struct file_line *files; | ||
80 | }; | ||
81 | |||
82 | static struct message *message__list; | ||
83 | |||
84 | static struct message *message__new(const char *msg, char *option, char *file, int lineno) | ||
85 | { | ||
86 | struct message *self = malloc(sizeof(*self)); | ||
87 | |||
88 | if (self == NULL) | ||
89 | goto out; | ||
90 | |||
91 | self->files = file_line__new(file, lineno); | ||
92 | if (self->files == NULL) | ||
93 | goto out_fail; | ||
94 | |||
95 | self->msg = strdup(msg); | ||
96 | if (self->msg == NULL) | ||
97 | goto out_fail_msg; | ||
98 | |||
99 | self->option = option; | ||
100 | self->next = NULL; | ||
101 | out: | ||
102 | return self; | ||
103 | out_fail_msg: | ||
104 | free(self->files); | ||
105 | out_fail: | ||
106 | free(self); | ||
107 | self = NULL; | ||
108 | goto out; | ||
109 | } | ||
110 | |||
111 | static struct message *mesage__find(const char *msg) | ||
112 | { | ||
113 | struct message *m = message__list; | ||
114 | |||
115 | while (m != NULL) { | ||
116 | if (strcmp(m->msg, msg) == 0) | ||
117 | break; | ||
118 | m = m->next; | ||
119 | } | ||
120 | |||
121 | return m; | ||
122 | } | ||
123 | |||
124 | static int message__add_file_line(struct message *self, char *file, int lineno) | ||
125 | { | ||
126 | int rc = -1; | ||
127 | struct file_line *fl = file_line__new(file, lineno); | ||
128 | |||
129 | if (fl == NULL) | ||
130 | goto out; | ||
131 | |||
132 | fl->next = self->files; | ||
133 | self->files = fl; | ||
134 | rc = 0; | ||
135 | out: | ||
136 | return rc; | ||
137 | } | ||
138 | |||
139 | static int message__add(const char *msg, char *option, char *file, int lineno) | ||
140 | { | ||
141 | int rc = 0; | ||
142 | char bf[16384]; | ||
143 | char *escaped = escape(msg, bf, sizeof(bf)); | ||
144 | struct message *m = mesage__find(escaped); | ||
145 | |||
146 | if (m != NULL) | ||
147 | rc = message__add_file_line(m, file, lineno); | ||
148 | else { | ||
149 | m = message__new(escaped, option, file, lineno); | ||
150 | |||
151 | if (m != NULL) { | ||
152 | m->next = message__list; | ||
153 | message__list = m; | ||
154 | } else | ||
155 | rc = -1; | ||
156 | } | ||
157 | return rc; | ||
158 | } | ||
159 | |||
160 | void menu_build_message_list(struct menu *menu) | ||
161 | { | ||
162 | struct menu *child; | ||
163 | |||
164 | message__add(menu_get_prompt(menu), NULL, | ||
165 | menu->file == NULL ? "Root Menu" : menu->file->name, | ||
166 | menu->lineno); | ||
167 | |||
168 | if (menu->sym != NULL && menu->sym->help != NULL) | ||
169 | message__add(menu->sym->help, menu->sym->name, | ||
170 | menu->file == NULL ? "Root Menu" : menu->file->name, | ||
171 | menu->lineno); | ||
172 | |||
173 | for (child = menu->list; child != NULL; child = child->next) | ||
174 | if (child->prompt != NULL) | ||
175 | menu_build_message_list(child); | ||
176 | } | ||
177 | |||
178 | static void message__print_file_lineno(struct message *self) | ||
179 | { | ||
180 | struct file_line *fl = self->files; | ||
181 | |||
182 | printf("\n#: %s:%d", fl->file, fl->lineno); | ||
183 | fl = fl->next; | ||
184 | |||
185 | while (fl != NULL) { | ||
186 | printf(", %s:%d", fl->file, fl->lineno); | ||
187 | fl = fl->next; | ||
188 | } | ||
189 | |||
190 | if (self->option != NULL) | ||
191 | printf(", %s:00000", self->option); | ||
192 | |||
193 | putchar('\n'); | ||
194 | } | ||
195 | |||
196 | static void message__print_gettext_msgid_msgstr(struct message *self) | ||
197 | { | ||
198 | message__print_file_lineno(self); | ||
199 | |||
200 | printf("msgid %s\n" | ||
201 | "msgstr \"\"\n", self->msg); | ||
202 | } | ||
203 | |||
204 | void menu__xgettext(void) | ||
205 | { | ||
206 | struct message *m = message__list; | ||
207 | |||
208 | while (m != NULL) { | ||
209 | message__print_gettext_msgid_msgstr(m); | ||
210 | m = m->next; | ||
211 | } | ||
212 | } | ||
213 | |||
214 | int main(int ac, char **av) | ||
215 | { | ||
216 | conf_parse(av[1]); | ||
217 | |||
218 | menu_build_message_list(menu_get_root_menu(NULL)); | ||
219 | menu__xgettext(); | ||
220 | return 0; | ||
221 | } | ||
diff --git a/scripts/kconfig/lkc.h b/scripts/kconfig/lkc.h index b8a67fc9d647..8b84c42b49b5 100644 --- a/scripts/kconfig/lkc.h +++ b/scripts/kconfig/lkc.h | |||
@@ -8,6 +8,8 @@ | |||
8 | 8 | ||
9 | #include "expr.h" | 9 | #include "expr.h" |
10 | 10 | ||
11 | #include <libintl.h> | ||
12 | |||
11 | #ifdef __cplusplus | 13 | #ifdef __cplusplus |
12 | extern "C" { | 14 | extern "C" { |
13 | #endif | 15 | #endif |
@@ -23,6 +25,12 @@ extern "C" { | |||
23 | 25 | ||
24 | #define SRCTREE "srctree" | 26 | #define SRCTREE "srctree" |
25 | 27 | ||
28 | #define PACKAGE "linux" | ||
29 | #define LOCALEDIR "/usr/share/locale" | ||
30 | |||
31 | #define _(text) gettext(text) | ||
32 | #define N_(text) (text) | ||
33 | |||
26 | int zconfparse(void); | 34 | int zconfparse(void); |
27 | void zconfdump(FILE *out); | 35 | void zconfdump(FILE *out); |
28 | 36 | ||
diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c index 730d316fe7fe..e5db10ca9564 100644 --- a/scripts/kconfig/mconf.c +++ b/scripts/kconfig/mconf.c | |||
@@ -4,6 +4,8 @@ | |||
4 | * | 4 | * |
5 | * Introduced single menu mode (show all sub-menus in one large tree). | 5 | * Introduced single menu mode (show all sub-menus in one large tree). |
6 | * 2002-11-06 Petr Baudis <pasky@ucw.cz> | 6 | * 2002-11-06 Petr Baudis <pasky@ucw.cz> |
7 | * | ||
8 | * i18n, 2005, Arnaldo Carvalho de Melo <acme@conectiva.com.br> | ||
7 | */ | 9 | */ |
8 | 10 | ||
9 | #include <sys/ioctl.h> | 11 | #include <sys/ioctl.h> |
@@ -23,7 +25,7 @@ | |||
23 | #include "lkc.h" | 25 | #include "lkc.h" |
24 | 26 | ||
25 | static char menu_backtitle[128]; | 27 | static char menu_backtitle[128]; |
26 | static const char mconf_readme[] = | 28 | static const char mconf_readme[] = N_( |
27 | "Overview\n" | 29 | "Overview\n" |
28 | "--------\n" | 30 | "--------\n" |
29 | "Some kernel features may be built directly into the kernel.\n" | 31 | "Some kernel features may be built directly into the kernel.\n" |
@@ -156,39 +158,39 @@ static const char mconf_readme[] = | |||
156 | "\n" | 158 | "\n" |
157 | "Note that this mode can eventually be a little more CPU expensive\n" | 159 | "Note that this mode can eventually be a little more CPU expensive\n" |
158 | "(especially with a larger number of unrolled categories) than the\n" | 160 | "(especially with a larger number of unrolled categories) than the\n" |
159 | "default mode.\n", | 161 | "default mode.\n"), |
160 | menu_instructions[] = | 162 | menu_instructions[] = N_( |
161 | "Arrow keys navigate the menu. " | 163 | "Arrow keys navigate the menu. " |
162 | "<Enter> selects submenus --->. " | 164 | "<Enter> selects submenus --->. " |
163 | "Highlighted letters are hotkeys. " | 165 | "Highlighted letters are hotkeys. " |
164 | "Pressing <Y> includes, <N> excludes, <M> modularizes features. " | 166 | "Pressing <Y> includes, <N> excludes, <M> modularizes features. " |
165 | "Press <Esc><Esc> to exit, <?> for Help, </> for Search. " | 167 | "Press <Esc><Esc> to exit, <?> for Help, </> for Search. " |
166 | "Legend: [*] built-in [ ] excluded <M> module < > module capable", | 168 | "Legend: [*] built-in [ ] excluded <M> module < > module capable"), |
167 | radiolist_instructions[] = | 169 | radiolist_instructions[] = N_( |
168 | "Use the arrow keys to navigate this window or " | 170 | "Use the arrow keys to navigate this window or " |
169 | "press the hotkey of the item you wish to select " | 171 | "press the hotkey of the item you wish to select " |
170 | "followed by the <SPACE BAR>. " | 172 | "followed by the <SPACE BAR>. " |
171 | "Press <?> for additional information about this option.", | 173 | "Press <?> for additional information about this option."), |
172 | inputbox_instructions_int[] = | 174 | inputbox_instructions_int[] = N_( |
173 | "Please enter a decimal value. " | 175 | "Please enter a decimal value. " |
174 | "Fractions will not be accepted. " | 176 | "Fractions will not be accepted. " |
175 | "Use the <TAB> key to move from the input field to the buttons below it.", | 177 | "Use the <TAB> key to move from the input field to the buttons below it."), |
176 | inputbox_instructions_hex[] = | 178 | inputbox_instructions_hex[] = N_( |
177 | "Please enter a hexadecimal value. " | 179 | "Please enter a hexadecimal value. " |
178 | "Use the <TAB> key to move from the input field to the buttons below it.", | 180 | "Use the <TAB> key to move from the input field to the buttons below it."), |
179 | inputbox_instructions_string[] = | 181 | inputbox_instructions_string[] = N_( |
180 | "Please enter a string value. " | 182 | "Please enter a string value. " |
181 | "Use the <TAB> key to move from the input field to the buttons below it.", | 183 | "Use the <TAB> key to move from the input field to the buttons below it."), |
182 | setmod_text[] = | 184 | setmod_text[] = N_( |
183 | "This feature depends on another which has been configured as a module.\n" | 185 | "This feature depends on another which has been configured as a module.\n" |
184 | "As a result, this feature will be built as a module.", | 186 | "As a result, this feature will be built as a module."), |
185 | nohelp_text[] = | 187 | nohelp_text[] = N_( |
186 | "There is no help available for this kernel option.\n", | 188 | "There is no help available for this kernel option.\n"), |
187 | load_config_text[] = | 189 | load_config_text[] = N_( |
188 | "Enter the name of the configuration file you wish to load. " | 190 | "Enter the name of the configuration file you wish to load. " |
189 | "Accept the name shown to restore the configuration you " | 191 | "Accept the name shown to restore the configuration you " |
190 | "last retrieved. Leave blank to abort.", | 192 | "last retrieved. Leave blank to abort."), |
191 | load_config_help[] = | 193 | load_config_help[] = N_( |
192 | "\n" | 194 | "\n" |
193 | "For various reasons, one may wish to keep several different kernel\n" | 195 | "For various reasons, one may wish to keep several different kernel\n" |
194 | "configurations available on a single machine.\n" | 196 | "configurations available on a single machine.\n" |
@@ -198,11 +200,11 @@ load_config_help[] = | |||
198 | "to modify that configuration.\n" | 200 | "to modify that configuration.\n" |
199 | "\n" | 201 | "\n" |
200 | "If you are uncertain, then you have probably never used alternate\n" | 202 | "If you are uncertain, then you have probably never used alternate\n" |
201 | "configuration files. You should therefor leave this blank to abort.\n", | 203 | "configuration files. You should therefor leave this blank to abort.\n"), |
202 | save_config_text[] = | 204 | save_config_text[] = N_( |
203 | "Enter a filename to which this configuration should be saved " | 205 | "Enter a filename to which this configuration should be saved " |
204 | "as an alternate. Leave blank to abort.", | 206 | "as an alternate. Leave blank to abort."), |
205 | save_config_help[] = | 207 | save_config_help[] = N_( |
206 | "\n" | 208 | "\n" |
207 | "For various reasons, one may wish to keep different kernel\n" | 209 | "For various reasons, one may wish to keep different kernel\n" |
208 | "configurations available on a single machine.\n" | 210 | "configurations available on a single machine.\n" |
@@ -212,8 +214,8 @@ save_config_help[] = | |||
212 | "configuration options you have selected at that time.\n" | 214 | "configuration options you have selected at that time.\n" |
213 | "\n" | 215 | "\n" |
214 | "If you are uncertain what all this means then you should probably\n" | 216 | "If you are uncertain what all this means then you should probably\n" |
215 | "leave this blank.\n", | 217 | "leave this blank.\n"), |
216 | search_help[] = | 218 | search_help[] = N_( |
217 | "\n" | 219 | "\n" |
218 | "Search for CONFIG_ symbols and display their relations.\n" | 220 | "Search for CONFIG_ symbols and display their relations.\n" |
219 | "Example: search for \"^FOO\"\n" | 221 | "Example: search for \"^FOO\"\n" |
@@ -250,7 +252,7 @@ search_help[] = | |||
250 | "Examples: USB => find all CONFIG_ symbols containing USB\n" | 252 | "Examples: USB => find all CONFIG_ symbols containing USB\n" |
251 | " ^USB => find all CONFIG_ symbols starting with USB\n" | 253 | " ^USB => find all CONFIG_ symbols starting with USB\n" |
252 | " USB$ => find all CONFIG_ symbols ending with USB\n" | 254 | " USB$ => find all CONFIG_ symbols ending with USB\n" |
253 | "\n"; | 255 | "\n"); |
254 | 256 | ||
255 | static signed char buf[4096], *bufptr = buf; | 257 | static signed char buf[4096], *bufptr = buf; |
256 | static signed char input_buf[4096]; | 258 | static signed char input_buf[4096]; |
@@ -305,8 +307,8 @@ static void init_wsize(void) | |||
305 | } | 307 | } |
306 | 308 | ||
307 | if (rows < 19 || cols < 80) { | 309 | if (rows < 19 || cols < 80) { |
308 | fprintf(stderr, "Your display is too small to run Menuconfig!\n"); | 310 | fprintf(stderr, N_("Your display is too small to run Menuconfig!\n")); |
309 | fprintf(stderr, "It must be at least 19 lines by 80 columns.\n"); | 311 | fprintf(stderr, N_("It must be at least 19 lines by 80 columns.\n")); |
310 | exit(1); | 312 | exit(1); |
311 | } | 313 | } |
312 | 314 | ||
@@ -526,9 +528,9 @@ static void search_conf(void) | |||
526 | again: | 528 | again: |
527 | cprint_init(); | 529 | cprint_init(); |
528 | cprint("--title"); | 530 | cprint("--title"); |
529 | cprint("Search Configuration Parameter"); | 531 | cprint(_("Search Configuration Parameter")); |
530 | cprint("--inputbox"); | 532 | cprint("--inputbox"); |
531 | cprint("Enter Keyword"); | 533 | cprint(_("Enter Keyword")); |
532 | cprint("10"); | 534 | cprint("10"); |
533 | cprint("75"); | 535 | cprint("75"); |
534 | cprint(""); | 536 | cprint(""); |
@@ -539,7 +541,7 @@ again: | |||
539 | case 0: | 541 | case 0: |
540 | break; | 542 | break; |
541 | case 1: | 543 | case 1: |
542 | show_helptext("Search Configuration", search_help); | 544 | show_helptext(_("Search Configuration"), search_help); |
543 | goto again; | 545 | goto again; |
544 | default: | 546 | default: |
545 | return; | 547 | return; |
@@ -548,7 +550,7 @@ again: | |||
548 | sym_arr = sym_re_search(input_buf); | 550 | sym_arr = sym_re_search(input_buf); |
549 | res = get_relations_str(sym_arr); | 551 | res = get_relations_str(sym_arr); |
550 | free(sym_arr); | 552 | free(sym_arr); |
551 | show_textbox("Search Results", str_get(&res), 0, 0); | 553 | show_textbox(_("Search Results"), str_get(&res), 0, 0); |
552 | str_free(&res); | 554 | str_free(&res); |
553 | } | 555 | } |
554 | 556 | ||
@@ -721,9 +723,9 @@ static void conf(struct menu *menu) | |||
721 | while (1) { | 723 | while (1) { |
722 | cprint_init(); | 724 | cprint_init(); |
723 | cprint("--title"); | 725 | cprint("--title"); |
724 | cprint("%s", prompt ? prompt : "Main Menu"); | 726 | cprint("%s", prompt ? prompt : _("Main Menu")); |
725 | cprint("--menu"); | 727 | cprint("--menu"); |
726 | cprint(menu_instructions); | 728 | cprint(_(menu_instructions)); |
727 | cprint("%d", rows); | 729 | cprint("%d", rows); |
728 | cprint("%d", cols); | 730 | cprint("%d", cols); |
729 | cprint("%d", rows - 10); | 731 | cprint("%d", rows - 10); |
@@ -736,9 +738,9 @@ static void conf(struct menu *menu) | |||
736 | cprint(":"); | 738 | cprint(":"); |
737 | cprint("--- "); | 739 | cprint("--- "); |
738 | cprint("L"); | 740 | cprint("L"); |
739 | cprint(" Load an Alternate Configuration File"); | 741 | cprint(_(" Load an Alternate Configuration File")); |
740 | cprint("S"); | 742 | cprint("S"); |
741 | cprint(" Save Configuration to an Alternate File"); | 743 | cprint(_(" Save Configuration to an Alternate File")); |
742 | } | 744 | } |
743 | stat = exec_conf(); | 745 | stat = exec_conf(); |
744 | if (stat < 0) | 746 | if (stat < 0) |
@@ -793,7 +795,7 @@ static void conf(struct menu *menu) | |||
793 | if (sym) | 795 | if (sym) |
794 | show_help(submenu); | 796 | show_help(submenu); |
795 | else | 797 | else |
796 | show_helptext("README", mconf_readme); | 798 | show_helptext("README", _(mconf_readme)); |
797 | break; | 799 | break; |
798 | case 3: | 800 | case 3: |
799 | if (type == 't') { | 801 | if (type == 't') { |
@@ -849,7 +851,7 @@ static void show_help(struct menu *menu) | |||
849 | { | 851 | { |
850 | if (sym->name) { | 852 | if (sym->name) { |
851 | str_printf(&help, "CONFIG_%s:\n\n", sym->name); | 853 | str_printf(&help, "CONFIG_%s:\n\n", sym->name); |
852 | str_append(&help, sym->help); | 854 | str_append(&help, _(sym->help)); |
853 | str_append(&help, "\n"); | 855 | str_append(&help, "\n"); |
854 | } | 856 | } |
855 | } else { | 857 | } else { |
@@ -886,9 +888,9 @@ static void conf_choice(struct menu *menu) | |||
886 | while (1) { | 888 | while (1) { |
887 | cprint_init(); | 889 | cprint_init(); |
888 | cprint("--title"); | 890 | cprint("--title"); |
889 | cprint("%s", prompt ? prompt : "Main Menu"); | 891 | cprint("%s", prompt ? prompt : _("Main Menu")); |
890 | cprint("--radiolist"); | 892 | cprint("--radiolist"); |
891 | cprint(radiolist_instructions); | 893 | cprint(_(radiolist_instructions)); |
892 | cprint("15"); | 894 | cprint("15"); |
893 | cprint("70"); | 895 | cprint("70"); |
894 | cprint("6"); | 896 | cprint("6"); |
@@ -935,17 +937,17 @@ static void conf_string(struct menu *menu) | |||
935 | while (1) { | 937 | while (1) { |
936 | cprint_init(); | 938 | cprint_init(); |
937 | cprint("--title"); | 939 | cprint("--title"); |
938 | cprint("%s", prompt ? prompt : "Main Menu"); | 940 | cprint("%s", prompt ? prompt : _("Main Menu")); |
939 | cprint("--inputbox"); | 941 | cprint("--inputbox"); |
940 | switch (sym_get_type(menu->sym)) { | 942 | switch (sym_get_type(menu->sym)) { |
941 | case S_INT: | 943 | case S_INT: |
942 | cprint(inputbox_instructions_int); | 944 | cprint(_(inputbox_instructions_int)); |
943 | break; | 945 | break; |
944 | case S_HEX: | 946 | case S_HEX: |
945 | cprint(inputbox_instructions_hex); | 947 | cprint(_(inputbox_instructions_hex)); |
946 | break; | 948 | break; |
947 | case S_STRING: | 949 | case S_STRING: |
948 | cprint(inputbox_instructions_string); | 950 | cprint(_(inputbox_instructions_string)); |
949 | break; | 951 | break; |
950 | default: | 952 | default: |
951 | /* panic? */; | 953 | /* panic? */; |
@@ -958,7 +960,7 @@ static void conf_string(struct menu *menu) | |||
958 | case 0: | 960 | case 0: |
959 | if (sym_set_string_value(menu->sym, input_buf)) | 961 | if (sym_set_string_value(menu->sym, input_buf)) |
960 | return; | 962 | return; |
961 | show_textbox(NULL, "You have made an invalid entry.", 5, 43); | 963 | show_textbox(NULL, _("You have made an invalid entry."), 5, 43); |
962 | break; | 964 | break; |
963 | case 1: | 965 | case 1: |
964 | show_help(menu); | 966 | show_help(menu); |
@@ -987,10 +989,10 @@ static void conf_load(void) | |||
987 | return; | 989 | return; |
988 | if (!conf_read(input_buf)) | 990 | if (!conf_read(input_buf)) |
989 | return; | 991 | return; |
990 | show_textbox(NULL, "File does not exist!", 5, 38); | 992 | show_textbox(NULL, _("File does not exist!"), 5, 38); |
991 | break; | 993 | break; |
992 | case 1: | 994 | case 1: |
993 | show_helptext("Load Alternate Configuration", load_config_help); | 995 | show_helptext(_("Load Alternate Configuration"), load_config_help); |
994 | break; | 996 | break; |
995 | case 255: | 997 | case 255: |
996 | return; | 998 | return; |
@@ -1016,10 +1018,10 @@ static void conf_save(void) | |||
1016 | return; | 1018 | return; |
1017 | if (!conf_write(input_buf)) | 1019 | if (!conf_write(input_buf)) |
1018 | return; | 1020 | return; |
1019 | show_textbox(NULL, "Can't create file! Probably a nonexistent directory.", 5, 60); | 1021 | show_textbox(NULL, _("Can't create file! Probably a nonexistent directory."), 5, 60); |
1020 | break; | 1022 | break; |
1021 | case 1: | 1023 | case 1: |
1022 | show_helptext("Save Alternate Configuration", save_config_help); | 1024 | show_helptext(_("Save Alternate Configuration"), save_config_help); |
1023 | break; | 1025 | break; |
1024 | case 255: | 1026 | case 255: |
1025 | return; | 1027 | return; |
@@ -1040,12 +1042,16 @@ int main(int ac, char **av) | |||
1040 | char *mode; | 1042 | char *mode; |
1041 | int stat; | 1043 | int stat; |
1042 | 1044 | ||
1045 | setlocale(LC_ALL, ""); | ||
1046 | bindtextdomain(PACKAGE, LOCALEDIR); | ||
1047 | textdomain(PACKAGE); | ||
1048 | |||
1043 | conf_parse(av[1]); | 1049 | conf_parse(av[1]); |
1044 | conf_read(NULL); | 1050 | conf_read(NULL); |
1045 | 1051 | ||
1046 | sym = sym_lookup("KERNELRELEASE", 0); | 1052 | sym = sym_lookup("KERNELRELEASE", 0); |
1047 | sym_calc_value(sym); | 1053 | sym_calc_value(sym); |
1048 | sprintf(menu_backtitle, "Linux Kernel v%s Configuration", | 1054 | sprintf(menu_backtitle, _("Linux Kernel v%s Configuration"), |
1049 | sym_get_string_value(sym)); | 1055 | sym_get_string_value(sym)); |
1050 | 1056 | ||
1051 | mode = getenv("MENUCONFIG_MODE"); | 1057 | mode = getenv("MENUCONFIG_MODE"); |
@@ -1062,7 +1068,7 @@ int main(int ac, char **av) | |||
1062 | do { | 1068 | do { |
1063 | cprint_init(); | 1069 | cprint_init(); |
1064 | cprint("--yesno"); | 1070 | cprint("--yesno"); |
1065 | cprint("Do you wish to save your new kernel configuration?"); | 1071 | cprint(_("Do you wish to save your new kernel configuration?")); |
1066 | cprint("5"); | 1072 | cprint("5"); |
1067 | cprint("60"); | 1073 | cprint("60"); |
1068 | stat = exec_conf(); | 1074 | stat = exec_conf(); |
@@ -1070,20 +1076,20 @@ int main(int ac, char **av) | |||
1070 | 1076 | ||
1071 | if (stat == 0) { | 1077 | if (stat == 0) { |
1072 | if (conf_write(NULL)) { | 1078 | if (conf_write(NULL)) { |
1073 | fprintf(stderr, "\n\n" | 1079 | fprintf(stderr, _("\n\n" |
1074 | "Error during writing of the kernel configuration.\n" | 1080 | "Error during writing of the kernel configuration.\n" |
1075 | "Your kernel configuration changes were NOT saved." | 1081 | "Your kernel configuration changes were NOT saved." |
1076 | "\n\n"); | 1082 | "\n\n")); |
1077 | return 1; | 1083 | return 1; |
1078 | } | 1084 | } |
1079 | printf("\n\n" | 1085 | printf(_("\n\n" |
1080 | "*** End of Linux kernel configuration.\n" | 1086 | "*** End of Linux kernel configuration.\n" |
1081 | "*** Execute 'make' to build the kernel or try 'make help'." | 1087 | "*** Execute 'make' to build the kernel or try 'make help'." |
1082 | "\n\n"); | 1088 | "\n\n")); |
1083 | } else { | 1089 | } else { |
1084 | fprintf(stderr, "\n\n" | 1090 | fprintf(stderr, _("\n\n" |
1085 | "Your kernel configuration changes were NOT saved." | 1091 | "Your kernel configuration changes were NOT saved." |
1086 | "\n\n"); | 1092 | "\n\n")); |
1087 | } | 1093 | } |
1088 | 1094 | ||
1089 | return 0; | 1095 | return 0; |
diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c index 0c13156f3344..8c59b212722d 100644 --- a/scripts/kconfig/menu.c +++ b/scripts/kconfig/menu.c | |||
@@ -365,9 +365,9 @@ bool menu_is_visible(struct menu *menu) | |||
365 | const char *menu_get_prompt(struct menu *menu) | 365 | const char *menu_get_prompt(struct menu *menu) |
366 | { | 366 | { |
367 | if (menu->prompt) | 367 | if (menu->prompt) |
368 | return menu->prompt->text; | 368 | return _(menu->prompt->text); |
369 | else if (menu->sym) | 369 | else if (menu->sym) |
370 | return menu->sym->name; | 370 | return _(menu->sym->name); |
371 | return NULL; | 371 | return NULL; |
372 | } | 372 | } |
373 | 373 | ||
diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc index 0cdbf9dbbd51..4590cd31623f 100644 --- a/scripts/kconfig/qconf.cc +++ b/scripts/kconfig/qconf.cc | |||
@@ -26,8 +26,23 @@ | |||
26 | #include "qconf.moc" | 26 | #include "qconf.moc" |
27 | #include "images.c" | 27 | #include "images.c" |
28 | 28 | ||
29 | #ifdef _ | ||
30 | # undef _ | ||
31 | # define _ qgettext | ||
32 | #endif | ||
33 | |||
29 | static QApplication *configApp; | 34 | static QApplication *configApp; |
30 | 35 | ||
36 | static inline QString qgettext(const char* str) | ||
37 | { | ||
38 | return QString::fromLocal8Bit(gettext(str)); | ||
39 | } | ||
40 | |||
41 | static inline QString qgettext(const QString& str) | ||
42 | { | ||
43 | return QString::fromLocal8Bit(gettext(str.latin1())); | ||
44 | } | ||
45 | |||
31 | ConfigSettings::ConfigSettings() | 46 | ConfigSettings::ConfigSettings() |
32 | : showAll(false), showName(false), showRange(false), showData(false) | 47 | : showAll(false), showName(false), showRange(false), showData(false) |
33 | { | 48 | { |
@@ -177,7 +192,7 @@ void ConfigItem::updateMenu(void) | |||
177 | 192 | ||
178 | sym = menu->sym; | 193 | sym = menu->sym; |
179 | prop = menu->prompt; | 194 | prop = menu->prompt; |
180 | prompt = menu_get_prompt(menu); | 195 | prompt = QString::fromLocal8Bit(menu_get_prompt(menu)); |
181 | 196 | ||
182 | if (prop) switch (prop->type) { | 197 | if (prop) switch (prop->type) { |
183 | case P_MENU: | 198 | case P_MENU: |
@@ -203,7 +218,7 @@ void ConfigItem::updateMenu(void) | |||
203 | if (!sym) | 218 | if (!sym) |
204 | goto set_prompt; | 219 | goto set_prompt; |
205 | 220 | ||
206 | setText(nameColIdx, sym->name); | 221 | setText(nameColIdx, QString::fromLocal8Bit(sym->name)); |
207 | 222 | ||
208 | type = sym_get_type(sym); | 223 | type = sym_get_type(sym); |
209 | switch (type) { | 224 | switch (type) { |
@@ -213,9 +228,9 @@ void ConfigItem::updateMenu(void) | |||
213 | 228 | ||
214 | if (!sym_is_changable(sym) && !list->showAll) { | 229 | if (!sym_is_changable(sym) && !list->showAll) { |
215 | setPixmap(promptColIdx, 0); | 230 | setPixmap(promptColIdx, 0); |
216 | setText(noColIdx, 0); | 231 | setText(noColIdx, QString::null); |
217 | setText(modColIdx, 0); | 232 | setText(modColIdx, QString::null); |
218 | setText(yesColIdx, 0); | 233 | setText(yesColIdx, QString::null); |
219 | break; | 234 | break; |
220 | } | 235 | } |
221 | expr = sym_get_tristate_value(sym); | 236 | expr = sym_get_tristate_value(sym); |
@@ -257,6 +272,7 @@ void ConfigItem::updateMenu(void) | |||
257 | const char* data; | 272 | const char* data; |
258 | 273 | ||
259 | data = sym_get_string_value(sym); | 274 | data = sym_get_string_value(sym); |
275 | |||
260 | #if QT_VERSION >= 300 | 276 | #if QT_VERSION >= 300 |
261 | int i = list->mapIdx(dataColIdx); | 277 | int i = list->mapIdx(dataColIdx); |
262 | if (i >= 0) | 278 | if (i >= 0) |
@@ -264,9 +280,9 @@ void ConfigItem::updateMenu(void) | |||
264 | #endif | 280 | #endif |
265 | setText(dataColIdx, data); | 281 | setText(dataColIdx, data); |
266 | if (type == S_STRING) | 282 | if (type == S_STRING) |
267 | prompt.sprintf("%s: %s", prompt.latin1(), data); | 283 | prompt = QString("%1: %2").arg(prompt).arg(data); |
268 | else | 284 | else |
269 | prompt.sprintf("(%s) %s", data, prompt.latin1()); | 285 | prompt = QString("(%2) %1").arg(prompt).arg(data); |
270 | break; | 286 | break; |
271 | } | 287 | } |
272 | if (!sym_has_value(sym) && visible) | 288 | if (!sym_has_value(sym) && visible) |
@@ -343,9 +359,9 @@ void ConfigLineEdit::show(ConfigItem* i) | |||
343 | { | 359 | { |
344 | item = i; | 360 | item = i; |
345 | if (sym_get_string_value(item->menu->sym)) | 361 | if (sym_get_string_value(item->menu->sym)) |
346 | setText(sym_get_string_value(item->menu->sym)); | 362 | setText(QString::fromLocal8Bit(sym_get_string_value(item->menu->sym))); |
347 | else | 363 | else |
348 | setText(0); | 364 | setText(QString::null); |
349 | Parent::show(); | 365 | Parent::show(); |
350 | setFocus(); | 366 | setFocus(); |
351 | } | 367 | } |
@@ -961,7 +977,7 @@ ConfigMainWindow::ConfigMainWindow(void) | |||
961 | delete configSettings; | 977 | delete configSettings; |
962 | } | 978 | } |
963 | 979 | ||
964 | static QString print_filter(const char *str) | 980 | static QString print_filter(const QString &str) |
965 | { | 981 | { |
966 | QRegExp re("[<>&\"\\n]"); | 982 | QRegExp re("[<>&\"\\n]"); |
967 | QString res = str; | 983 | QString res = str; |
@@ -994,7 +1010,7 @@ static QString print_filter(const char *str) | |||
994 | 1010 | ||
995 | static void expr_print_help(void *data, const char *str) | 1011 | static void expr_print_help(void *data, const char *str) |
996 | { | 1012 | { |
997 | ((QString*)data)->append(print_filter(str)); | 1013 | reinterpret_cast<QString*>(data)->append(print_filter(str)); |
998 | } | 1014 | } |
999 | 1015 | ||
1000 | /* | 1016 | /* |
@@ -1009,7 +1025,7 @@ void ConfigMainWindow::setHelp(QListViewItem* item) | |||
1009 | if (item) | 1025 | if (item) |
1010 | menu = ((ConfigItem*)item)->menu; | 1026 | menu = ((ConfigItem*)item)->menu; |
1011 | if (!menu) { | 1027 | if (!menu) { |
1012 | helpText->setText(NULL); | 1028 | helpText->setText(QString::null); |
1013 | return; | 1029 | return; |
1014 | } | 1030 | } |
1015 | 1031 | ||
@@ -1019,16 +1035,16 @@ void ConfigMainWindow::setHelp(QListViewItem* item) | |||
1019 | if (sym) { | 1035 | if (sym) { |
1020 | if (menu->prompt) { | 1036 | if (menu->prompt) { |
1021 | head += "<big><b>"; | 1037 | head += "<big><b>"; |
1022 | head += print_filter(menu->prompt->text); | 1038 | head += print_filter(_(menu->prompt->text)); |
1023 | head += "</b></big>"; | 1039 | head += "</b></big>"; |
1024 | if (sym->name) { | 1040 | if (sym->name) { |
1025 | head += " ("; | 1041 | head += " ("; |
1026 | head += print_filter(sym->name); | 1042 | head += print_filter(_(sym->name)); |
1027 | head += ")"; | 1043 | head += ")"; |
1028 | } | 1044 | } |
1029 | } else if (sym->name) { | 1045 | } else if (sym->name) { |
1030 | head += "<big><b>"; | 1046 | head += "<big><b>"; |
1031 | head += print_filter(sym->name); | 1047 | head += print_filter(_(sym->name)); |
1032 | head += "</b></big>"; | 1048 | head += "</b></big>"; |
1033 | } | 1049 | } |
1034 | head += "<br><br>"; | 1050 | head += "<br><br>"; |
@@ -1049,7 +1065,7 @@ void ConfigMainWindow::setHelp(QListViewItem* item) | |||
1049 | case P_PROMPT: | 1065 | case P_PROMPT: |
1050 | case P_MENU: | 1066 | case P_MENU: |
1051 | debug += "prompt: "; | 1067 | debug += "prompt: "; |
1052 | debug += print_filter(prop->text); | 1068 | debug += print_filter(_(prop->text)); |
1053 | debug += "<br>"; | 1069 | debug += "<br>"; |
1054 | break; | 1070 | break; |
1055 | case P_DEFAULT: | 1071 | case P_DEFAULT: |
@@ -1088,10 +1104,10 @@ void ConfigMainWindow::setHelp(QListViewItem* item) | |||
1088 | debug += "<br>"; | 1104 | debug += "<br>"; |
1089 | } | 1105 | } |
1090 | 1106 | ||
1091 | help = print_filter(sym->help); | 1107 | help = print_filter(_(sym->help)); |
1092 | } else if (menu->prompt) { | 1108 | } else if (menu->prompt) { |
1093 | head += "<big><b>"; | 1109 | head += "<big><b>"; |
1094 | head += print_filter(menu->prompt->text); | 1110 | head += print_filter(_(menu->prompt->text)); |
1095 | head += "</b></big><br><br>"; | 1111 | head += "</b></big><br><br>"; |
1096 | if (showDebug) { | 1112 | if (showDebug) { |
1097 | if (menu->prompt->visible.expr) { | 1113 | if (menu->prompt->visible.expr) { |
@@ -1111,7 +1127,7 @@ void ConfigMainWindow::loadConfig(void) | |||
1111 | QString s = QFileDialog::getOpenFileName(".config", NULL, this); | 1127 | QString s = QFileDialog::getOpenFileName(".config", NULL, this); |
1112 | if (s.isNull()) | 1128 | if (s.isNull()) |
1113 | return; | 1129 | return; |
1114 | if (conf_read(s.latin1())) | 1130 | if (conf_read(QFile::encodeName(s))) |
1115 | QMessageBox::information(this, "qconf", "Unable to load configuration!"); | 1131 | QMessageBox::information(this, "qconf", "Unable to load configuration!"); |
1116 | ConfigView::updateListAll(); | 1132 | ConfigView::updateListAll(); |
1117 | } | 1133 | } |
@@ -1127,7 +1143,7 @@ void ConfigMainWindow::saveConfigAs(void) | |||
1127 | QString s = QFileDialog::getSaveFileName(".config", NULL, this); | 1143 | QString s = QFileDialog::getSaveFileName(".config", NULL, this); |
1128 | if (s.isNull()) | 1144 | if (s.isNull()) |
1129 | return; | 1145 | return; |
1130 | if (conf_write(s.latin1())) | 1146 | if (conf_write(QFile::encodeName(s))) |
1131 | QMessageBox::information(this, "qconf", "Unable to save configuration!"); | 1147 | QMessageBox::information(this, "qconf", "Unable to save configuration!"); |
1132 | } | 1148 | } |
1133 | 1149 | ||
@@ -1372,6 +1388,9 @@ int main(int ac, char** av) | |||
1372 | ConfigMainWindow* v; | 1388 | ConfigMainWindow* v; |
1373 | const char *name; | 1389 | const char *name; |
1374 | 1390 | ||
1391 | bindtextdomain(PACKAGE, LOCALEDIR); | ||
1392 | textdomain(PACKAGE); | ||
1393 | |||
1375 | #ifndef LKC_DIRECT_LINK | 1394 | #ifndef LKC_DIRECT_LINK |
1376 | kconfig_load(); | 1395 | kconfig_load(); |
1377 | #endif | 1396 | #endif |