2014-06-09 23 views
0

我正在使用php-gettext library。繼教程here, 我已經設置了_gettext()函數如何使ngettext()使用php-gettext庫工作?

require_once("locale/gettext.php"); 
require_once("locale/streams.php"); 


$locale_file = new FileReader("locale/$locale/LC_MESSAGES/messages.mo"); 
$locale_fetch = new gettext_reader($locale_file); 

function _gettext($text){ 
    global $locale_fetch; 
    return $locale_fetch->translate($text); 
} 

我也想用ngettext()函數來翻譯多文本。現在它不起作用。我怎樣才能做到這一點?謝謝!

回答

0

好,我發現它

function _ngettext($t1, $t2, $count){ 
    global $locale_fetch; 
    return $locale_fetch->ngettext($t1, $t2, $count); 
}