grub-devel
[Top][All Lists]
Advanced

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

gettext: lib/arg.c


From: Carles Pina i Estany
Subject: gettext: lib/arg.c
Date: Fri, 25 Dec 2009 13:35:42 +0100
User-agent: Mutt/1.5.20 (2009-06-14)

Hi,

My previous patch touches lib/arg.c, and I would commit that patch but
we should fix something that will happen there.

lib/arg.c does:
          const char *doc = _(opt->doc);
          for (;;)
            {
              while (spacing-- > 0)
                grub_putchar (' ');

              while (*doc && *doc != '\n')
                grub_putchar (*doc++);
              grub_putchar ('\n');

              if (! *doc)
                break;
              doc++;
              spacing = 4 + 20;
            }

so, is cutting the string doc using \n, and the after \n inserting spaces.

If the developer or the programmer does't write \n in the correct place
(so the string is too long) it's not correctly formatted on screen.

I wanted to use grub_print_message_indented (I could insert spaces until
margin_left checking the current x position). But if I call from lib/arg.c
grub_print_message_indented it's needed to link fstest with all terminal
stuff. I tried but dependencies goes quite far.

So, I'm thinking to do something like:
          char *doc = _(opt->doc);

          insert_newlines(doc)

          for (;;)
            {

            }

insert_newlines will insert newlines in the appropiate places. So
developers and translators doesn't need to think about how to format
the message.

Because it's not terminal dependant it will maybe not use all
terminal width in terminals bigger than 80 characters.

How it sounds?

Other approach would be to use grub_print_message_indented, dependencies
will affect mainly fstest (it use lib/arg.c). Or have a dummy
grub_print_message_indented for fstest.

-- 
Carles Pina i Estany
        http://pinux.info




reply via email to

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