[Top][All Lists]

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

Re: [bug-gettext] Plural forms

From: Roel Vermeulen
Subject: Re: [bug-gettext] Plural forms
Date: Sat, 17 Dec 2016 14:58:08 +0000

I am using php-gettext-memcached, PHP-gettext 1.0 (https://launchpad.net/php-gettext) because the native gettext extension is unavailable on Google Cloud AppEngine.

I get these errors:

PHP Warning: Missing argument 4 for gettext_reader::npgettext(), called in /base/data/home/apps/s~valiant-marker-94108/20161217t154911.397817632732775351/libs/gettext/gettext.inc on line 359 and defined in /base/data/home/apps/s~valiant-marker-94108/20161217t154911.397817632732775351/libs/gettext/gettext.php on line 446
15:51:13.717PHP Notice: Undefined variable: number in /base/data/home/apps/s~valiant-marker-94108/20161217t154911.397817632732775351/libs/gettext/gettext.php on line 448
15:51:13.717PHP Parse error: syntax error, unexpected '!=' (T_IS_NOT_EQUAL) in /base/data/home/apps/s~valiant-marker-94108/20161217t154911.397817632732775351/libs/gettext/gettext.php(387) : eval()'d code on line 1
15:51:13.717PHP Notice: Undefined offset: -1 in /base/data/home/apps/s~valiant-marker-94108/20161217t154911.397817632732775351/libs/gettext/gettext.php on line 422

On Sat, 17 Dec 2016 at 13:41 Bruno Haible <address@hidden> wrote:

> I have a case where the singular and plural form are the same in English,
> but different in other languages.
> ngettext("%d correct", "%d correct", n)
> The Spanish translation would be
> "%d correcto" (singular)
> "%d correctos" (plural)
> indicating the number of correct answers given.

GNU gettext supports this case.

> But this gives me an error since the singular msgid is exactly the same as
> the plural msgid.

I don't get an error here.

$ cat foo.c
ngettext("%d correct", "%d correct", n);
$ xgettext -o - foo.c
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <address@hidden>, YEAR.
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-12-17 13:37+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <address@hidden>\n"
"Language-Team: LANGUAGE <address@hidden>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=INTEGER; plural=_expression_;\n"

#: foo.c:1
#, c-format
msgid "%d correct"
msgid_plural "%d correct"
msgstr[0] ""
msgstr[1] ""

The important thing here is that you don't have 2 msgids, but 1 msgid with an
associated msgid_plural.

What was the error you got? From which tool? Which version of the tool?


reply via email to

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