2009-12-25 Carles Pina i Estany <carles@pina.cat>

* commands/help.c: Include `<grub/i18n.h>'.
	(grub_cmd_help): Gettextizze.
	(GRUB_MOD_INIT): Likewise.
	* commands/i386/pc/play.c: Include `<grub/i18n.h>'.
	(GRUB_MOD_INIT): Gettextizze.
	* commands/search.c: Include `<grub/i18n.h>'.
	(options): Gettextizze.
	(GRUB_MOD_INIT): Gettextizze.
	* lib/arg.c: Include `<grub/i18n.h>'.
	(help_options): Gettextizze.
	(find_long): Likewise.
	(grub_arg_show_help): Likewise.
	* normal/dyncmd.c: Include `<grub/i18n.h>'.
	(read_command_list): Gettextizze.
	* po/POTFILES: Add `commands/i386/pc/play.c', `commands/search.c',
	`commands/help.c', `lib/arg.c' and `normal/dyncmd.c'.
This commit is contained in:
carles 2009-12-25 21:51:05 +01:00
parent 2281552630
commit ec5f98abda
7 changed files with 53 additions and 21 deletions

View file

@ -1,3 +1,22 @@
2009-12-25 Carles Pina i Estany <carles@pina.cat>
* commands/help.c: Include `<grub/i18n.h>'.
(grub_cmd_help): Gettextizze.
(GRUB_MOD_INIT): Likewise.
* commands/i386/pc/play.c: Include `<grub/i18n.h>'.
(GRUB_MOD_INIT): Gettextizze.
* commands/search.c: Include `<grub/i18n.h>'.
(options): Gettextizze.
(GRUB_MOD_INIT): Gettextizze.
* lib/arg.c: Include `<grub/i18n.h>'.
(help_options): Gettextizze.
(find_long): Likewise.
(grub_arg_show_help): Likewise.
* normal/dyncmd.c: Include `<grub/i18n.h>'.
(read_command_list): Gettextizze.
* po/POTFILES: Add `commands/i386/pc/play.c', `commands/search.c',
`commands/help.c', `lib/arg.c' and `normal/dyncmd.c'.
2009-12-25 Robert Millan <rmh.grub@aybabtu.com> 2009-12-25 Robert Millan <rmh.grub@aybabtu.com>
* include/grub/i386/at_keyboard.h (NUM_LOCK, SCROLL_LOCK): New macros. * include/grub/i386/at_keyboard.h (NUM_LOCK, SCROLL_LOCK): New macros.

View file

@ -21,6 +21,7 @@
#include <grub/misc.h> #include <grub/misc.h>
#include <grub/term.h> #include <grub/term.h>
#include <grub/extcmd.h> #include <grub/extcmd.h>
#include <grub/i18n.h>
static grub_err_t static grub_err_t
grub_cmd_help (grub_extcmd_t ext __attribute__ ((unused)), int argc, grub_cmd_help (grub_extcmd_t ext __attribute__ ((unused)), int argc,
@ -38,13 +39,14 @@ grub_cmd_help (grub_extcmd_t ext __attribute__ ((unused)), int argc,
(cmd->flags & GRUB_COMMAND_FLAG_CMDLINE)) (cmd->flags & GRUB_COMMAND_FLAG_CMDLINE))
{ {
char description[GRUB_TERM_WIDTH / 2]; char description[GRUB_TERM_WIDTH / 2];
int desclen = grub_strlen (cmd->summary); const char* summary_translated = _(cmd->summary);
int desclen = grub_strlen (summary_translated);
/* Make a string with a length of GRUB_TERM_WIDTH / 2 - 1 filled /* Make a string with a length of GRUB_TERM_WIDTH / 2 - 1 filled
with the description followed by spaces. */ with the description followed by spaces. */
grub_memset (description, ' ', GRUB_TERM_WIDTH / 2 - 1); grub_memset (description, ' ', GRUB_TERM_WIDTH / 2 - 1);
description[GRUB_TERM_WIDTH / 2 - 1] = '\0'; description[GRUB_TERM_WIDTH / 2 - 1] = '\0';
grub_memcpy (description, cmd->summary, grub_memcpy (description, summary_translated,
(desclen < GRUB_TERM_WIDTH / 2 - 1 (desclen < GRUB_TERM_WIDTH / 2 - 1
? desclen : GRUB_TERM_WIDTH / 2 - 1)); ? desclen : GRUB_TERM_WIDTH / 2 - 1));
@ -65,8 +67,8 @@ grub_cmd_help (grub_extcmd_t ext __attribute__ ((unused)), int argc,
if (cmd->flags & GRUB_COMMAND_FLAG_EXTCMD) if (cmd->flags & GRUB_COMMAND_FLAG_EXTCMD)
grub_arg_show_help ((grub_extcmd_t) cmd->data); grub_arg_show_help ((grub_extcmd_t) cmd->data);
else else
grub_printf ("Usage: %s\n%s\b", cmd->summary, grub_printf ("%s %s\n%s\b", _("Usage:"), _(cmd->summary),
cmd->description); _(cmd->description));
} }
} }
return 0; return 0;
@ -94,8 +96,8 @@ GRUB_MOD_INIT(help)
{ {
cmd = grub_register_extcmd ("help", grub_cmd_help, cmd = grub_register_extcmd ("help", grub_cmd_help,
GRUB_COMMAND_FLAG_CMDLINE, GRUB_COMMAND_FLAG_CMDLINE,
"help [PATTERN ...]", N_("help [PATTERN ...]"),
"Show a help message.", 0); N_("Show a help message."), 0);
} }
GRUB_MOD_FINI(help) GRUB_MOD_FINI(help)

View file

@ -27,6 +27,7 @@
#include <grub/machine/time.h> #include <grub/machine/time.h>
#include <grub/cpu/io.h> #include <grub/cpu/io.h>
#include <grub/command.h> #include <grub/command.h>
#include <grub/i18n.h>
#define BASE_TEMPO 120 #define BASE_TEMPO 120
@ -207,7 +208,7 @@ static grub_command_t cmd;
GRUB_MOD_INIT(play) GRUB_MOD_INIT(play)
{ {
cmd = grub_register_command ("play", grub_cmd_play, cmd = grub_register_command ("play", grub_cmd_play,
"play FILE", "Play a tune."); N_("play FILE"), N_("Play a tune."));
} }
GRUB_MOD_FINI(play) GRUB_MOD_FINI(play)

View file

@ -26,14 +26,15 @@
#include <grub/file.h> #include <grub/file.h>
#include <grub/env.h> #include <grub/env.h>
#include <grub/extcmd.h> #include <grub/extcmd.h>
#include <grub/i18n.h>
static const struct grub_arg_option options[] = static const struct grub_arg_option options[] =
{ {
{"file", 'f', 0, "Search devices by a file.", 0, 0}, {"file", 'f', 0, N_("Search devices by a file."), 0, 0},
{"label", 'l', 0, "Search devices by a filesystem label.", 0, 0}, {"label", 'l', 0, N_("Search devices by a filesystem label."), 0, 0},
{"fs-uuid", 'u', 0, "Search devices by a filesystem UUID.", 0, 0}, {"fs-uuid", 'u', 0, N_("Search devices by a filesystem UUID."), 0, 0},
{"set", 's', GRUB_ARG_OPTION_OPTIONAL, "Set a variable to the first device found.", "VAR", ARG_TYPE_STRING}, {"set", 's', GRUB_ARG_OPTION_OPTIONAL, N_("Set a variable to the first device found."), "VAR", ARG_TYPE_STRING},
{"no-floppy", 'n', 0, "Do not probe any floppy drive.", 0, 0}, {"no-floppy", 'n', 0, N_("Do not probe any floppy drive."), 0, 0},
{0, 0, 0, 0, 0, 0} {0, 0, 0, 0, 0, 0}
}; };
@ -186,11 +187,11 @@ GRUB_MOD_INIT(search)
cmd = cmd =
grub_register_extcmd ("search", grub_cmd_search, grub_register_extcmd ("search", grub_cmd_search,
GRUB_COMMAND_FLAG_BOTH, GRUB_COMMAND_FLAG_BOTH,
"search [-f|-l|-u|-s|-n] NAME", N_("search [-f|-l|-u|-s|-n] NAME"),
"Search devices by file, filesystem label or filesystem UUID." N_("Search devices by file, filesystem label or filesystem UUID."
" If --set is specified, the first device found is" " If --set is specified, the first device found is"
" set to a variable. If no variable name is" " set to a variable. If no variable name is"
" specified, \"root\" is used.", " specified, \"root\" is used."),
options); options);
} }

View file

@ -22,6 +22,7 @@
#include <grub/err.h> #include <grub/err.h>
#include <grub/term.h> #include <grub/term.h>
#include <grub/extcmd.h> #include <grub/extcmd.h>
#include <grub/i18n.h>
/* Built-in parser for default options. */ /* Built-in parser for default options. */
#define SHORT_ARG_HELP -100 #define SHORT_ARG_HELP -100
@ -30,9 +31,9 @@
static const struct grub_arg_option help_options[] = static const struct grub_arg_option help_options[] =
{ {
{"help", SHORT_ARG_HELP, 0, {"help", SHORT_ARG_HELP, 0,
"Display this help and exit.", 0, ARG_TYPE_NONE}, N_("Display this help and exit."), 0, ARG_TYPE_NONE},
{"usage", SHORT_ARG_USAGE, 0, {"usage", SHORT_ARG_USAGE, 0,
"Display the usage of this command and exit.", 0, ARG_TYPE_NONE}, N_("Display the usage of this command and exit."), 0, ARG_TYPE_NONE},
{0, 0, 0, 0, 0, 0} {0, 0, 0, 0, 0, 0}
}; };
@ -106,7 +107,7 @@ find_long (const struct grub_arg_option *options, const char *s, int len)
static void static void
show_usage (grub_extcmd_t cmd) show_usage (grub_extcmd_t cmd)
{ {
grub_printf ("Usage: %s\n", cmd->cmd->summary); grub_printf ("%s %s\n", _("Usage:"), _(cmd->cmd->summary));
} }
void void
@ -143,7 +144,7 @@ grub_arg_show_help (grub_extcmd_t cmd)
} }
} }
const char *doc = opt->doc; const char *doc = _(opt->doc);
for (;;) for (;;)
{ {
while (spacing-- > 0) while (spacing-- > 0)
@ -176,7 +177,7 @@ grub_arg_show_help (grub_extcmd_t cmd)
} }
show_usage (cmd); show_usage (cmd);
grub_printf ("%s\n\n", cmd->cmd->description); grub_printf ("%s\n\n", _(cmd->cmd->description));
if (cmd->options) if (cmd->options)
showargs (cmd->options); showargs (cmd->options);
showargs (help_options); showargs (help_options);

View file

@ -23,6 +23,7 @@
#include <grub/misc.h> #include <grub/misc.h>
#include <grub/command.h> #include <grub/command.h>
#include <grub/normal.h> #include <grub/normal.h>
#include <grub/i18n.h>
static grub_err_t static grub_err_t
grub_dyncmd_dispatcher (struct grub_command *cmd, grub_dyncmd_dispatcher (struct grub_command *cmd,
@ -132,7 +133,7 @@ read_command_list (void)
cmd = grub_register_command_prio (name, cmd = grub_register_command_prio (name,
grub_dyncmd_dispatcher, grub_dyncmd_dispatcher,
0, "not loaded", prio); 0, N_("not loaded"), prio);
if (! cmd) if (! cmd)
{ {
grub_free (name); grub_free (name);

View file

@ -1,5 +1,12 @@
# List of files which contain translatable strings. # List of files which contain translatable strings.
commands/i386/pc/play.c
commands/loadenv.c commands/loadenv.c
commands/search.c
commands/help.c
lib/arg.c
normal/dyncmd.c
util/i386/pc/grub-mkimage.c util/i386/pc/grub-mkimage.c
util/i386/pc/grub-setup.c util/i386/pc/grub-setup.c