Commit 413f006b authored by EGRY Gabor's avatar EGRY Gabor Committed by Sam Ravnborg

kconfig: gettext support for menuconfig

Full gettext support for menuconfig.
Signed-off-by: default avatarEgry Gabor <gaboregry1@t-online.hu>
Reviewed-by: default avatarSam Ravnborg <sam@ravnborg.org>
Signed-off-by: default avatarSam Ravnborg <sam@ravnborg.org>
Cc: Roman Zippel <zippel@linux-m68k.org>
parent c21a2d95
...@@ -289,11 +289,11 @@ static void get_prompt_str(struct gstr *r, struct property *prop) ...@@ -289,11 +289,11 @@ static void get_prompt_str(struct gstr *r, struct property *prop)
int i, j; int i, j;
struct menu *submenu[8], *menu; struct menu *submenu[8], *menu;
str_printf(r, "Prompt: %s\n", prop->text); str_printf(r, _("Prompt: %s\n"), _(prop->text));
str_printf(r, " Defined at %s:%d\n", prop->menu->file->name, str_printf(r, _(" Defined at %s:%d\n"), prop->menu->file->name,
prop->menu->lineno); prop->menu->lineno);
if (!expr_is_yes(prop->visible.expr)) { if (!expr_is_yes(prop->visible.expr)) {
str_append(r, " Depends on: "); str_append(r, _(" Depends on: "));
expr_gstr_print(prop->visible.expr, r); expr_gstr_print(prop->visible.expr, r);
str_append(r, "\n"); str_append(r, "\n");
} }
...@@ -301,13 +301,13 @@ static void get_prompt_str(struct gstr *r, struct property *prop) ...@@ -301,13 +301,13 @@ static void get_prompt_str(struct gstr *r, struct property *prop)
for (i = 0; menu != &rootmenu && i < 8; menu = menu->parent) for (i = 0; menu != &rootmenu && i < 8; menu = menu->parent)
submenu[i++] = menu; submenu[i++] = menu;
if (i > 0) { if (i > 0) {
str_printf(r, " Location:\n"); str_printf(r, _(" Location:\n"));
for (j = 4; --i >= 0; j += 2) { for (j = 4; --i >= 0; j += 2) {
menu = submenu[i]; menu = submenu[i];
str_printf(r, "%*c-> %s", j, ' ', menu_get_prompt(menu)); str_printf(r, "%*c-> %s", j, ' ', _(menu_get_prompt(menu)));
if (menu->sym) { if (menu->sym) {
str_printf(r, " (%s [=%s])", menu->sym->name ? str_printf(r, " (%s [=%s])", menu->sym->name ?
menu->sym->name : "<choice>", menu->sym->name : _("<choice>"),
sym_get_string_value(menu->sym)); sym_get_string_value(menu->sym));
} }
str_append(r, "\n"); str_append(r, "\n");
...@@ -337,7 +337,7 @@ static void get_symbol_str(struct gstr *r, struct symbol *sym) ...@@ -337,7 +337,7 @@ static void get_symbol_str(struct gstr *r, struct symbol *sym)
if (hit) if (hit)
str_append(r, "\n"); str_append(r, "\n");
if (sym->rev_dep.expr) { if (sym->rev_dep.expr) {
str_append(r, " Selected by: "); str_append(r, _(" Selected by: "));
expr_gstr_print(sym->rev_dep.expr, r); expr_gstr_print(sym->rev_dep.expr, r);
str_append(r, "\n"); str_append(r, "\n");
} }
...@@ -353,7 +353,7 @@ static struct gstr get_relations_str(struct symbol **sym_arr) ...@@ -353,7 +353,7 @@ static struct gstr get_relations_str(struct symbol **sym_arr)
for (i = 0; sym_arr && (sym = sym_arr[i]); i++) for (i = 0; sym_arr && (sym = sym_arr[i]); i++)
get_symbol_str(&res, sym); get_symbol_str(&res, sym);
if (!i) if (!i)
str_append(&res, "No matches found.\n"); str_append(&res, _("No matches found.\n"));
return res; return res;
} }
...@@ -433,6 +433,7 @@ static void build_conf(struct menu *menu) ...@@ -433,6 +433,7 @@ static void build_conf(struct menu *menu)
switch (prop->type) { switch (prop->type) {
case P_MENU: case P_MENU:
child_count++; child_count++;
prompt = _(prompt);
if (single_menu_mode) { if (single_menu_mode) {
item_make("%s%*c%s", item_make("%s%*c%s",
menu->data ? "-->" : "++>", menu->data ? "-->" : "++>",
...@@ -448,7 +449,7 @@ static void build_conf(struct menu *menu) ...@@ -448,7 +449,7 @@ static void build_conf(struct menu *menu)
case P_COMMENT: case P_COMMENT:
if (prompt) { if (prompt) {
child_count++; child_count++;
item_make(" %*c*** %s ***", indent + 1, ' ', prompt); item_make(" %*c*** %s ***", indent + 1, ' ', _(prompt));
item_set_tag(':'); item_set_tag(':');
item_set_data(menu); item_set_data(menu);
} }
...@@ -456,7 +457,7 @@ static void build_conf(struct menu *menu) ...@@ -456,7 +457,7 @@ static void build_conf(struct menu *menu)
default: default:
if (prompt) { if (prompt) {
child_count++; child_count++;
item_make("---%*c%s", indent + 1, ' ', prompt); item_make("---%*c%s", indent + 1, ' ', _(prompt));
item_set_tag(':'); item_set_tag(':');
item_set_data(menu); item_set_data(menu);
} }
...@@ -500,10 +501,10 @@ static void build_conf(struct menu *menu) ...@@ -500,10 +501,10 @@ static void build_conf(struct menu *menu)
item_set_data(menu); item_set_data(menu);
} }
item_add_str("%*c%s", indent + 1, ' ', menu_get_prompt(menu)); item_add_str("%*c%s", indent + 1, ' ', _(menu_get_prompt(menu)));
if (val == yes) { if (val == yes) {
if (def_menu) { if (def_menu) {
item_add_str(" (%s)", menu_get_prompt(def_menu)); item_add_str(" (%s)", _(menu_get_prompt(def_menu)));
item_add_str(" --->"); item_add_str(" --->");
if (def_menu->list) { if (def_menu->list) {
indent += 2; indent += 2;
...@@ -515,7 +516,7 @@ static void build_conf(struct menu *menu) ...@@ -515,7 +516,7 @@ static void build_conf(struct menu *menu)
} }
} else { } else {
if (menu == current_menu) { if (menu == current_menu) {
item_make("---%*c%s", indent + 1, ' ', menu_get_prompt(menu)); item_make("---%*c%s", indent + 1, ' ', _(menu_get_prompt(menu)));
item_set_tag(':'); item_set_tag(':');
item_set_data(menu); item_set_data(menu);
goto conf_childs; goto conf_childs;
...@@ -558,17 +559,17 @@ static void build_conf(struct menu *menu) ...@@ -558,17 +559,17 @@ static void build_conf(struct menu *menu)
tmp = indent - tmp + 4; tmp = indent - tmp + 4;
if (tmp < 0) if (tmp < 0)
tmp = 0; tmp = 0;
item_add_str("%*c%s%s", tmp, ' ', menu_get_prompt(menu), item_add_str("%*c%s%s", tmp, ' ', _(menu_get_prompt(menu)),
(sym_has_value(sym) || !sym_is_changable(sym)) ? (sym_has_value(sym) || !sym_is_changable(sym)) ?
"" : " (NEW)"); "" : _(" (NEW)"));
item_set_tag('s'); item_set_tag('s');
item_set_data(menu); item_set_data(menu);
goto conf_childs; goto conf_childs;
} }
} }
item_add_str("%*c%s%s", indent + 1, ' ', menu_get_prompt(menu), item_add_str("%*c%s%s", indent + 1, ' ', _(menu_get_prompt(menu)),
(sym_has_value(sym) || !sym_is_changable(sym)) ? (sym_has_value(sym) || !sym_is_changable(sym)) ?
"" : " (NEW)"); "" : _(" (NEW)"));
if (menu->prompt->type == P_MENU) { if (menu->prompt->type == P_MENU) {
item_add_str(" --->"); item_add_str(" --->");
return; return;
...@@ -606,7 +607,7 @@ static void conf(struct menu *menu) ...@@ -606,7 +607,7 @@ static void conf(struct menu *menu)
item_set_tag('S'); item_set_tag('S');
} }
dialog_clear(); dialog_clear();
res = dialog_menu(prompt ? prompt : _("Main Menu"), res = dialog_menu(prompt ? _(prompt) : _("Main Menu"),
_(menu_instructions), _(menu_instructions),
active_menu, &s_scroll); active_menu, &s_scroll);
if (res == 1 || res == KEY_ESC || res == -ERRDISPLAYTOOSMALL) if (res == 1 || res == KEY_ESC || res == -ERRDISPLAYTOOSMALL)
...@@ -653,7 +654,7 @@ static void conf(struct menu *menu) ...@@ -653,7 +654,7 @@ static void conf(struct menu *menu)
if (sym) if (sym)
show_help(submenu); show_help(submenu);
else else
show_helptext("README", _(mconf_readme)); show_helptext(_("README"), _(mconf_readme));
break; break;
case 3: case 3:
if (item_is_tag('t')) { if (item_is_tag('t')) {
...@@ -711,13 +712,13 @@ static void show_help(struct menu *menu) ...@@ -711,13 +712,13 @@ static void show_help(struct menu *menu)
str_append(&help, nohelp_text); str_append(&help, nohelp_text);
} }
get_symbol_str(&help, sym); get_symbol_str(&help, sym);
show_helptext(menu_get_prompt(menu), str_get(&help)); show_helptext(_(menu_get_prompt(menu)), str_get(&help));
str_free(&help); str_free(&help);
} }
static void conf_choice(struct menu *menu) static void conf_choice(struct menu *menu)
{ {
const char *prompt = menu_get_prompt(menu); const char *prompt = _(menu_get_prompt(menu));
struct menu *child; struct menu *child;
struct symbol *active; struct symbol *active;
...@@ -731,7 +732,7 @@ static void conf_choice(struct menu *menu) ...@@ -731,7 +732,7 @@ static void conf_choice(struct menu *menu)
for (child = menu->list; child; child = child->next) { for (child = menu->list; child; child = child->next) {
if (!menu_is_visible(child)) if (!menu_is_visible(child))
continue; continue;
item_make("%s", menu_get_prompt(child)); item_make("%s", _(menu_get_prompt(child)));
item_set_data(child); item_set_data(child);
if (child->sym == active) if (child->sym == active)
item_set_selected(1); item_set_selected(1);
...@@ -739,7 +740,7 @@ static void conf_choice(struct menu *menu) ...@@ -739,7 +740,7 @@ static void conf_choice(struct menu *menu)
item_set_tag('X'); item_set_tag('X');
} }
dialog_clear(); dialog_clear();
res = dialog_checklist(prompt ? prompt : _("Main Menu"), res = dialog_checklist(prompt ? _(prompt) : _("Main Menu"),
_(radiolist_instructions), _(radiolist_instructions),
15, 70, 6); 15, 70, 6);
selected = item_activate_selected(); selected = item_activate_selected();
...@@ -785,10 +786,10 @@ static void conf_string(struct menu *menu) ...@@ -785,10 +786,10 @@ static void conf_string(struct menu *menu)
heading = _(inputbox_instructions_string); heading = _(inputbox_instructions_string);
break; break;
default: default:
heading = "Internal mconf error!"; heading = _("Internal mconf error!");
} }
dialog_clear(); dialog_clear();
res = dialog_inputbox(prompt ? prompt : _("Main Menu"), res = dialog_inputbox(prompt ? _(prompt) : _("Main Menu"),
heading, 10, 75, heading, 10, 75,
sym_get_string_value(menu->sym)); sym_get_string_value(menu->sym));
switch (res) { switch (res) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment