Final touches before merging

This commit is contained in:
Carles Pina i Estany 2009-11-23 20:59:24 +00:00
parent 2b352daff9
commit c3ea6bd466
2 changed files with 33 additions and 35 deletions

View file

@ -1,3 +1,23 @@
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.
* normal/menu_text.c: Include <grub/i18n.h>.
* normal/menu_text.c (print_timeout): Gettexttize string.
* normal/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.
* NEWS: Add gettext support.
2009-11-23 Robert Millan <rmh.grub@aybabtu.com> 2009-11-23 Robert Millan <rmh.grub@aybabtu.com>
* util/hostdisk.c: Include `<grub/i18n.h>'. * util/hostdisk.c: Include `<grub/i18n.h>'.

View file

@ -39,7 +39,7 @@ static grub_uint8_t grub_color_menu_highlight;
void void
grub_wait_after_message (void) grub_wait_after_message (void)
{ {
grub_printf (_("\nPress any key to continue...")); grub_printf ("\nPress any key to continue...");
(void) grub_getkey (); (void) grub_getkey ();
grub_putchar ('\n'); grub_putchar ('\n');
} }
@ -87,22 +87,22 @@ print_message (int nested, int edit)
if (edit) if (edit)
{ {
grub_printf (_("\n\ grub_printf ("\n\
Minimum Emacs-like screen editing is supported. TAB lists\n\ Minimum Emacs-like screen editing is supported. TAB lists\n\
completions. Press Ctrl-x to boot, Ctrl-c for a command-line\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 else
{ {
grub_printf (_("\n\ grub_printf (_("\n\
Use the %C and %C keys to select which entry is highlighted.\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_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\ 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) if (nested)
grub_printf (_("\n\ grub_printf ("\n\
ESC to return previous menu.")); ESC to return previous menu.");
} }
} }
@ -262,34 +262,12 @@ get_entry_number (const char *name)
return entry; 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 static void
print_timeout (int timeout, int offset, int second_stage) print_timeout (int timeout, int offset, int second_stage)
{ {
const char *msg_localized = _(" The highlighted entry will be booted automatically in %ds."); /* NOTE: Do not remove the trailing space characters.
const int msg_localized_len = grub_strlen (msg_localized); They are required to clear the line. */
const int number_spaces = GRUB_TERM_WIDTH - msg_localized_len; char *msg = " The highlighted entry will be booted automatically in %ds. ";
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, '%'); char *msg_end = grub_strchr (msg, '%');
grub_gotoxy (second_stage ? (msg_end - msg) : 0, GRUB_TERM_HEIGHT - 3); grub_gotoxy (second_stage ? (msg_end - msg) : 0, GRUB_TERM_HEIGHT - 3);
@ -539,7 +517,7 @@ static void
notify_booting (grub_menu_entry_t entry, notify_booting (grub_menu_entry_t entry,
void *userdata __attribute__((unused))) 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 /* Callback invoked when a default menu entry executed because of a timeout
@ -549,7 +527,7 @@ static void
notify_fallback (grub_menu_entry_t entry, notify_fallback (grub_menu_entry_t entry,
void *userdata __attribute__((unused))) 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); grub_millisleep (DEFAULT_ENTRY_ERROR_DELAY_MS);
} }
@ -563,7 +541,7 @@ notify_execution_failure (void *userdata __attribute__((unused)))
grub_print_error (); grub_print_error ();
grub_errno = GRUB_ERR_NONE; 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 (); grub_wait_after_message ();
} }