From: Carles Pina i Estany <carles@pina.cat>
To: grub-devel@gnu.org
Subject: gettextize normal/menu_text.c (print_timeout)
Date: Sun, 22 Nov 2009 23:50:13 +0000 [thread overview]
Message-ID: <20091122235013.GA12142@pina.cat> (raw)
[-- Attachment #1: Type: text/plain, Size: 389 bytes --]
Hello,
Attached a proposal of gettextize for normal/menu_text.c
------
2009-11-22 Carles Pina i Estany <carles@pina.cat>
* normal/menu_text.c (get_spaces): New function.
(print_timeout): Gettexttize and uses get_spaces.
------
If accepted I can combine with the previous patch gettextizing some
files in normal/*
Cheers,
--
Carles Pina i Estany
http://pinux.info
[-- Attachment #2: gettext_print_timeout.patch --]
[-- Type: text/x-diff, Size: 1231 bytes --]
=== 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;
+}
+
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);
next reply other threads:[~2009-11-22 23:50 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-22 23:50 Carles Pina i Estany [this message]
2009-11-23 12:04 ` gettextize normal/menu_text.c (print_timeout) Robert Millan
2009-11-25 0:08 ` Carles Pina i Estany
2009-11-25 0:30 ` Carles Pina i Estany
2009-11-25 18:55 ` Robert Millan
2009-11-25 22:09 ` Carles Pina i Estany
2009-11-25 22:21 ` Vladimir 'φ-coder/phcoder' Serbinenko
2009-11-25 22:54 ` Carles Pina i Estany
2009-11-26 1:50 ` Robert Millan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20091122235013.GA12142@pina.cat \
--to=carles@pina.cat \
--cc=grub-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.