Skip to contentSkip to conversation

new function: grub_printfnl

PATCH Carles Pina i Estany 3 participants 5 messages Nov 28, 2009 – Dec 3, 2009

lore
Share & tools
lore
#0 lore raw

Hello,

Gettextizzing files I have a very common situation:
grub_printf ("Bla bla bla\n");

That I have to change to:
grub_printf (_("Bla bla bla"));
grub_putchar ('\n');

Any problem to apply the attached patch with the export where needed (I haven't compiled, just written the idea). So I could change:
grub_printf ("Bla bla bla\n");

by:
grub_printfnl (_("Bla bla bla"));

(nl for new line)

Other question: doing this "trivial" change and adding some more _("") in file means that I have to change the copyright date?

Thanks,

Signature · 2 lines
Carles Pina i Estany
	http://pinux.info

=== modified file 'kern/misc.c'

misc.c +15 -0
@@ -126,6 +126,21 @@ grub_printf (const char *fmt, ...)
   return ret;
 }
 
+int grub_printfnl (const char *fmt, ...)
+{
+  va_list ap;
+  int ret;
+
+  va_start (ap, fmt);
+  ret = grub_vprintf (fmt, ap);
+  va_end (ap);
+
+  grub_putchar ('\n');
+  ret++;
+
+  return ret;
+}
+
 #if defined (APPLE_CC) && ! defined (GRUB_UTIL)
 int
 grub_err_printf (const char *fmt, ...)
#1 lore raw
Quoted 9 lines · Carles Pina i Estany

Hello,

Gettextizzing files I have a very common situation:
grub_printf ("Bla bla bla\n");

That I have to change to:
grub_printf (_("Bla bla bla"));
grub_putchar ('\n');

Uhm I wonder what's the common approach to this. Maybe Jordi or someone else can tell?

Quoted 2 lines

Other question: doing this "trivial" change and adding some more _("") in file means that I have to change the copyright date?

There's no clear theshold. But in this particular case I wouldn't.

Signature · 5 lines
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."
#2 lore raw

Hello,

Quoted 7 lines · Robert Millan
Quoted 6 lines · Carles Pina i Estany

Hello,

Gettextizzing files I have a very common situation:
grub_printf ("Bla bla bla\n");

Quoted 6 lines
Quoted 3 lines

That I have to change to:
grub_printf (_("Bla bla bla"));
grub_putchar ('\n');

Uhm I wonder what's the common approach to this. Maybe Jordi or someone else can tell?

I think that in util/mkisofs there is the same problem for lot of strings (just checking grub.pot)

Have you thought some solution as well?

Signature · 2 lines
Carles Pina i Estany
	http://pinux.info
#3 lore raw
In reply to Robert Millan
Quoted 4 lines · Robert Millan
Quoted 2 lines

Gettextizzing files I have a very common situation:
grub_printf ("Bla bla bla\n");

Uhm I wonder what's the common approach to this. Maybe Jordi or someone else can tell?

I think this is going too far. I don't think there's a need to remove all trailing nl's if the string is not going to be repeated in other slightly different ways, because adapting this means making the code a bit less readable for what I'm seeing.

In some cases, it looks like a good idea where it's worth the extra effort; the gettext manual recommends plain strings and so on, but if it's just a trailing new line, I think in most cases it's not worth it. Translators know how to deal with them.

Jordi

Signature · 3 lines
Jordi Mallach Pérez  --  Debian developer     http://www.debian.org/
[email protected]     [email protected]     http://www.sindominio.net/
GnuPG public key information available at http://oskuro.net/
#4 lore raw

Hello,

Quoted 10 lines · Jordi Mallach
Quoted 4 lines · Robert Millan
Quoted 2 lines

Gettextizzing files I have a very common situation:
grub_printf ("Bla bla bla\n");

Uhm I wonder what's the common approach to this. Maybe Jordi or someone else can tell?

I think this is going too far. I don't think there's a need to remove all trailing nl's if the string is not going to be repeated in other slightly different ways, because adapting this means making the code a bit less readable for what I'm seeing.

grub_printf ("Bla bla bla\n");

VS

grub_printfnl ("Bla bla bla");

I would say is quite similar to read. But the pros of changing is not maybe enough to change (and talking with translators they don't see problems to have \n...)

I would like to do it on this weekend (after commiting other patches if possible). So, what I should do?

I really don't mind, but I prefer to agree with everybody to not do it two times.

I'm always talking and thinking about the endline new line. The
beginning of lines that was looking like "\n\n " or similar will be
out of the translation string.

Signature · 2 lines
Carles Pina i Estany
	http://pinux.info