[Top][All Lists]

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

Re: parenthesis necessary for Plural-Forms

From: Viktor Horvath
Subject: Re: parenthesis necessary for Plural-Forms
Date: Thu, 14 Aug 2008 14:00:13 +0200
User-agent: Internet Messaging Program (IMP) H3 (4.1.3)

Hello Bruno, hello Guido,

Quoting Bruno Haible <address@hidden>:

Viktor Horvath wrote:
I'm using gettext 0.17 to internationalise a Perl project. I found
that plural forms would only work when I set the plurals= expression
into parentheses. Specifically,

"Plural-Forms: nplurals=3; plural=n==0 ? 0 : (n==1 ? 1 : 2);n"

would not work as expected, but

"Plural-Forms: nplurals=3; plural=(n==0 ? 0 : (n==1 ? 1 : 2));n"

did the job.

You certainly mean 'n' at the end of the string, not plain 'n'.

Sure. No idea where it got lost.

Other than that, this need for parentheses would be a bug. gettext for C
certainly does not require the outer parentheses. Maybe the pure-perl
implementation in libintl-perl-1.16/lib/Locale/gettext_pp.pm requires them?

Yes, it is a Perl problem, sorry Bruno for addressing you. I didn't notice that I hadn't the package for gettext_xs installed (libintl-xs-perl for Ubuntu 8.04). As soon as I installed that, the problems disappeared - no matter whether I chose gettext_xs or gettext_pp in the Perl code. (Maybe I do not call the function select_package() well?) - However, when I deinstalled libintl-xs-perl and was left only with libintl-perl, the error reappeared.

I have attached a testcase, kept as simple as possible. Two perl
scripts which are different only in the textdomain used; and the two
textdomains differ only in their "Plural-Forms" line, as shown above.

This is the output on my system, when I have libintl-xs-perl NOT installed:

$ LC_MESSAGES=en_US.ISO8859-1 perl langtest.pl
Translation for number 0: Zero
Translation for number 1: One
Translation for number 10: Many, namely 10

$ LC_MESSAGES=en_US.ISO8859-1 perl langtest_wrong.pl
Translation for number 0: One
Translation for number 1: Zero
Translation for number 10: One

The untranslated strings all start with "UNTRANSLATED_", so I am sure that the
textdomains are really used, but wrongly.

Best regards,

Attachment: vhorvath_perl_gettext_testcase.tar.bz2
Description: application/tbz

Attachment: pgps0v_qTCHhv.pgp
Description: PGP Digital Signature

reply via email to

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