From: | Alvaro Herrera <alvherre(at)commandprompt(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-hackers(at)postgresql(dot)org, Zdenek Kotala <Zdenek(dot)Kotala(at)sun(dot)com> |
Subject: | Re: problem with plural-forms |
Date: | 2009-05-26 14:26:50 |
Message-ID: | 20090526142650.GC32650@alvh.no-ip.org |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Tom Lane wrote:
> Alvaro Herrera <alvherre(at)commandprompt(dot)com> writes:
> > I think it should use the %2$s style specifier in that case. This
> > should work:
>
> > printf (ngettext ("One file removed, containing %2$lu bytes",
> > "%d files removed, containing %lu bytes", n),
> > n, total_bytes);
>
> How's that gonna work? In the n=1 case, printf would have no idea about
> the type/size of the argument it would need to skip over.
Hmm, I admit I have no idea how it works ... but now that I think about
it, you are right that at least I only use it with the whole argument
array, just in a different order.
> I think maybe you could make it work like this:
>
> printf (ngettext ("One file removed, containing %1$lu bytes",
> "%2$d files removed, containing %1$lu bytes", n),
> total_bytes, n);
>
> but *for sure* I don't want us playing such games without a robust
> compile-time check on both variants of the ngettext string. I'm
> not real sure it's a good idea at all, because of the potential for
> confusing translators. Notice also that we have subtly embedded the
> preferred English phrase ordering here: if someone wants to pull the
> same type of trick in a language where the bytecount ought to come
> first, he's just plain out of luck.
Agreed on both counts. We have enough trouble finding translators as it
is; I don't want to know what would happen if we were to confuse them
with this :-)
I find it strange that this topic has not been fully hashed out in the
GNU gettext documentation. Maybe we should talk to them.
--
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2009-05-26 14:29:10 | Re: problem with plural-forms |
Previous Message | Tom Lane | 2009-05-26 14:19:50 | Re: problem with plural-forms |