Re: Plurar and Singular
On Sun, Jan 11, 2004 at 11:31:55PM -0500, Joey Hess wrote:
> Denis Barbier wrote:
> > On Mon, Jan 12, 2004 at 12:13:21AM +0100, Nikolai Prokoschenko wrote:
> > [...]
> > > Umhh... Well, I appreciate you???trying, but please remove this hack - it is
> > > easier to rephrase in this case. Like already said, russian language has
> > > _three_ singular/plural forms for different numbers, so your hack will not
> > > please us either, as it only provides two forms, as far as I can tell...
> >
> > Joey's hack should work because it calls ngettext as requested, and do
> > not rely on debconf itself. It needs to be polished, will propose a patch
> > later (note that I am not familiar with plural forms).
>
> Right, I don't understand how the multiple plural forms should look in
> the po file, but it should indeed support it.
Gettext doc in unstable tells that $"..." bashism is deprecated, and
recommands direct calls to gettext commands from the shell. I wrote in
the templates file
The Debian package management tool, apt, is now configured, and can
install any of ${PACKAGE_STR}.
and in apt-setup
PACKAGE_STR=$(ngettext "\${PACKAGE_COUNT} package" "\${PACKAGE_COUNT} packages" $PACKAGE_COUNT)
db_subst apt-setup/another PACKAGE_STR $PACKAGE_STR
db_subst apt-setup/another PACKAGE_COUNT $PACKAGE_COUNT
Then "xgettext -L Shell apt-setup" prints in the PO file:
#: ../apt-setup:178
#, sh-format
msgid "${PACKAGE_COUNT} package"
msgid_plural "${PACKAGE_COUNT} packages."
msgstr[0] ""
msgstr[1] ""
Note that arguments must be quoted, otherwise they won't appear in PO files.
Header entry also contains a new line
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
According to gettext doc, Russian translators have to replace it by
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
and then writes 3 translated forms
msgstr[0] "foo"
msgstr[1] "bar"
msgstr[2] "baz"
to handle those 3 cases.
This is how it should work with gettext 0.13, I am not sure if the testing
version works the same way, and did not finish the patch, so will look at
it again tonight unless someone sends a working patch.
Denis
Reply to: