Article View: pl.comp.lang.ruby
Article #1150Re: rozszerzony pluralize
From: Przemysław Kowalczyk
Date: Mon, 27 Oct 2008 19:31
Date: Mon, 27 Oct 2008 19:31
24 lines
1370 bytes
1370 bytes
On Mon, 27 Oct 2008 00:10:58 +0100, FOX <user@company.xx> wrote:
>
> jest gdzieś jakiś rozszerzony pluralizer
> dla przypadku:
>
> 1 produkt
> 2 produkty
> 8 produktów
>
>
> lub inny elegancki sposób na powyższą odmianę ?
GetText to obsluguje out-of-the-box:
n_('%d produkt', '%d produkty', '%d produktów', x) % x
patrz:
http://www.yotabanana.com/hiki/ruby-gettext-howto.html#How+to+use+GetText.n_%28msgid%2C+msgid_plural%2C+n%29
pzdr
szeryf
--
Przemysław ,,Szeryf'' Kowalczyk :: http://szeryf.wordpress.com/
Technical Details
Message-ID:
<op.ujo66kpquw9fft@negative-361apc>Path:
mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.rmf.pl!agh.edu.pl!news.agh.edu.pl!news.onet.pl!news.task.gda.pl!not-for-mailReferences:
<ge2tgk$s8f$1@atlantis.news.neostrada.pl>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.rmf.pl!agh.edu.pl!news.agh.edu.pl!news.onet.pl!news.task.gda.pl!not-for-mail From: Przemysław Kowalczyk <someone@microsoft.com> Newsgroups: pl.comp.lang.ruby Subject: Re: rozszerzony pluralize Date: Mon, 27 Oct 2008 20:31:22 +0100 Organization: CI TASK http://www.task.gda.pl/ Lines: 24 Message-ID: <op.ujo66kpquw9fft@negative-361apc> References: <ge2tgk$s8f$1@atlantis.news.neostrada.pl> NNTP-Posting-Host: host-81-190-218-64.wroclaw.mm.pl Mime-Version: 1.0 X-Trace: news.task.gda.pl 1225136152 18132 81.190.218.64 (27 Oct 2008 19:35:52 GMT) X-Complaints-To: abuse@news.task.gda.pl NNTP-Posting-Date: Mon, 27 Oct 2008 19:35:52 +0000 (UTC) User-Agent: Opera Mail/9.10 (Win32) Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit