Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

xgettext won't scan plural form

I use Poedit for my gettext i18n and that works fine. I use ZF2 where there are view helpers to integrate the translations. One is translate, the other translatePlural.

Usage:

<?php echo $this->translate('Welcome') ?>
<?php echo $this->translatePlural('Item', 'Items', $number) ?>

In Poedit I add the keywords translate and translatePlural. The normal translations work fine, but for the plural forms, only the "Item" is found (and not the "Items"). Just for testing purposes, I replaced the $this->translatePlural() call with ngettext(), but I end up with the same result. My conclusion: (my version of) Poedit is unable to scan plural forms.

What should I enter as keyword to let Poedit scan the second string as well?

like image 730
Jurian Sluiman Avatar asked Jan 16 '23 09:01

Jurian Sluiman


1 Answers

After some further search, I stumbled upon the syntax [function]:1,2. That did the trick for me. I have now identified these two functions as keywords for Poedit as follows:

translate
translatePlural:1,2

And now my second argument is scanned.

like image 115
Jurian Sluiman Avatar answered Jan 25 '23 07:01

Jurian Sluiman