On 06-01-2010 at 21:13:55 Marcin Głowacki <[email protected]> wrote:
How to use gettext plural forms in PO file?
I've added suitable header ("Plural-Forms: nplurals=2; plural=n != 1;\n"
- for english) and tried in different ways:
msgid "picture"
msgid_plural "pictures"
msgstr[0] "picture"
msgstr[1] "pictures"
or
msgid "picture"
msgid_plural "${n} pictures"
msgstr[0] "${n} picture"
msgstr[1] "${n} pictures"
but nothing worked ;-/
phptal used:
<tal:block i18n:translate=""><span i18n:name="n"
tal:replace="data/count"/> pictures</tal:block>
where data/count is 1, 2, 3, ...
Unfortunately it doesn't support it out of the box.
In GetTextTranslator class change:
$value = gettext($key);
to something like:
if (false === strpos('${number}', $key))
{
$value = gettext($key);
}
else
{
$value = ngettext($key, $key, $this->_vars['number']);
}
The problem is, as you see, that gettext requires use of a different
function for plural form, and TAL syntax has no way to indicate when this
is needed. I'm open to suggestions.
--
regards, Kornel
_______________________________________________
PHPTAL mailing list
[email protected]
http://lists.motion-twin.com/mailman/listinfo/phptal