bug-gnulib
[Top][All Lists]
Advanced

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

Re: [Bug-gnulib] 4-gary-version-etc-full-author-string.patch


From: Bruno Haible
Subject: Re: [Bug-gnulib] 4-gary-version-etc-full-author-string.patch
Date: Mon, 22 Sep 2003 12:48:28 +0200
User-agent: KMail/1.5

Gary V. Vaughan wrote:
> Only works *well* with up to 10 authors, and after that we fall back to:
>
>      Written by: Bruno Haible, Jim Meyering, Paul Eggert, ..., Gary V.
> Vaughan.

That's it, exactly: If there are more than 10 authors, just use "..."
as the 10th one. Similar to what's done in citations of scientific papers.

> > b) In Common Lisp, which has format strings with loops, the format string
> >    would look like "Written by ~{~^~a, ~} and ~a.". So you could devise
> >    an extended_sprintf function that accepts C format with loops.
>
> This would be cool as a gnulib module anyway, whether we use it for
> version_etc or not.  I should add that to snprintfv at some point :->

The problem with this is that version-etc is linked statically in every
single coreutils executable, therefore the code size must be small.

> > c) Let the translator translate
> >          "Written by %s, %s, and %s.\n"
> >    and   "Written by %s, %s, %s, and %s.\n"
> >    and at runtime interpolate between the two translations. Like this:
> >
> >         str3 = _("Written by %s, %s, and %s.\n");
> >         str4 = _("Written by %s, %s, %s, and %s.\n");
> >         common_prefix = compute_common_prefix (str3, str4);
> >         str3_suffix = str3 + strlen(common_prefix);
> >         str4_suffix = str4 + strlen(common_suffix);
> >         if (endswith (str4_suffix, str3_suffix))
> >           {
> >             one_element_format =
> >               xstrndup (str4_suffix, strlen(str4_suffix) -
> > strlen(str3_suffix)); final_format_string =
> >               concatenate (common_prefix,
> >                            (N - 3) times one_element_format,
> >                            str3_suffix);
> >             ...
> >           }
> >         else
> >           /* Use a fallback, possibly just the English thing.  */
>
> Ick.  Not this one!

Why?

> Just to be a PITA, it would be nice to break the list up on word boundaries
> with isspace(), or even on a (translatable) user specified delimiter to
> keep within 80 columns in the output.  We're gonna run out of room around 4
> or 5 names otherwise...

The translator can insert newlines in his translations where he wants to.

Line breaking at isspace() is not internationalizable (think of Chinese),
therefore we have a line breaking algorithm in lib/linebreak.c. But again
its code size is prohibitive for use by version-etc. The best we can do
is to use

   _("Written by %s, %s,\n%s, and %s.\n")

but then the interpolation approach isn't possible any more, and we're
left with approach (a) [limit up to 10].

Bruno





reply via email to

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