无法使用gettext php翻译复数

无法使用gettext php翻译复数,php,gettext,Php,Gettext,我能够使用gettext库翻译文本。但是,当我试图将其转换为复数形式时,它只给出英语。我已经在.po文件中提到了复数形式。我的代码 public $localeFetch; public function __construct() { require_once(APP_ROOT."/includes/streams.php"); require_once(APP_ROOT."/includes/gettext.php");

我能够使用gettext库翻译文本。但是,当我试图将其转换为复数形式时,它只给出英语。我已经在.po文件中提到了复数形式。我的代码

public $localeFetch;     
public function __construct() {

        require_once(APP_ROOT."/includes/streams.php");
        require_once(APP_ROOT."/includes/gettext.php");            

        $localeLang = $_REQUEST['lang'];  // Take the Language I/p.            
        $localeLangfile = new FileReader(APP_ROOT."/includes/display/locale/$localeLang/LC_MESSAGES/messages.mo");            

        $this->localeFetch = new gettext_reader($localeLangfile);
    }

getTranslatedString("Your wish list contains");

public function getTranslatedString($text){
        $returnedString = $this->localeFetch->translate($text);             
        return $returnedString;
}
它给出了翻译后的输出

但是,例如,如果我

printf (ngettext ("%d product", "%d products", 2), 2);   

Output:
----------------
2 products. 
我想把它转换成复数形式


我对翻译的复数形式感到困惑。我错在哪里?提前感谢

您好,请正确设置您的代码格式(请参阅我如何更改您的代码格式。步骤:选择代码块,按Ctrl+K(或者您可以单击编辑器中的
{}
按钮)PHP语言环境设置是否正确?@Axel,是的。它设置正确。因为我可以使用getTranslatedString函数翻译文本(参数)。我不知道如何传递复数o/p。我想我们应该看看$this->localeFetch->translatetranslate背后的方法,它是在gettext.php中指定的方法