[Top][All Lists]

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

Re: hu.po ngettext fixes

From: Bruno Haible
Subject: Re: hu.po ngettext fixes
Date: Thu, 17 Aug 2006 14:20:09 +0200
User-agent: KMail/1.9.1

Egmont Koblinger asked:
> > What is the correct approach if the number isn't presented in the string, as
> > in his "This item" vs. "These items" case? Should ngettext be used in this
> > case? Or this piece of code a good programming approach:
> > if (n == 1) printf(_("This item...")); else printf(_("These items..."));  ?

I tend to agree with Gabor Kelemen, that ngettext should be used in this case.
There are languages for which the grammar (flexion rules) know about
singular, dual (n = 2), and plural (n >= 3). I believe the use of the plural
is not suitable for n = 2, even if the number is not explicit.

Paul Eggert wrote:
> I just now reviewed the gettext manual and led me to some other
> translation glitches in coreutils.

> +/* Return a value that pluralizes the same way that N does, in all
> +   languages we know of.  */
> +static inline unsigned long int
> +select_plural (uintmax_t n)
> +{
> +  return (n <= ULONG_MAX ? n : n % 1000 + 1000);
> +}

Right, this is needed when the argument does not fit in an 'unsigned long'.
GNU clisp, where the argument can be an integer of arbitrary size, uses
same formula, with 1000 replaced with 1000000 (a tiny bit safer).

>       Also, don't use ngettext to
>       print a floating point number, as reducing to 0 or 1 doesn't work
>       for some languages.  Instead, just use "s" for seconds since it
>       doesn't need a plural form.

I agree here as well. Floating-point values can be output in a sentence
independent of the value, without surprising the users too much.
"1.0 seconds" sounds equally acceptable in English, French, German.

When the decimal digits after the decimal point can be omitted, it may
be less acceptable: "1.01 seconds" sounds fine, but "1 seconds" does not.

Both these two issues don't occur here for the first time; therefore thanks
for the initiative to document them.


reply via email to

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