문제
파일이 있습니다 dk.po
그리고 dk.mo
내 webdir의 폴더 랑에서.
이 파일을 어떻게 사용할 수 있습니까? 나는 모든 것을 시도했지만 그것을 작동시킬 수는 없습니다.
// Lang
putenv('LC_ALL=dk');
setlocale(LC_ALL, 'dk');
// Specify location of translation tables
bindtextdomain("dk", ROOT .'lang');
// Choose domain
textdomain("dk");
해결책
나는 이미 이것으로 일하고있다 :
setlocale(LC_ALL, 'ar_LY.utf8');
bindtextdomain("trans", $_SERVER["DOCUMENT_ROOT"].'/trans/locale');
textdomain("trans");
언어 파일 경로 :
/var/www/trans/locale/ar_LY/LC_MESSAGES/trans.mo
그리고 나는 당신이 같은 경로를 사용해야한다고 생각합니다!
다른 팁
이것은 나에게 작동합니다. 내 파일의 이름은 message.mo입니다
static function initialize_i18n() {
$locale=App::$locale;
$locales_root = App::$root."locale";
putenv('LANG='.$locale);
putenv('LANGUAGE='.$locale);
putenv('LC_ALL='.$locale);
putenv('LC_MESSAGES='.$locale);
setlocale(LC_ALL, $locale.".utf-8");
$domains = glob($locales_root.'/'.$locale.'/LC_MESSAGES/messages-*.mo');
$current = basename($domains[0],'.mo');
$timestamp = preg_replace('{messages-}i','',$current);
bindtextdomain("messages",$locales_root);
textdomain("messages");
}
나는 진지하게 사용하는 것이 좋습니다 Zend_Translate
이를 위해 locales
다양한 유형의 시스템에서.
문서 : http://framework.zend.com/manual/en/zend.translate.using.html
제휴하지 않습니다 StackOverflow