findutils-patches
[Top][All Lists]
Advanced

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

Re: [Findutils-patches] [PATCH] Initial attempts to internationalise plu


From: Eric Blake
Subject: Re: [Findutils-patches] [PATCH] Initial attempts to internationalise plural forms better
Date: Thu, 20 Dec 2007 06:59:35 -0700
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.9) Gecko/20071031 Thunderbird/2.0.0.9 Mnenhy/0.7.5.666

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to James Youngman on 12/20/2007 3:35 AM:
>> I'm not sure it works that way.  Generally, the TRANSLATORS comment has to
>> come on the line before the _() usage.
> 
> Thanks.

You can double-check the .pot file to make sure.

> 
>>> +                  _("warning: you have specified the %1$s "
>> Inconsistent in your use of WARNING: vs. warning:.
> 
> And the odd Warning: too, for good measure.   I propose to standardise
> on one option.  Any preference?

I'm wondering if GNU Coding Standards have anything to say on it?  It
seems like many projects use 'Warning:'.

> 
> 
>> Oops.  database_file_size is size_t, which may be bigger than long.  You
>> need to use the documented trick from the gettext manual:
>> ngettetxt("string_a", "string_b",
>>           (database_file_size > ULONG_MAX
>>            ? (database_file_size % 1000000) + 1000000
>>            : database_file_size));
> 
> I'm not sure I understand why.   Surely, the constant 1 in the macro
> would just get promoted appropriately?
> 
> #define ngettext(singular,plural,n) ((1==n) ? singular : plural)
> 
> After all, this isn't a function call.

ngettext IS a function call when NLS is enabled; you only showed the macro
that gets used when NLS is off.  And the function ngettext is limited by
an unsigned long count parameter, so if size_t exceeds long, you HAVE to
pull it back into range (using the fact that pluralization forms in all
known languages are repetitive after 1 million and after the special cases
of the first million).

>>> +               "character values must not exceed %2$lx."),
>>>               s, (unsigned long)UCHAR_MAX);
>> Not changed by your patch, but (unsigned long)UCHAR_MAX is redundant;
>> gnulib guarantees that UCHAR_MAX has the correct type.  I'd kill the cast.
> 
> Leaving the type as unsigned char, or so I assume.   That gets
> promoted to unsigned in order to be passed into a variadic function
> call.    So I'd need to change the format from %lx to %x too, yes?

Hmm, I misread that originally, and thought it was ULONG_MAX that you were
casting.  On many systems, UCHAR_MAX is of type int (unsigned char
promotes to int, not unsigned int, when int is larger).  %lx is indeed
overkill, you are guaranteed that printf("%x", (unsigned int)UCHAR_MAX))
will work everywhere, and for all practical purposes (unless you know of
any machines where unsigned int is a different width than int),
printf("%x",UCHAR_MAX) will do the right thing as well.

- --
Don't work too hard, make some time for fun as well!

Eric Blake             address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHanVH84KuGfSFAYARAkKGAKCQTQAT8u1SzivW5BudUvJRRjTCSgCfc9Rw
jjKyzexxjDfHtkDKa3g0Zt8=
=xHKM
-----END PGP SIGNATURE-----




reply via email to

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