]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
Uncommits the last commits (to make the new merge with trunk easier)
authorCarles Pina i Estany <carles@pina.cat>
Mon, 23 Nov 2009 20:22:36 +0000 (20:22 +0000)
committerCarles Pina i Estany <carles@pina.cat>
Mon, 23 Nov 2009 20:22:36 +0000 (20:22 +0000)
ChangeLog
normal/main.c
normal/menu_entry.c
normal/menu_text.c

index d9f2cee2aea5d8bc2424688c098b23ebef3ea81d..4a26413d42ecbb7dd92b18ff8de50a4d3d761e6e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,22 +1,3 @@
-2009-11-22  Carles Pina i Estany <carles@pina.cat>
-
-       * conf/common.rmk: Add grub-gettext_lib target and updates
-         lib_DATA and CLEANFILES. Adds gettext.mod SOURCES, CFLAGS,
-         LDFLAGS.
-       * gettext/gettext.c: New file. (Reads mo files).
-       * include/grub/file.h (grub_file_pread): New prototype.
-       * include/grub/i18n.h (_): New prototype.
-       * include/grub/misc.h (grub_gettext_dummy, grub_gettext): New 
-         prototypes.
-       * kern/misc.c (grub_gettext_dummy): New function.
-       * menu/menu_text.c: Include <grub/i18n.h>.
-       * menu/menu_text.c (print_timeout): Gettexttize string.
-       * menu/menu_text.c (print_message): Gettexttize string.
-       * po/POTFILES: Add `normal/menu_text.c'.
-       * po/ca.po: Add new translations.
-       * util/grub.d/00_header.in: Define locale_dir and lang. insmod 
-         gettext module and defines locale_dir and lang in grub.cfg.
-
 2009-11-22  Robert Millan  <rmh.grub@aybabtu.com>
 
        * util/i386/pc/grub-mkimage.c: Ungettextize grub_util_info() strings.
index 748eef80534114ed1249a47be90c55e1d6c54742..afe3667f37ab6dc64db12e6dea4836fc9ad97848 100644 (file)
@@ -29,6 +29,7 @@
 #include <grub/reader.h>
 #include <grub/menu_viewer.h>
 #include <grub/auth.h>
+#include <grub/i18n.h>
 
 #define GRUB_DEFAULT_HISTORY_SIZE      50
 
@@ -508,10 +509,10 @@ grub_normal_reader_init (void)
   grub_normal_init_page ();
   grub_setcursor (1);
 
-  grub_printf ("\
+  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",
+   device/file completions.%s ]\n\n"),
               reader_nested ? " ESC at any time exits." : "");
 
   return 0;
index 75a63779fea1234d436ea61ef40b09bac1976c39..7478c33ae162116a108f0a5194958373c6439a76 100644 (file)
@@ -24,6 +24,7 @@
 #include <grub/command.h>
 #include <grub/parser.h>
 #include <grub/auth.h>
+#include <grub/i18n.h>
 
 enum update_mode
   {
@@ -996,7 +997,7 @@ run (struct screen *screen)
     }
 
   grub_cls ();
-  grub_printf ("  Booting a command list\n\n");
+  grub_printf (_("  Booting a command list\n\n"));
 
 
   /* Execute the script, line for line.  */
@@ -1176,6 +1177,6 @@ grub_menu_entry_run (grub_menu_entry_t entry)
   grub_cls ();
   grub_print_error ();
   grub_errno = GRUB_ERR_NONE;
-  grub_printf ("\nPress any key to continue...");
+  grub_printf (_("\nPress any key to continue..."));
   (void) grub_getkey ();
 }
index 4ff22e928709bc3783dd592ba23d9d3f7063336e..524b6a7e900edad10bb6d62e27568cf901a4dde0 100644 (file)
@@ -39,7 +39,7 @@ static grub_uint8_t grub_color_menu_highlight;
 void
 grub_wait_after_message (void)
 {
-  grub_printf ("\nPress any key to continue...");
+  grub_printf (_("\nPress any key to continue..."));
   (void) grub_getkey ();
   grub_putchar ('\n');
 }
@@ -87,22 +87,22 @@ print_message (int nested, int edit)
 
   if (edit)
     {
-      grub_printf ("\n\
+      grub_printf (_("\n\
       Minimum Emacs-like screen editing is supported. TAB lists\n\
       completions. Press Ctrl-x to boot, Ctrl-c for a command-line\n\
-      or ESC to return menu.");
+      or ESC to return menu."));
     }
   else
     {
       grub_printf (_("\n\
       Use the %C and %C keys to select which entry is highlighted.\n"),
                   (grub_uint32_t) GRUB_TERM_DISP_UP, (grub_uint32_t) GRUB_TERM_DISP_DOWN);
-      grub_printf ("\
+      grub_printf (_("\
       Press enter to boot the selected OS, \'e\' to edit the\n\
-      commands before booting or \'c\' for a command-line.");
+      commands before booting or \'c\' for a command-line."));
       if (nested)
-       grub_printf ("\n\
-      ESC to return previous menu.");
+       grub_printf (_("\n\
+      ESC to return previous menu."));
     }
 }
 
@@ -262,12 +262,34 @@ get_entry_number (const char *name)
   return entry;
 }
 
+static char*
+get_spaces (int number_spaces)
+{
+  char* spaces = grub_malloc(number_spaces + 1);
+  int i;
+
+  spaces[0] = '\0';
+  
+  for (i=0;i<number_spaces;i++)
+    {
+      grub_strcat(spaces, " ");
+    }
+  return spaces;
+}
+  
 static void
 print_timeout (int timeout, int offset, int second_stage)
 {
-  /* NOTE: Do not remove the trailing space characters.
-     They are required to clear the line.  */
-  char *msg = "   The highlighted entry will be booted automatically in %ds.    ";
+  const char *msg_localized = _("   The highlighted entry will be booted automatically in %ds.");
+  const int msg_localized_len = grub_strlen (msg_localized);
+  const int number_spaces = GRUB_TERM_WIDTH - msg_localized_len;
+  
+  char *msg = grub_malloc (msg_localized_len + number_spaces + 1);
+  char *spaces = get_spaces (number_spaces);
+
+  grub_sprintf (msg,"%s%s", msg_localized, spaces);
+  grub_free (spaces);
+
   char *msg_end = grub_strchr (msg, '%');
 
   grub_gotoxy (second_stage ? (msg_end - msg) : 0, GRUB_TERM_HEIGHT - 3);
@@ -517,7 +539,7 @@ static void
 notify_booting (grub_menu_entry_t entry,
                void *userdata __attribute__((unused)))
 {
-  grub_printf ("  Booting \'%s\'\n\n", entry->title);
+  grub_printf (_("  Booting \'%s\'\n\n"), entry->title);
 }
 
 /* Callback invoked when a default menu entry executed because of a timeout
@@ -527,7 +549,7 @@ static void
 notify_fallback (grub_menu_entry_t entry,
                 void *userdata __attribute__((unused)))
 {
-  grub_printf ("\n  Falling back to \'%s\'\n\n", entry->title);
+  grub_printf (_("\n  Falling back to \'%s\'\n\n"), entry->title);
   grub_millisleep (DEFAULT_ENTRY_ERROR_DELAY_MS);
 }
 
@@ -541,7 +563,7 @@ notify_execution_failure (void *userdata __attribute__((unused)))
       grub_print_error ();
       grub_errno = GRUB_ERR_NONE;
     }
-  grub_printf ("\n  Failed to boot default entries.\n");
+  grub_printf (_("\n  Failed to boot default entries.\n"));
   grub_wait_after_message ();
 }