【发布时间】:2011-03-11 05:30:53
【问题描述】:
我目前正在使用带有 POEdit 的 gettext 翻译我的 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)可以像 eclipse 一样自动为我做到这一点 在java中。
总之,有没有办法告诉 POEdit 解析器将换行符转义为首选项中的空格?
我知道即使换行符没有转义,字符串仍然可以翻译,我这样问是为了让我的 traductor(有时甚至是客户/用户)在 POEdit 中翻译时避免混淆认为他需要复制换行符.
【问题讨论】:
标签: php whitespace gettext line-breaks poedit