Hi,

On Dec/05/2009, Robert Millan wrote:

> > There is one string in function grub_normal_reader_init:
> > 
> > -------
> >   grub_printf (_("\
> >  [ Minimal BASH-like line editing is supported. For the first word, TAB\n\
> >    lists possible command completions. Anywhere else TAB lists possible\n\
> >    device/file completions.%s ]\n\n"),
> >                reader_nested ? " ESC at any time exits." : "");
> > -------


> Doesn't matter.  But if you do this, please remove the brackets.

Now it's indented like the other indented messages. See the attached
patch.

If needed I can reduce the left and right margins (adding a parameter to
print_message_indented).

Tested in my system and works fine in English and my Catalan draft.

If it's fine I would commit.

Thanks,

-- 
Carles Pina i Estany
        http://pinux.info
=== modified file 'include/grub/normal.h'
--- include/grub/normal.h	2009-08-24 23:55:06 +0000
+++ include/grub/normal.h	2009-12-05 20:14:56 +0000
@@ -73,6 +73,7 @@ void grub_parse_color_name_pair (grub_ui
 
 /* Defined in `menu_text.c'.  */
 void grub_wait_after_message (void);
+void print_message_indented (const char *msg);
 
 /* Defined in `handler.c'.  */
 void read_handler_list (void);

=== modified file 'normal/auth.c'
--- normal/auth.c	2009-11-09 14:30:47 +0000
+++ normal/auth.c	2009-12-05 19:10:45 +0000
@@ -23,6 +23,7 @@
 #include <grub/env.h>
 #include <grub/normal.h>
 #include <grub/time.h>
+#include <grub/i18n.h>
 
 struct grub_auth_user
 {
@@ -237,7 +238,7 @@ grub_auth_check_authentication (const ch
       return GRUB_ERR_NONE;
     }
 
-  if (!grub_cmdline_get ("Enter username: ", login, sizeof (login) - 1,
+  if (!grub_cmdline_get (_("Enter username: "), login, sizeof (login) - 1,
 			 0, 0, 0))
     goto access_denied;
 

=== modified file 'normal/color.c'
--- normal/color.c	2008-03-26 13:01:02 +0000
+++ normal/color.c	2009-12-05 19:12:14 +0000
@@ -20,6 +20,7 @@
 #include <grub/mm.h>
 #include <grub/normal.h>
 #include <grub/term.h>
+#include <grub/i18n.h>
 
 /* Borrowed from GRUB Legacy */
 static char *color_list[16] =
@@ -76,7 +77,7 @@ grub_parse_color_name_pair (grub_uint8_t
   bg_name = grub_strchr (fg_name, '/');
   if (bg_name == NULL)
     {
-      grub_printf ("Warning: syntax error (missing slash) in `%s'\n", fg_name);
+      grub_printf (_("Warning: syntax error (missing slash) in `%s'\n"), fg_name);
       grub_wait_after_message ();
       goto free_and_return;
     }
@@ -85,13 +86,13 @@ grub_parse_color_name_pair (grub_uint8_t
 
   if (parse_color_name (&fg, fg_name) == -1)
     {
-      grub_printf ("Warning: invalid foreground color `%s'\n", fg_name);
+      grub_printf (_("Warning: invalid foreground color `%s'\n"), fg_name);
       grub_wait_after_message ();
       goto free_and_return;
     }
   if (parse_color_name (&bg, bg_name) == -1)
     {
-      grub_printf ("Warning: invalid background color `%s'\n", bg_name);
+      grub_printf (_("Warning: invalid background color `%s'\n"), bg_name);
       grub_wait_after_message ();
       goto free_and_return;
     }

=== modified file 'normal/main.c'
--- normal/main.c	2009-11-25 03:48:33 +0000
+++ normal/main.c	2009-12-05 20:36:30 +0000
@@ -509,11 +509,19 @@ grub_normal_reader_init (void)
   grub_normal_init_page ();
   grub_setcursor (1);
 
-  grub_printf (_("\
- [ Minimal BASH-like line editing is supported. For the first word, TAB\n\
-   lists possible command completions. Anywhere else TAB lists possible\n\
-   device/file completions.%s ]\n\n"),
-	       reader_nested ? " ESC at any time exits." : "");
+  const char *msg = _("Minimal BASH-like line editing is supported. For \
+the first word, TAB lists possible command completions. Anywhere else TAB \
+lists possible device/file completions. %s");
+  const char *msg_esc = _("ESC at any time exits.");
+
+  char *msg_formatted = grub_malloc (sizeof (char) * (grub_strlen (msg) + 
+  		grub_strlen(msg_esc) + 1));
+  
+  grub_sprintf (msg_formatted, msg, reader_nested ? msg_esc : "");
+  print_message_indented (msg_formatted);
+  grub_printf ("\n\n");
+
+  grub_free (msg_formatted);
 
   return 0;
 }

=== modified file 'normal/menu_text.c'
--- normal/menu_text.c	2009-12-05 11:25:07 +0000
+++ normal/menu_text.c	2009-12-05 20:30:23 +0000
@@ -77,7 +77,7 @@ getstringwidth (grub_uint32_t * str, con
   return width;
 }
 
-static void
+void
 print_message_indented (const char *msg)
 {
   const int line_len = GRUB_TERM_WIDTH - grub_getcharwidth ('m') * 15;

=== modified file 'normal/misc.c'
--- normal/misc.c	2009-06-10 21:04:23 +0000
+++ normal/misc.c	2009-12-05 19:18:21 +0000
@@ -24,6 +24,8 @@
 #include <grub/misc.h>
 #include <grub/mm.h>
 #include <grub/datetime.h>
+#include <grub/term.h>
+#include <grub/i18n.h>
 
 /* Print the information on the device NAME.  */
 grub_err_t
@@ -34,13 +36,16 @@ grub_normal_print_device_info (const cha
 
   p = grub_strchr (name, ',');
   if (p)
-    grub_printf ("\tPartition %s: ", name);
+    {
+      grub_putchar ('\t');
+      grub_printf (_("Partition %s: "), name);
+    }
   else
-    grub_printf ("Device %s: ", name);
+    grub_printf (_("Device %s: "), name);
 
   dev = grub_device_open (name);
   if (! dev)
-    grub_printf ("Filesystem cannot be accessed");
+    grub_printf (_("Filesystem cannot be accessed"));
   else if (dev->disk)
     {
       grub_fs_t fs;
@@ -51,7 +56,7 @@ grub_normal_print_device_info (const cha
 
       if (fs)
 	{
-	  grub_printf ("Filesystem type %s", fs->name);
+	  grub_printf (_("Filesystem type %s"), fs->name);
 	  if (fs->label)
 	    {
 	      char *label;
@@ -59,7 +64,7 @@ grub_normal_print_device_info (const cha
 	      if (grub_errno == GRUB_ERR_NONE)
 		{
 		  if (label && grub_strlen (label))
-		    grub_printf (", Label %s", label);
+		    grub_printf (_(", Label %s"), label);
 		  grub_free (label);
 		}
 	      grub_errno = GRUB_ERR_NONE;
@@ -72,8 +77,8 @@ grub_normal_print_device_info (const cha
 	      if (grub_errno == GRUB_ERR_NONE)
 		{
 		  grub_unixtime2datetime (tm, &datetime);
-		  grub_printf (", Last modification time %d-%02d-%02d "
-			       "%02d:%02d:%02d %s",
+		  grub_printf (_(", Last modification time %d-%02d-%02d "
+			       "%02d:%02d:%02d %s"),
 			       datetime.year, datetime.month, datetime.day,
 			       datetime.hour, datetime.minute, datetime.second,
 			       grub_get_weekday_name (&datetime));
@@ -95,9 +100,9 @@ grub_normal_print_device_info (const cha
 	    }
 	}
       else if (! dev->disk->has_partitions || dev->disk->partition)
-	grub_printf ("Unknown filesystem");
+	grub_printf (_("Unknown filesystem"));
       else
-	grub_printf ("Partition table");
+	grub_printf (_("Partition table"));
 
       grub_device_close (dev);
     }

=== modified file 'po/POTFILES'
--- po/POTFILES	2009-12-05 11:25:07 +0000
+++ po/POTFILES	2009-12-05 20:36:51 +0000
@@ -11,5 +11,9 @@ util/mkisofs/rock.c
 util/mkisofs/tree.c
 util/mkisofs/write.c
 
+normal/auth.c
+normal/color.c
+normal/main.c
 normal/menu_entry.c
 normal/menu_text.c
+normal/misc.c

2009-12-05 Carles Pina i Estany  <car...@pina.cat>

        * include/grub/normal.h: Declare print_message_indented.
        * normal/auth.c: Include `<grub/i18n.h>'.
        (grub_auth_check_authentication): Gettexttize string.
        * normal/color.c: Include `<grub/i18n.h>'.
        (grub_parse_color_name_pair): Gettexttize strings.
        * normal/main.c (grub_normal_reader_init): Cleanup gettexttized
        string.
        * normal/menu_text.c (print_message_indented): Remove `static'
        qualifer (this function is now used in normal/main.c).
        * normal/misc.c: Include `<grub/term.h>' and `<grub/i18n.h>'.
        (grub_normal_print_device_info): Gettexttize strings.
        * po/POTFILES: Add auth.c, color.c, main.c and misc.c
_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to