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: Fri, 19 Sep 2003 11:35:26 +0200
User-agent: KMail/1.5

Jim Meyering wrote:
> How about this (just checked in to coreutils)?

Quite good, nearly perfect. Only this one

> +     /* Note that the following must have one `%s' and one `%%s'. */
> +#define FMT_TEMPLATE _("Written by %sand %%s.\n")

is not easy to translate for the translator. I can see three approaches
for fixing it:

a) Extend the switch up to "case 9:" and "case 10:", and simply document
   that version_etc works only up to 10 authors.

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.

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.  */

Which one do you prefer? I can code it up.

Bruno





reply via email to

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