我目前正在使用gettext和POEdit翻譯我的PHP應用程序。因爲我尊重我的源代碼的打印邊距,我是用來寫串那樣:如何使用POEdit解析器忽略PHP斷行?
print $this->translate("A long string of text
that needs to follow the print margin and since
php outputs whitespaces for every break line I do
my sites renders correctly.");
然而,在poEdit,因爲預期的換行符不逃到空格。
A long string of text\n
that needs to follow the print margin and since\n
php outputs whitespaces for every break line I do\n
my websites render correctly.\n
我知道一個辦法是在源代碼一樣,多變的線條時關閉字符串:
print $this->translate("A long string of text " .
"that needs to follow the print margin and since " .
"php outputs whitespaces for every break line I do " .
"my sites renders correctly. ");
但它不是一個辦法,是可擴展的我,當文本需要改變並打印保證金 仍然受到尊重,除非netbeans(我使用的IDE)可以爲我自動執行此操作,就像java中的eclipse 一樣。
因此總而言之,是否有辦法告訴POEdit解析器在首選項中將換行符轉義爲空格?
我知道即使換行符沒有被轉義,字符串仍然是可翻譯的,我問這個問題是爲了讓我的轉換者(有時甚至是客戶/用戶)避免混淆,認爲他需要在轉換時重複換行符poEdit的。
我沒有換行跨操作系統的問題,因爲我一定要中使用Unix的換行符替換我源代碼(或者我可能不清楚你的陳述)。我認爲將會有一種簡單的方法將換行解釋爲xgettext解析器命令中的空格。這可能嗎? – 2010-07-02 18:40:41