On Jan/27/2010, Carles Pina i Estany wrote:
> 
> Hi,
> 
> Here is the first patch to gettextizze strings in util/* (well, before
> some things has been done).


Now with the patch attached.

-- 
Carles Pina i Estany
        http://pinux.info
=== modified file 'ChangeLog'
--- ChangeLog	2010-01-26 21:23:59 +0000
+++ ChangeLog	2010-01-26 22:26:23 +0000
@@ -1,4 +1,20 @@
 2010-01-26  Carles Pina i Estany  <car...@pina.cat>
+	
+	* 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  <car...@pina.cat>
 
 	* util/bin2h.c (usage): Fix warning (space after backslash).
 

=== modified file 'po/POTFILES'
--- po/POTFILES	2010-01-21 08:04:49 +0000
+++ po/POTFILES	2010-01-26 22:17:33 +0000
@@ -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'
--- util/grub-editenv.c	2010-01-16 00:39:14 +0000
+++ util/grub-editenv.c	2010-01-26 22:05:13 +0000
@@ -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'
--- util/grub-emu.c	2010-01-16 00:39:14 +0000
+++ util/grub-emu.c	2010-01-26 22:06:02 +0000
@@ -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'
--- util/grub-fstest.c	2010-01-20 08:12:47 +0000
+++ util/grub-fstest.c	2010-01-26 22:07:18 +0000
@@ -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'
--- util/grub-macho2img.c	2009-06-10 21:04:23 +0000
+++ util/grub-macho2img.c	2010-01-26 22:08:00 +0000
@@ -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'
--- util/grub-mkdevicemap.c	2010-01-16 00:26:52 +0000
+++ util/grub-mkdevicemap.c	2010-01-26 22:09:27 +0000
@@ -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'
--- util/grub-mkfont.c	2010-01-26 20:16:08 +0000
+++ util/grub-mkfont.c	2010-01-26 22:10:45 +0000
@@ -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 *fon
       int 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 *f
 
   if (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'
--- util/grub-mkpasswd-pbkdf2.c	2010-01-20 06:36:17 +0000
+++ util/grub-mkpasswd-pbkdf2.c	2010-01-26 22:11:38 +0000
@@ -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'
--- util/grub-mkrelpath.c	2010-01-16 00:26:52 +0000
+++ util/grub-mkrelpath.c	2010-01-26 22:12:27 +0000
@@ -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'
--- util/grub-pe2elf.c	2010-01-16 00:26:52 +0000
+++ util/grub-pe2elf.c	2010-01-26 22:13:05 +0000
@@ -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'
--- util/grub-probe.c	2010-01-20 02:11:07 +0000
+++ util/grub-probe.c	2010-01-26 22:13:22 +0000
@@ -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'
--- util/grub-script-check.c	2010-01-18 11:28:31 +0000
+++ util/grub-script-check.c	2010-01-26 22:13:58 +0000
@@ -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

_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel
  • gettext util/* Carles Pina i Estany
    • Re: gettext util/* Carles Pina i Estany

Reply via email to