[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bug#440710: gettext: msgfmt -c: number of format specifications in '
From: |
Chusslove Illich |
Subject: |
Re: Bug#440710: gettext: msgfmt -c: number of format specifications in 'msgid' and 'msgstr[0]' does not match (fwd) |
Date: |
Wed, 5 Sep 2007 13:38:55 +0200 |
User-agent: |
KMail/1.9.5 |
> [: Jens Seidel :]
> msgfmt --check complains on a valid file:
>
> ru.po:11: number of format specifications in 'msgid' and 'msgstr[0]' does
> not match
> msgfmt: found 1 fatal error
The attached PO snippet is in fact not valid:
msgid ""
msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"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"
#: hex_puzzzle.cpp:1567
#, c-format
msgid "Complete 1 more level to unlock!"
msgid_plural "Complete %d more levels to unlock!"
msgstr[0] "Осталось пройти ещё один!"
msgstr[1] "Нужно пройти ещё %d!"
msgstr[2] "Нужно пройти ещё %d!"
because msgstr[0] does not contain %d, but it will be used for all numbers
ending with 1 and not with 11.
I think Russian plural is same as Serbian, and we had the same problem as in
this example: sometimes the form for exactly 1 should be entirely distinct
from other forms. So we use a 4-plural header, which puts the "exactly 1"
form on msgstr[3]:
msgid ""
msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Plural-Forms: nplurals=4; plural=n==1 ? 3 : n%10==1 && n%100!=11 ? 0 : n%"
"10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n"
#: hex_puzzzle.cpp:1567
#, c-format
msgid "Complete 1 more level to unlock!"
msgid_plural "Complete %d more levels to unlock!"
msgstr[0] "Нужно пройти ещё %d!"
msgstr[1] "Нужно пройти ещё %d!"
msgstr[2] "Нужно пройти ещё %d!"
msgstr[3] "Осталось пройти ещё один!"
To put the extra form at the end is convenient for compatibility with older
translations: if the plural header is changed to 4 forms, but the existing
messages are not updated and msgstr[3] is missing, msgstr[0] will be used
instead -- precisely what is best to happen. (Although, since this is highly
language dependent, I wonder if such behavior is guaranteed/intentional on
part of gettext, or just an implementation detail?)
--
Chusslove Illich (Часлав Илић)
pgplLz6xGf8u7.pgp
Description: PGP signature