poedit显示似乎无法修复的错误

Dan*_*ani 2 translation poedit

我有一个PoEdit问题我使用了一个名为PO-Auto-Translator的软件翻译一个po文件,一旦完成我想继续用poedit编辑文件,当我尝试保存时我得到很多错误...

    04/21/14 22:39:12: C:\Users\home\Desktop\translation.po:46: missing 'msgstr' section
04/21/14 22:39:12: C:\Users\home\Desktop\translation.po:46:22: syntax error
04/21/14 22:39:12: C:\Users\home\Desktop\translation.po:51: missing 'msgstr' section
04/21/14 22:39:12: C:\Users\home\Desktop\translation.po:51:22: syntax error
04/21/14 22:39:12: C:\Users\home\Desktop\translation.po:52: keyword "$s" unknown
04/21/14 22:39:12: C:\Users\home\Desktop\translation.po:795: keyword "Upload" unknown
04/21/14 22:39:12: C:\Users\home\Desktop\translation.po:795:55: syntax error
04/21/14 22:39:12: C:\Users\home\Desktop\translation.po:1583: missing 'msgstr' section
04/21/14 22:39:12: C:\Users\home\Desktop\translation.po:1583:27: syntax error
04/21/14 22:39:12: C:\Users\home\Desktop\translation.po:1584: keyword "s" unknown
04/21/14 22:39:12: C:\Users\home\Desktop\translation.po:1597:28: syntax error
04/21/14 22:39:12: C:\Users\home\Desktop\translation.po:1597: keyword "s" unknown
04/21/14 22:39:12: C:\Users\home\Desktop\translation.po:4162:14: syntax error
04/21/14 22:39:12: C:\Users\home\Desktop\translation.po:4163: end-of-line within string
04/21/14 22:39:12: C:\Users\home\Desktop\translation.po:4167:14: syntax error
04/21/14 22:39:12: C:\Users\home\Desktop\translation.po:4167: keyword "Admin" unknown
04/21/14 22:39:12: C:\Users\home\Desktop\translation.po:4168: end-of-line within string
04/21/14 22:39:12: C:\Users\home\Desktop\translation.po:4172:14: syntax error
04/21/14 22:39:12: C:\Users\home\Desktop\translation.po:4173: end-of-line within string
04/21/14 22:39:12: C:\Users\home\Desktop\translation.po:4176:31: syntax error
04/21/14 22:39:12: C:\Program Files (x86)\Poedit\GettextTools\bin\msgfmt.exe: too many errors, aborting
Run Code Online (Sandbox Code Playgroud)

我将该文件与其他未显示此错误但未发现问题的文件进行了比较.

这是翻译的前50行

# Translation of translation
msgid ""
msgstr ""
"Project-Id-Version: translation\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2012-12-05 10:43+0100\n"
"PO-Revision-Date: 2014-04-21 22:39+0200\n"
"Last-Translator: \n"
"Language-Team: AppThemes\n"
"Language: en\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Generator: Poedit 1.6.4\n"
"X-Poedit-KeywordsList: __;_e;_n:1,2;_nx:1,2;_x:1,2c;_ex:1,2c;esc_attr__;esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;_n_noop:1,2;_nx_noop:1,2,3c\n"
"X-Poedit-SourceCharset: UTF-8\n"
"X-Poedit-Basepath: .\n"
"X-Poedit-SearchPath-0: .\n"

#: 404.php:22
msgid "Whoops! Page Not Found."
msgstr "????! ?? ?? ????."

#: 404.php:24
#: 404.php:44 search.php:77 includes/theme-actions.php:218
msgid "Sponsored Links"
msgstr "??????? ???????"

#: attachment.php:19
#, php-format
msgid "Return to %s"
msgstr "???? ??% s"

#: attachment.php:20
#, php-format
msgid "← Return to %s"
msgstr "? ???? ??% s"

#: attachment.php:31
#, php-format
msgid "<span class="%1$s">By</span> %2$s"  /line 46
msgstr "?"

#: attachment.php:44
#, php-format
msgid "<span class="%1$s">Uploaded</span> %2$s"
msgstr "<span class="%1$s">Uploaded</span> %2$s"

#: attachment.php:55
#, php-format
msgid "Full size is %s pixels"
msgstr "???? ??? ??? ???????% s"
Run Code Online (Sandbox Code Playgroud)

任何人都可以看到我的文件的问题是什么?

Vác*_*vík 6

您的PO文件无效 - 它不遵循PO文件格式语法,也不会在字符串文字中转义引号.msgid "foo"bar"msgid "foo\"bar"C,PHP或许多其他语言类似,它是无效的.

IMNSHO,你应该放弃任何工具生成如此可怕的破坏PO文件(它绝对不是Poedit,因为X-Generator标题意味着)立即并用实际知道其输出格式的东西替换它.例如xgettext,gettext字符串提取标准工具.它支持PHP就好了.

如果这个工具是本土的,那么Chusslove Illich of Pology对PO格式进行了非常好的描述:http://pology.nedohodnik.net/doc/user/en_US/ch-poformat.html (非官方的,但比GNU gettext自己的手册).如果您在任何代码中编写或阅读PO文件,我强烈推荐它.