aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorEGRY Gabor <gaboregry1@t-online.hu>2008-01-11 17:44:39 -0500
committerSam Ravnborg <sam@ravnborg.org>2008-01-28 17:14:39 -0500
commit534a450c383ef238b0461218bc2d3e54066ae043 (patch)
treee0142edddfa55a9dc99b0f86faeb5da9bf90a8e5 /scripts
parent75c0a8a55c31c0a21f7e9e64bc45e87e228a98f6 (diff)
kconfig: gettext support for config
Gettext support for conf.c [Include locale.h by Kyle]. Signed-off-by: Egry Gabor <gaboregry1@t-online.hu> Reviewed-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Cc: Roman Zippel <zippel@linux-m68k.org> Cc: Kyle McMartin <kyle@mcmartin.ca>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/kconfig/conf.c35
1 files changed, 20 insertions, 15 deletions
diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c
index 01c2f3505f5..d1a0368bd43 100644
--- a/scripts/kconfig/conf.c
+++ b/scripts/kconfig/conf.c
@@ -3,6 +3,7 @@
3 * Released under the terms of the GNU GPL v2.0. 3 * Released under the terms of the GNU GPL v2.0.
4 */ 4 */
5 5
6#include <locale.h>
6#include <ctype.h> 7#include <ctype.h>
7#include <stdio.h> 8#include <stdio.h>
8#include <stdlib.h> 9#include <stdlib.h>
@@ -40,7 +41,7 @@ static char nohelp_text[] = N_("Sorry, no help available for this option yet.\n"
40static const char *get_help(struct menu *menu) 41static const char *get_help(struct menu *menu)
41{ 42{
42 if (menu_has_help(menu)) 43 if (menu_has_help(menu))
43 return menu_get_help(menu); 44 return _(menu_get_help(menu));
44 else 45 else
45 return nohelp_text; 46 return nohelp_text;
46} 47}
@@ -78,7 +79,7 @@ static int conf_askvalue(struct symbol *sym, const char *def)
78 tristate val; 79 tristate val;
79 80
80 if (!sym_has_value(sym)) 81 if (!sym_has_value(sym))
81 printf("(NEW) "); 82 printf(_("(NEW) "));
82 83
83 line[0] = '\n'; 84 line[0] = '\n';
84 line[1] = 0; 85 line[1] = 0;
@@ -183,7 +184,7 @@ int conf_string(struct menu *menu)
183 const char *def; 184 const char *def;
184 185
185 while (1) { 186 while (1) {
186 printf("%*s%s ", indent - 1, "", menu->prompt->text); 187 printf("%*s%s ", indent - 1, "", _(menu->prompt->text));
187 printf("(%s) ", sym->name); 188 printf("(%s) ", sym->name);
188 def = sym_get_string_value(sym); 189 def = sym_get_string_value(sym);
189 if (sym_get_string_value(sym)) 190 if (sym_get_string_value(sym))
@@ -216,7 +217,7 @@ static int conf_sym(struct menu *menu)
216 tristate oldval, newval; 217 tristate oldval, newval;
217 218
218 while (1) { 219 while (1) {
219 printf("%*s%s ", indent - 1, "", menu->prompt->text); 220 printf("%*s%s ", indent - 1, "", _(menu->prompt->text));
220 if (sym->name) 221 if (sym->name)
221 printf("(%s) ", sym->name); 222 printf("(%s) ", sym->name);
222 type = sym_get_type(sym); 223 type = sym_get_type(sym);
@@ -306,7 +307,7 @@ static int conf_choice(struct menu *menu)
306 case no: 307 case no:
307 return 1; 308 return 1;
308 case mod: 309 case mod:
309 printf("%*s%s\n", indent - 1, "", menu_get_prompt(menu)); 310 printf("%*s%s\n", indent - 1, "", _(menu_get_prompt(menu)));
310 return 0; 311 return 0;
311 case yes: 312 case yes:
312 break; 313 break;
@@ -316,7 +317,7 @@ static int conf_choice(struct menu *menu)
316 while (1) { 317 while (1) {
317 int cnt, def; 318 int cnt, def;
318 319
319 printf("%*s%s\n", indent - 1, "", menu_get_prompt(menu)); 320 printf("%*s%s\n", indent - 1, "", _(menu_get_prompt(menu)));
320 def_sym = sym_get_choice_value(sym); 321 def_sym = sym_get_choice_value(sym);
321 cnt = def = 0; 322 cnt = def = 0;
322 line[0] = 0; 323 line[0] = 0;
@@ -324,7 +325,7 @@ static int conf_choice(struct menu *menu)
324 if (!menu_is_visible(child)) 325 if (!menu_is_visible(child))
325 continue; 326 continue;
326 if (!child->sym) { 327 if (!child->sym) {
327 printf("%*c %s\n", indent, '*', menu_get_prompt(child)); 328 printf("%*c %s\n", indent, '*', _(menu_get_prompt(child)));
328 continue; 329 continue;
329 } 330 }
330 cnt++; 331 cnt++;
@@ -333,14 +334,14 @@ static int conf_choice(struct menu *menu)
333 printf("%*c", indent, '>'); 334 printf("%*c", indent, '>');
334 } else 335 } else
335 printf("%*c", indent, ' '); 336 printf("%*c", indent, ' ');
336 printf(" %d. %s", cnt, menu_get_prompt(child)); 337 printf(" %d. %s", cnt, _(menu_get_prompt(child)));
337 if (child->sym->name) 338 if (child->sym->name)
338 printf(" (%s)", child->sym->name); 339 printf(" (%s)", child->sym->name);
339 if (!sym_has_value(child->sym)) 340 if (!sym_has_value(child->sym))
340 printf(" (NEW)"); 341 printf(_(" (NEW)"));
341 printf("\n"); 342 printf("\n");
342 } 343 }
343 printf("%*schoice", indent - 1, ""); 344 printf(_("%*schoice"), indent - 1, "");
344 if (cnt == 1) { 345 if (cnt == 1) {
345 printf("[1]: 1\n"); 346 printf("[1]: 1\n");
346 goto conf_childs; 347 goto conf_childs;
@@ -433,7 +434,7 @@ static void conf(struct menu *menu)
433 if (prompt) 434 if (prompt)
434 printf("%*c\n%*c %s\n%*c\n", 435 printf("%*c\n%*c %s\n%*c\n",
435 indent, '*', 436 indent, '*',
436 indent, '*', prompt, 437 indent, '*', _(prompt),
437 indent, '*'); 438 indent, '*');
438 default: 439 default:
439 ; 440 ;
@@ -499,6 +500,10 @@ int main(int ac, char **av)
499 const char *name; 500 const char *name;
500 struct stat tmpstat; 501 struct stat tmpstat;
501 502
503 setlocale(LC_ALL, "");
504 bindtextdomain(PACKAGE, LOCALEDIR);
505 textdomain(PACKAGE);
506
502 while ((opt = getopt(ac, av, "osdD:nmyrh")) != -1) { 507 while ((opt = getopt(ac, av, "osdD:nmyrh")) != -1) {
503 switch (opt) { 508 switch (opt) {
504 case 'o': 509 case 'o':
@@ -529,11 +534,11 @@ int main(int ac, char **av)
529 srand(time(NULL)); 534 srand(time(NULL));
530 break; 535 break;
531 case 'h': 536 case 'h':
532 printf("See README for usage info\n"); 537 printf(_("See README for usage info\n"));
533 exit(0); 538 exit(0);
534 break; 539 break;
535 default: 540 default:
536 fprintf(stderr, "See README for usage info\n"); 541 fprintf(stderr, _("See README for usage info\n"));
537 exit(1); 542 exit(1);
538 } 543 }
539 } 544 }
@@ -549,9 +554,9 @@ int main(int ac, char **av)
549 if (!defconfig_file) 554 if (!defconfig_file)
550 defconfig_file = conf_get_default_confname(); 555 defconfig_file = conf_get_default_confname();
551 if (conf_read(defconfig_file)) { 556 if (conf_read(defconfig_file)) {
552 printf("***\n" 557 printf(_("***\n"
553 "*** Can't find default configuration \"%s\"!\n" 558 "*** Can't find default configuration \"%s\"!\n"
554 "***\n", defconfig_file); 559 "***\n"), defconfig_file);
555 exit(1); 560 exit(1);
556 } 561 }
557 break; 562 break;