![](/img/trans.png)
[英]New to Zend framework, how can I translate my php 'result' (Huge Array) to something workable like a table?
[英]How to convert .po to PHP array (Zend Framework) with Translate Toolkit?
我正在嘗試使用po2php將我的.po文件轉換為Zend php翻譯數組。
我只是在嘗試這個: $ 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
。
你也可以試試梨包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
應該包含po文件的內容作為關聯數組。 接下來,您需要一個函數來在文件中輸出此數組。 看看第二個答案:將數組打印到文件中
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.