I 'm struggling with plural forms in my translation files. The *.po files are set up correctly. All works fine so far. Editing with Poedit works like a charme. But when it comes to the translation of plural forms, I 'm facing some problems.
The plural form definition in the *.po file:
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
The typical translation message:
#: view/application/index/index.phtml:112 msgid "Eine offene Aufgabe" msgid_plural "%d offene Aufgaben" msgstr "One open task" msgstr "%d open tasks"
translatePlural call in my template:
<?= $this->translatePlural('Eine offene Aufgabe', '%d offene Aufgaben', 3) ?>
Actually the %d specifier is not replaced with the third parameter of the
translatePlural view helper. The output is just the plain translation “%d open tasks”. Am I getting something wrong? Does the
translatePlural view helper not replace specifiers? Do I have to use something like …
<?= sprintf($this->translatePlural('offene Aufgabe', '%d offene Aufgaben', 3), 3) ?>
… or is there another way, that automatically replaces c-format specifiers in translations?