2013-07-18 5 views
4

내 .po 파일을 젠드 PHP 번역 배열로 변환하기 위해 po2php을 사용하려고합니다.Translate Toolkit을 사용하여 .po를 PHP 배열 (Zend Framework)로 변환하는 방법?

나는 단지 이것을 시도하고있다 : $ po2php translations.po translations.php, 그러나 이것은 내가 이해할 수없는 오류가된다 : po2php: warning: Couldn't handle input file translations.po: don't know what to do with input format .po, no template file.

템플릿 파일이 무엇인지 알 수없는 이유는 무엇입니까?

업데이트 : 나는 또한 $ po2php translations.po translations.php -t messages.pot을 시도했으나이 방법은 도움이되지 않습니다. 이것은 거의 동일한 오류를 보여줍니다 : po2php: warning: Couldn't handle input file translations.po: don't know what to do with input format .po, template format .pot.

+0

왜 Zend_Translate_Adapter_Gettext (http://framework.zend.com/manual/1.12/en/zend.translate.adapter.html)를 사용하여 .po /를 사용하지 않을까요? 미주리 파일을 직접? –

+0

그것은 내가 작업하고있는 프로젝트에 대한 요구 사항 일뿐입니다. 역사적인 이유 ... – ragulka

+0

죄송합니다. 다음은 도움이되지 않습니다. :( –

답변

0

배 패키지 File_Gettext을 사용해 볼 수도 있습니다. 자세한 내용은 여기 읽기 : https://github.com/pear/File_Gettext

코드는 (하지 않음 시험)과 같을 것이다 :

include_once 'File/Gettext/PO.php'; 

$poFile = new File_Gettext_PO(); 
$poFile->load('PATH_TO/translations.po'); 

print_r($poFile->strings); 

$poFile->strings는 연관 배열로 포 파일의 내용을 포함해야합니다. 다음으로이 배열을 파일로 출력하는 함수가 필요합니다. 여기에서 두 번째 대답을 살펴보십시오. Print array to a file