From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1NHkrE-0000OL-CY for mharc-grub-devel@gnu.org; Mon, 07 Dec 2009 16:11:00 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NHkrC-0000Kk-4B for grub-devel@gnu.org; Mon, 07 Dec 2009 16:10:58 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NHkr7-0000EY-Ek for grub-devel@gnu.org; Mon, 07 Dec 2009 16:10:57 -0500 Received: from [199.232.76.173] (port=52953 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NHkr6-0000EF-To for grub-devel@gnu.org; Mon, 07 Dec 2009 16:10:52 -0500 Received: from 197.red-80-32-81.staticip.rima-tde.net ([80.32.81.197]:45358 helo=mail.pina.cat) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NHkr6-0005R9-7o for grub-devel@gnu.org; Mon, 07 Dec 2009 16:10:52 -0500 Received: from pinux (82-45-164-87.cable.ubr06.hari.blueyonder.co.uk [82.45.164.87]) by mail.pina.cat (Postfix) with ESMTP id 15CBD28415526 for ; Mon, 7 Dec 2009 22:10:51 +0100 (CET) Received: by pinux (Postfix, from userid 1000) id DD24626EF; Mon, 7 Dec 2009 21:11:00 +0000 (GMT) Date: Mon, 7 Dec 2009 21:11:00 +0000 From: Carles Pina i Estany To: grub-devel@gnu.org Message-ID: <20091207211100.GA30400@pina.cat> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="x+6KMIRAuhnl3hBn" Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) Subject: gettext: grub_printf_ and N_ 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, 07 Dec 2009 21:10:58 -0000 --x+6KMIRAuhnl3hBn Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi, Attached a patch that makes a new function (grub_printf_) which one calls _( ) for the format argument. Also adapts the current translations but not the pending patch. Can someone take a look? If the grub_printf_ approach is used then this should be committed. Conflicts with Colin Watson idea because in the other idea gettext has to be called in grub_printf level and not inside, as far as I can think now :-) -- Carles Pina i Estany http://pinux.info --x+6KMIRAuhnl3hBn Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="grub_printf_.patch" === modified file 'ChangeLog' --- ChangeLog 2009-12-07 16:46:24 +0000 +++ ChangeLog 2009-12-07 21:08:05 +0000 @@ -1,3 +1,17 @@ +2009-12-07 Carles Pina i Estany + + * include/grub/misc.h (grub_printf_): New declaration. + * kern/misc.c (grub_printf_): New definition. + * normal/main.c (grub_normal_reader_init): Use `grub_printf_' and `N_' + instead of `grub_printf' and `_'. + * normal/menu_entry.c (store_completion): Likewise. + (run): Likewise. + (grub_menu_entry_run): Likewise. + * normal/menu_text.c (grub_wait_after_message): Likewise. + (notify_booting): Likewise. + (notify_fallback): Likewise. + (notify_execution_failure): Likewise. + 2009-12-07 Colin Watson * configure.ac: Check for vasprintf. === modified file 'include/grub/misc.h' --- include/grub/misc.h 2009-12-03 23:07:29 +0000 +++ include/grub/misc.h 2009-12-07 21:00:46 +0000 @@ -171,6 +171,7 @@ char *EXPORT_FUNC(grub_strndup) (const c void *EXPORT_FUNC(grub_memset) (void *s, int c, grub_size_t n); grub_size_t EXPORT_FUNC(grub_strlen) (const char *s); int EXPORT_FUNC(grub_printf) (const char *fmt, ...) __attribute__ ((format (printf, 1, 2))); +int EXPORT_FUNC(grub_printf_) (const char *fmt, ...) __attribute__ ((format (printf, 1, 2))); void EXPORT_FUNC(grub_real_dprintf) (const char *file, const int line, const char *condition, === modified file 'kern/misc.c' --- kern/misc.c 2009-11-24 21:42:14 +0000 +++ kern/misc.c 2009-12-07 20:59:09 +0000 @@ -126,6 +126,19 @@ grub_printf (const char *fmt, ...) return ret; } +int +grub_printf_ (const char *fmt, ...) +{ + va_list ap; + int ret; + + va_start (ap, fmt); + ret = grub_printf (_(fmt), ap); + va_end (ap); + + return ret; +} + #if defined (APPLE_CC) && ! defined (GRUB_UTIL) int grub_err_printf (const char *fmt, ...) === modified file 'normal/main.c' --- normal/main.c 2009-11-25 03:48:33 +0000 +++ normal/main.c 2009-12-07 21:02:14 +0000 @@ -509,7 +509,7 @@ grub_normal_reader_init (void) grub_normal_init_page (); grub_setcursor (1); - grub_printf (_("\ + grub_printf_ (N_("\ [ Minimal BASH-like line editing is supported. For the first word, TAB\n\ lists possible command completions. Anywhere else TAB lists possible\n\ device/file completions.%s ]\n\n"), === modified file 'normal/menu_entry.c' --- normal/menu_entry.c 2009-12-05 11:25:07 +0000 +++ normal/menu_entry.c 2009-12-07 21:02:48 +0000 @@ -837,7 +837,7 @@ store_completion (const char *item, grub grub_gotoxy (0, GRUB_TERM_HEIGHT - 3); grub_printf (" "); - grub_printf (_("Possible %s are:"), what); + grub_printf_ (N_("Possible %s are:"), what); grub_printf ("\n "); } @@ -1000,7 +1000,7 @@ run (struct screen *screen) grub_cls (); grub_printf (" "); - grub_printf (_("Booting a command list")); + grub_printf_ (N_("Booting a command list")); grub_printf ("\n\n"); @@ -1182,6 +1182,6 @@ grub_menu_entry_run (grub_menu_entry_t e grub_print_error (); grub_errno = GRUB_ERR_NONE; grub_putchar ('\n'); - grub_printf (_("Press any key to continue...")); + grub_printf_ (N_("Press any key to continue...")); (void) grub_getkey (); } === modified file 'normal/menu_text.c' --- normal/menu_text.c 2009-12-05 11:25:07 +0000 +++ normal/menu_text.c 2009-12-07 21:01:41 +0000 @@ -40,7 +40,7 @@ void grub_wait_after_message (void) { grub_putchar ('\n'); - grub_printf (_("Press any key to continue...")); + grub_printf_ (N_("Press any key to continue...")); (void) grub_getkey (); grub_putchar ('\n'); } @@ -206,7 +206,7 @@ entry is highlighted."); if (nested) { grub_printf ("\n "); - grub_printf (_("ESC to return previous menu.")); + grub_printf_ (N_("ESC to return previous menu.")); } } } @@ -627,7 +627,7 @@ notify_booting (grub_menu_entry_t entry, void *userdata __attribute__((unused))) { grub_printf (" "); - grub_printf (_("Booting \'%s\'"), entry->title); + grub_printf_ (N_("Booting \'%s\'"), entry->title); grub_printf ("\n\n"); } @@ -639,7 +639,7 @@ notify_fallback (grub_menu_entry_t entry void *userdata __attribute__((unused))) { grub_printf ("\n "); - grub_printf (_("Falling back to \'%s\'"), entry->title); + grub_printf_ (N_("Falling back to \'%s\'"), entry->title); grub_printf ("\n\n"); grub_millisleep (DEFAULT_ENTRY_ERROR_DELAY_MS); } @@ -655,7 +655,7 @@ notify_execution_failure (void *userdata grub_errno = GRUB_ERR_NONE; } grub_printf ("\n "); - grub_printf (_("Failed to boot default entries.\n")); + grub_printf_ (N_("Failed to boot default entries.\n")); grub_wait_after_message (); } --x+6KMIRAuhnl3hBn--