gettext util/*
Hi,
Here is the first patch to gettextizze strings in util/* (well, before some things has been done).
Vladimir suggested to not gettext:
+ printf (_("\nGlyph #%d, U+%04x\n"), num, glyph->char_code);
+ printf (_("Width %d, Height %d, X offset %d, Y offset %d, Device
width %d\n"),
I'm fine to leave it out.
It gettexts mainly everything but not grub_util_error / grub_util_info calls, waiting how we handle it (to be discussed later in another thread).
Any feedback?
Thanks,
Signature · 2 lines
Carles Pina i Estany http://pinux.info
Quoted 5 lines · Carles Pina i Estany
Hi,
Here is the first patch to gettextizze strings in util/* (well, before some things has been done).
Now with the patch attached.
Signature · 2 lines
Carles Pina i Estany http://pinux.info
=== modified file 'ChangeLog'
ChangeLog +16 -0
@@ -1,4 +1,20 @@ 2010-01-26 Carles Pina i Estany <[email protected]> + + * util/grub-editenv.c: Gettextizze mainly all user interface strings + excepting grub_util_info or grub_util_error. + * util/grub-emu.c: Likewise. + * util/grub-fstest.c: Likewise. + * util/grub-macho2img.c: Likewise. + * util/grub-mkdevicemap.c: Likewise. + * util/grub-mkfont.c: Likewise. + * util/grub-mkpasswd-pbkdf2.c: Likewise. + * util/grub-mkrelpath.c: Likewise. + * util/grub-pe2elf.c: Likewise. + * util/grub-probe.c: Likewise. + * util/grub-script-check.c: Likewise. + * po/POTFILES: Add gettextizzed files. + +2010-01-26 Carles Pina i Estany <[email protected]> * util/bin2h.c (usage): Fix warning (space after backslash).
=== modified file 'po/POTFILES'
POTFILES +12 -0
@@ -77,5 +77,17 @@ normal/misc.c term/serial.c +util/grub-editenv.c +util/grub-emu.c +util/grub-fstest.c +util/grub-macho2img.c +util/grub-mkdevicemap.c +util/grub-mkfont.c +util/grub-mkpasswd-pbkdf2.c util/grub-mkrawimage.c +util/grub-mkrelpath.c +util/grub-pe2elf.c +util/grub-probe.c +util/grub-probe.c +util/grub-script-check.c util/i386/pc/grub-setup.c
=== modified file 'util/grub-editenv.c'
grub-editenv.c +5 -5
@@ -69,9 +69,9 @@ static void usage (int status) {if (status) -fprintf (stderr,"Try `%s --help' for more information.\n" , program_name); +fprintf (stderr,_ ("Try `%s --help' for more information.\n" ), program_name);else - printf ("\ + printf (_("\ Usage: %s [OPTIONS] [FILENAME] COMMAND\n\ \n\ Tool to edit environment block.\n\
@@ -87,7 +87,7 @@ Tool to edit environment block.\n\ \n\ If not given explicitly, FILENAME defaults to %s.\n\ \n\ -Report bugs to <%s>.\n", +Report bugs to <%s>.\n"), program_name, DEFAULT_DIRECTORY "/" GRUB_ENVBLK_DEFCFG, PACKAGE_BUGREPORT);exit (status);
@@ -287,7 +287,7 @@ main (int argc, char *argv[])/* Obtain the filename. */ if (optind >= argc) { -fprintf (stderr,"no filename specified\n" ); +fprintf (stderr,_ ("no filename specified\n" ));usage (1 ); }
@@ -312,7 +312,7 @@ main (int argc, char *argv[])unset_variables (filename, argc - optind -2 , argv + optind +2 ); else { -fprintf (stderr,"unknown command %s\n" , command); +fprintf (stderr,_ ("unknown command %s\n" ), command);usage (1 ); }
=== modified file 'util/grub-emu.c'
grub-emu.c +5 -5
@@ -129,10 +129,10 @@ usage (int status) {if (status)fprintf (stderr, -"Try `%s --help' for more information.\n" , program_name); +_ ("Try `%s --help' for more information.\n" ), program_name);else printf ( -"Usage: %s [OPTION]...\n" + _("Usage: %s [OPTION]...\n" "\n" "GRUB emulator.\n" "\n"
@@ -144,7 +144,7 @@ usage (int status)" -h, --help display this message and exit\n" " -V, --version print version information and exit\n" "\n" - "Report bugs to <%s>.\n", program_name, DEFAULT_DEVICE_MAP, DEFAULT_DIRECTORY, PACKAGE_BUGREPORT); + "Report bugs to <%s>.\n"), program_name, DEFAULT_DEVICE_MAP, DEFAULT_DIRECTORY, PACKAGE_BUGREPORT);return status; }
@@ -191,13 +191,13 @@ main (int argc, char *argv[])if (optind < argc) { -fprintf (stderr,"Unknown extra argument `%s'.\n" , argv[optind]); +fprintf (stderr,_ ("Unknown extra argument `%s'.\n" ), argv[optind]);return usage (1 ); }/* Wait until the ARGS.HOLD variable is cleared by an attached debugger. */ if (hold && verbosity >0 ) -printf ("Run \"gdb %s %d\", and set ARGS.HOLD to zero.\n" , +printf (_ ("Run \"gdb %s %d\", and set ARGS.HOLD to zero.\n" ), program_name, (int )getpid ());while (hold) {
=== modified file 'util/grub-fstest.c'
grub-fstest.c +8 -8
@@ -367,9 +367,9 @@ static void usage (int status) {if (status) -fprintf (stderr,"Try `%s --help' for more information.\n" , program_name); +fprintf (stderr,_ ("Try `%s --help' for more information.\n" ), program_name);else - printf ("\ + printf (_("\ Usage: %s [OPTION]... IMAGE_PATH COMMANDS\n\ \n\ Debug tool for filesystem driver.\n\
@@ -390,7 +390,7 @@ Debug tool for filesystem driver.\n\ -V, --version print version information and exit\n\ -v, --verbose print verbose messages\n\ \n\ -Report bugs to <%s>.\n", program_name, PACKAGE_BUGREPORT); +Report bugs to <%s>.\n"), program_name, PACKAGE_BUGREPORT); exit (status); }
@@ -481,7 +481,7 @@ main (int argc, char *argv[])/* Obtain PATH. */ if (optind + num_disks -1 >= argc) { -fprintf (stderr,"Not enough pathname.\n" ); +fprintf (stderr,_ ("Not enough pathname.\n" ));usage (1 ); }
@@ -489,7 +489,7 @@ main (int argc, char *argv[])for (i =0 ; i < num_disks; i++, optind++)if (argv[optind][0 ] !='/' ) { -fprintf (stderr,"Must use absolute path.\n" ); +fprintf (stderr,_ ("Must use absolute path.\n" ));usage (1 ); }
@@ -529,13 +529,13 @@ main (int argc, char *argv[]) }else { -fprintf (stderr,"Invalid command %s.\n" , argv[optind]); +fprintf (stderr,_ ("Invalid command %s.\n" ), argv[optind]);usage (1 ); }if (optind +1 + nparm > argc) { -fprintf (stderr,"Invalid parameter for command %s.\n" , +fprintf (stderr,_ ("Invalid parameter for command %s.\n" ), argv[optind]);usage (1 ); }
@@ -544,7 +544,7 @@ main (int argc, char *argv[]) }else { -fprintf (stderr,"No command is specified.\n" ); +fprintf (stderr,_ ("No command is specified.\n" ));usage (1 ); }
=== modified file 'util/grub-macho2img.c'
grub-macho2img.c +7 -7
@@ -44,21 +44,21 @@ main (int argc, char **argv) do_bss =1 ;if (argc <2 + do_bss) { -printf ("Usage: %s [--bss] filename.exec filename.img\n" -"Convert Mach-O into raw image\n" , argv[0 ]); +printf (_ ("Usage: %s [--bss] filename.exec filename.img\n" +"Convert Mach-O into raw image\n" ), argv[0 ]);return 0 ; } in =fopen (argv[1 + do_bss],"rb" );if (! in) { -printf ("Couldn't open %s\n" , argv[1 + do_bss]); +printf (_ ("Couldn't open %s\n" ), argv[1 + do_bss]);return 1 ; } out =fopen (argv[2 + do_bss],"wb" );if (! out) {fclose (in); -printf ("Couldn't open %s\n" , argv[2 + do_bss]); +printf (_ ("Couldn't open %s\n" ), argv[2 + do_bss]);return 2 ; }fseek (in,0 ,SEEK_END );
@@ -69,7 +69,7 @@ main (int argc, char **argv) {fclose (in);fclose (out); -printf ("Couldn't allocate buffer\n" ); +printf (_ ("Couldn't allocate buffer\n" ));return 3 ; }fread (buf,1 , bufsize, in);
@@ -79,7 +79,7 @@ main (int argc, char **argv)fclose (in);fclose (out);free (buf); -printf ("Invalid Mach-O fle\n" ); +printf (_ ("Invalid Mach-O fle\n" ));return 4 ; } curcmd = (struct grub_macho_segment32 *) (buf +sizeof (*head));
@@ -111,6 +111,6 @@ main (int argc, char **argv) }fclose (in);fclose (out); -printf ("macho2img complete\n" ); +printf (_ ("macho2img complete\n" ));return 0 ; }
=== modified file 'util/grub-mkdevicemap.c'
grub-mkdevicemap.c +3 -4
@@ -84,9 +84,9 @@ usage (int status) {if (status)fprintf (stderr, -"Try `%s --help' for more information.\n" , program_name); +_ ("Try `%s --help' for more information.\n" ), program_name);else - printf ("\ + printf (_("\ Usage: %s [OPTION]...\n\ \n\ Generate a device map file automatically.\n\
@@ -98,8 +98,7 @@ Generate a device map file automatically -V, --version print version information and exit\n\ -v, --verbose print verbose messages\n\ \n\ -Report bugs to <%s>.\n\ -", program_name, +Report bugs to <%s>.\n"), program_name, DEFAULT_DEVICE_MAP, PACKAGE_BUGREPORT);exit (status);
=== modified file 'util/grub-mkfont.c'
grub-mkfont.c +11 -11
@@ -104,9 +104,9 @@ static void usage (int status) {if (status) -fprintf (stderr,"Try `%s --help' for more information.\n" , program_name); +fprintf (stderr,_ ("Try `%s --help' for more information.\n" ), program_name);else - printf ("\ + printf (_("\ Usage: %s [OPTIONS] FONT_FILES\n\ \nOptions:\n\ -o, --output=FILE_NAME set output file name\n\
@@ -125,7 +125,7 @@ Usage: %s [OPTIONS] FONT_FILES\n\ -V, --version print version information and exit\n\ -v, --verbose print verbose messages\n\ \n\ -Report bugs to <%s>.\n", program_name, PACKAGE_BUGREPORT); +Report bugs to <%s>.\n"), program_name, PACKAGE_BUGREPORT); exit (status); }
@@ -286,8 +286,8 @@ print_glyphs (struct grub_font_info *fonint x, y, xmax, xmin, ymax, ymin;grub_uint8_t *bitmap, mask; -printf ("\nGlyph #%d, U+%04x\n" , num, glyph->char_code); -printf ("Width %d, Height %d, X offset %d, Y offset %d, Device width %d\n" , +printf (_ ("\nGlyph #%d, U+%04x\n" ), num, glyph->char_code); +printf (_ ("Width %d, Height %d, X offset %d, Y offset %d, Device width %d\n" ), glyph->width, glyph->height, glyph->x_ofs, glyph->y_ofs, glyph->device_width);
@@ -461,11 +461,11 @@ write_font_pf2 (struct grub_font_info *fif (font_verbosity >0 ) { -printf ("Font name: %s\n" , font_name); -printf ("Max width: %d\n" , font_info->max_width); -printf ("Max height: %d\n" , font_info->max_height); -printf ("Font ascent: %d\n" , font_info->asce); -printf ("Font descent: %d\n" , font_info->desc); +printf (_ ("Font name: %s\n" ), font_name); +printf (_ ("Max width: %d\n" ), font_info->max_width); +printf (_ ("Max height: %d\n" ), font_info->max_height); +printf (_ ("Font ascent: %d\n" ), font_info->asce); +printf (_ ("Font descent: %d\n" ), font_info->desc); } num =0 ;
@@ -485,7 +485,7 @@ write_font_pf2 (struct grub_font_info *f font_info->glyph = pre;if (font_verbosity >0 ) -printf ("Number of glyph: %d\n" , num); +printf (_ ("Number of glyph: %d\n" ), num); leng =grub_cpu_to_be32 (num *9 ); grub_util_write_image (FONT_FORMAT_SECTION_NAMES_CHAR_INDEX,
=== modified file 'util/grub-mkpasswd-pbkdf2.c'
grub-mkpasswd-pbkdf2.c +6 -6
@@ -74,16 +74,16 @@ static void usage (int status) {if (status) -fprintf (stderr,"Try `%s --help' for more information.\n" , program_name); +fprintf (stderr,_ ("Try `%s --help' for more information.\n" ), program_name);else -printf ("\ +printf (_ ("\ Usage: %s [OPTIONS]\n\ \nOptions:\n\ -c number, --iteration-count=number Number of PBKDF2 iterations\n\ -l number, --buflen=number Length of generated hash\n\ -s number, --salt=number Length of salt\n\ \n\ -Report bugs to <%s>.\n" , program_name,PACKAGE_BUGREPORT ); +Report bugs to <%s>.\n" ), program_name,PACKAGE_BUGREPORT );exit (status); }
@@ -210,7 +210,7 @@ main (int argc, char *argv[])else tty_changed =0 ; -printf ("Enter password: " ); +printf (_ ("Enter password: " )); pass1 =NULL ; {grub_size_t n;
@@ -230,7 +230,7 @@ main (int argc, char *argv[])if (nr >=1 && pass1[nr-1 ] =='\n' ) pass1[nr-1 ] =0 ; -printf ("\nReenter password: " ); +printf (_ ("\nReenter password: " )); pass2 =NULL ; {grub_size_t n;
@@ -327,7 +327,7 @@ main (int argc, char *argv[])hexify (bufhex, buf, buflen);hexify (salthex, salt, saltlen); -printf ("Your PBKDF2 is grub.pbkdf2.sha512.%d.%s.%s\n" , c, salthex, bufhex); +printf (_ ("Your PBKDF2 is grub.pbkdf2.sha512.%d.%s.%s\n" ), c, salthex, bufhex);memset (buf,0 , buflen);memset (bufhex,0 ,2 * buflen);free (buf);
=== modified file 'util/grub-mkrelpath.c'
grub-mkrelpath.c +5 -5
@@ -34,9 +34,9 @@ static void usage (int status) {if (status) -fprintf (stderr,"Try `%s --help' for more information.\n" , program_name); +fprintf (stderr,_ ("Try `%s --help' for more information.\n" ), program_name);else - printf ("\ + printf (_("\ Usage: %s [OPTIONS] PATH\n\ \n\ Make a system path relative to it's root.\n\
@@ -45,7 +45,7 @@ Options:\n\ -h, --help display this message and exit\n\ -V, --version print version information and exit\n\ \n\ -Report bugs to <%s>.\n", program_name, PACKAGE_BUGREPORT); +Report bugs to <%s>.\n"), program_name, PACKAGE_BUGREPORT); exit (status); }
@@ -85,13 +85,13 @@ main (int argc, char *argv[])if (optind >= argc) { -fprintf (stderr,"No path is specified.\n" ); +fprintf (stderr,_ ("No path is specified.\n" ));usage (1 ); }if (optind +1 != argc) { -fprintf (stderr,"Unknown extra argument `%s'.\n" , argv[optind +1 ]); +fprintf (stderr,_ ("Unknown extra argument `%s'.\n" ), argv[optind +1 ]);usage (1 ); }
=== modified file 'util/grub-pe2elf.c'
grub-pe2elf.c +4 -4
@@ -40,9 +40,9 @@ static void usage (int status) {if (status) -fprintf (stderr,"Try `%s --help' for more information.\n" , program_name); +fprintf (stderr,_ ("Try `%s --help' for more information.\n" ), program_name);else - printf ("\ + printf (_("\ Usage: %s [OPTIONS] input [output]\n\ \n\ Tool to convert pe image to elf.\n\
@@ -51,7 +51,7 @@ Tool to convert pe image to elf.\n\ -V, --version print version information and exit\n\ -v, --verbose print verbose messages\n\ \n\ -Report bugs to <%s>.\n", program_name, PACKAGE_BUGREPORT); +Report bugs to <%s>.\n"), program_name, PACKAGE_BUGREPORT); exit (status); }
@@ -500,7 +500,7 @@ main (int argc, char *argv[])/* Obtain PATH. */ if (optind >= argc) { -fprintf (stderr,"Filename not specified.\n" ); +fprintf (stderr,_ ("Filename not specified.\n" ));usage (1 ); }
=== modified file 'util/grub-probe.c'
grub-probe.c +5 -5
@@ -314,9 +314,9 @@ usage (int status) {if (status)fprintf (stderr, -"Try `%s --help' for more information.\n" , program_name); +_ ("Try `%s --help' for more information.\n" ), program_name);else - printf ("\ + printf (_("\ Usage: %s [OPTION]... [PATH|DEVICE]\n\ \n\ Probe device information for a given path (or device, if the -d option is given).\n\
@@ -330,7 +330,7 @@ Probe device information for a given pat -v, --verbose print verbose messages\n\ \n\ Report bugs to <%s>.\n\ -", program_name, +"), program_name, DEFAULT_DEVICE_MAP, PACKAGE_BUGREPORT);exit (status);
@@ -408,13 +408,13 @@ main (int argc, char *argv[])/* Obtain ARGUMENT. */ if (optind >= argc) { -fprintf (stderr,"No path or device is specified.\n" ); +fprintf (stderr,_ ("No path or device is specified.\n" ));usage (1 ); }if (optind +1 != argc) { -fprintf (stderr,"Unknown extra argument `%s'.\n" , argv[optind +1 ]); +fprintf (stderr,_ ("Unknown extra argument `%s'.\n" ), argv[optind +1 ]);usage (1 ); }
=== modified file 'util/grub-script-check.c'
grub-script-check.c +4 -5
@@ -117,9 +117,9 @@ usage (int status) {if (status)fprintf (stderr, -"Try ``%s --help'' for more information.\n" , program_name); +_ ("Try ``%s --help'' for more information.\n" ), program_name);else - printf ("\ + printf (_("\ Usage: %s [PATH]\n\ \n\ Checks GRUB script configuration file for syntax errors.\n\
@@ -128,8 +128,7 @@ Checks GRUB script configuration file fo -V, --version print version information and exit\n\ -v, --verbose print script being processed\n\ \n\ -Report bugs to <%s>.\n\ -", program_name, +Report bugs to <%s>.\n"), program_name, PACKAGE_BUGREPORT);exit (status); }
@@ -208,7 +207,7 @@ main (int argc, char *argv[]) }else if (optind +1 != argc) { -fprintf (stderr,"Unknown extra argument `%s'.\n" , argv[optind +1 ]); +fprintf (stderr,_ ("Unknown extra argument `%s'.\n" ), argv[optind +1 ]);usage (1 ); }else