From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1NCXef-0005UL-8S for mharc-grub-devel@gnu.org; Mon, 23 Nov 2009 07:04:29 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NCXec-0005Te-7w for grub-devel@gnu.org; Mon, 23 Nov 2009 07:04:26 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NCXeW-0005Rg-Ca for grub-devel@gnu.org; Mon, 23 Nov 2009 07:04:24 -0500 Received: from [199.232.76.173] (port=43020 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NCXeV-0005RY-UE for grub-devel@gnu.org; Mon, 23 Nov 2009 07:04:19 -0500 Received: from xvm-190-8.ghst.net ([217.70.190.8]:33536 helo=aybabtu.com) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NCXeT-0001wd-Ll for grub-devel@gnu.org; Mon, 23 Nov 2009 07:04:17 -0500 Received: from [192.168.10.10] (helo=thorin) by aybabtu.com with esmtp (Exim 4.69) (envelope-from ) id 1NCXeR-00019J-LR for grub-devel@gnu.org; Mon, 23 Nov 2009 13:04:16 +0100 Received: from rmh by thorin with local (Exim 4.69) (envelope-from ) id 1NCXeO-0006bg-PG for grub-devel@gnu.org; Mon, 23 Nov 2009 13:04:12 +0100 Date: Mon, 23 Nov 2009 13:04:12 +0100 From: Robert Millan To: The development of GNU GRUB Message-ID: <20091123120412.GE25009@thorin> References: <20091122235013.GA12142@pina.cat> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20091122235013.GA12142@pina.cat> Organization: free as in freedom X-Message-Flag: Worried about Outlook viruses? Switch to Thunderbird! www.mozilla.com/thunderbird X-Debbugs-No-Ack: true User-Agent: Mutt/1.5.18 (2008-05-17) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) Subject: Re: gettextize normal/menu_text.c (print_timeout) X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Nov 2009 12:04:26 -0000 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 + { > + 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."