php-gettext / Gettext

PHP library to collect and manipulate gettext (.po, .mo, .php, .json, etc)
MIT License
687 stars 134 forks source link

MoLoader get error if msgid_plural string with msgstr[1] #246

Closed RicherYang closed 4 years ago

RicherYang commented 4 years ago

The .po file is like

msgid "%s has been added to your cart."
msgid_plural "%s have been added to your cart."
msgstr[0] "%s has been added to your cart."
msgstr[1] "%s have been added to your cart."

when i try to load that .mo file with MoLoader get the php error TypeError: Argument 1 passed to Gettext\Translation::translatePlural() must be of the type string, array given, called in composer\vendor\gettext\gettext\src\Loader\MoLoader.php on line 100 in composer\vendor\gettext\gettext\src\Translation.php on line 148

Both the .mo build with the library or Poedit get the same erro.

use Gettext 5.2.1 with php 7.3.13

oscarotero commented 4 years ago

Yes, It's an error indeed. New version 5.2.2 released with this patch. Thank you!