[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Some questions about plural forms
From: |
Michał Sawicz |
Subject: |
Re: Some questions about plural forms |
Date: |
Sat, 30 May 2009 11:51:57 +0200 |
Dnia 2009-05-30, sob o godzinie 01:15 +0200, Bruno Haible pisze:
> > > ngettext("Singular string %(string)s",
> > > "Plural string for %(digit)d",
> > > num) % {'string': "string", 'digit': 20}
>
> It is possible. xgettext extracts a plural message from this without
> problems. But it is bizarre that the 'string' parameter is not used in
> the English plural form.
The usecase is this:
Singular: A plugin "Foo" is to be installed
Plural: 3 plugins are to be installed
I actually walked around this by converting %d to %s and replace %s with
"Foo" or "3" depending on the plugin count
> The error message is slightly wrong. I'm changing it to
> x.po:24: a format specification for argument 'string', as in 'msgstr[0]',
> doesn't exist in 'msgid_plural'
>
> But it highlights nevertheless the inconsistency regarding the 'string'
> argument.
Yes, that was the error POEdit reported.
> POEdit is right. msgid_plural is the general form of the argument list,
> whereas msgid is only a special case.
What's the point in having msgid then, when there's no respective
msgstr? Seems in this case it actually becomes a comment?
> > Also, Pybabel seems to require all msgstr[] to have the same formatting
> > as msgid... This confuses me a lot...
>
> That seems like an unnecessary restriction. For unnamed arguments, it is
> normal and expected, but for named arguments, the integer argument should
> be omittable, so that translators can use a word instead of a known number.
Yes, based on what you said earlier PyBabel has it wrong.
All in all, from what I understand, msgid itself isn't used at all when
there are plural forms... And that is weird...
Something like this:
> msgid "Singular form for %s"
> msgid_plural "Plural form for %d"
> msgstr "Translated singular form for %s"
> msgstr[1] "Translated plural form for %d"
> msgstr[2] "Translated plural form for %d"
...
is not possible. I understand that, as it could lead to some confusion
sometimes. But a solution IMO would be to allow things like this:
> msgid "Singular form for %s"
> msgid_plural "Plural form for %d"
> msgstr[0] "Translated singular form for %s"
> msgstr[1] "Translated plural form for %d"
> msgstr[2] "Translated plural form for %d"
Where the gettext tool will check Plural-Forms and determine which
msgstr[] refers to singular form and compare its formatting with msgid
instead of msgid_plural.
--
Michał Sawicz <address@hidden>