grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: gettextize normal/menu_text.c (print_timeout)


From: Robert Millan
Subject: Re: gettextize normal/menu_text.c (print_timeout)
Date: Mon, 23 Nov 2009 13:04:12 +0100
User-agent: Mutt/1.5.18 (2008-05-17)

On Sun, Nov 22, 2009 at 11:50:13PM +0000, Carles Pina i Estany wrote:
> === modified file 'normal/menu_text.c'
> --- normal/menu_text.c        2009-11-22 22:24:54 +0000
> +++ normal/menu_text.c        2009-11-22 23:40:20 +0000
> @@ -262,12 +262,34 @@
>    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;
> +}
> [...]
> +  grub_sprintf (msg,"%s%s", msg_localized, spaces);

This could be made much simpler.  For example:

void
print_spaces (int number_spaces)
{
  int i;
  for (i = 0; i < number_spaces; i++)
    grub_putchar (' ');
}

> +  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;

Seems like the right approach.  I wonder if we should do something
about the preceding spaces too...

-- 
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."




reply via email to

[Prev in Thread] Current Thread [Next in Thread]