Re: problem with plural-forms

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: problem with plural-forms
Дата
Msg-id 11518.1243347590@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: problem with plural-forms  (Alvaro Herrera <alvherre@commandprompt.com>)
Ответы Re: problem with plural-forms  (Alvaro Herrera <alvherre@commandprompt.com>)
Re: problem with plural-forms  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: problem with plural-forms  (Peter Eisentraut <peter_e@gmx.net>)
Список pgsql-hackers
Alvaro Herrera <alvherre@commandprompt.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.

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.
        regards, tom lane


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Greg Stark
Дата:
Сообщение: Re: problem with plural-forms
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: problem with plural-forms