Xgettext will not validate plural form

I am using Poedit for my gettext i18n and it works fine. I use ZF2, where there are viewers for translating integration. One of them is translate , the other is translatePlural .

Using:

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

In Poedit, I add the translate and translatePlural keywords. Normal translations work fine, but for multiple forms only "Item" is found (not "Items"). For testing, I replaced the call of $this->translatePlural() with ngettext() , but in the end I got the same result. My conclusion: (my version) Poedit cannot scan multiple forms.

What should I enter as a keyword so that Poedit also looks at the second line?

+4
source share
1 answer

After some further searching, I came across the syntax [function]:1,2 . It did the trick for me. Now I have defined these two functions as keywords for Poedit as follows:

 translate translatePlural:1,2 

And now the second argument is checked.

+9
source

Source: https://habr.com/ru/post/1438103/


All Articles