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
我将该文件与其他未显示此错误但未发现问题的文件进行了比较。
这是翻译的前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"
任何人都可以看到我的档案有什么问题吗?
答案 0 :(得分:6)
您的PO文件无效 - 它不遵循PO文件格式语法,也不会在字符串文字中转义引号。与msgid "foo"bar"
不同,msgid "foo\"bar"
无效,与C,PHP或许多其他语言类似。
IMNSHO,你应该放弃任何工具生成如此可怕的破坏PO文件(它肯定不是X-Generator
标题所暗示的Poedit)并立即用实际知道其输出格式的东西替换它。例如用于gettext字符串提取的xgettext
, 标准工具。它支持PHP就好了。
如果该工具是本土的,那么这是对Chusslove Illich of Pology的{em>非常良好的PO格式描述:http://pology.nedohodnik.net/doc/user/en_US/ch-poformat.html(非官方的,但比GNU gettext自己的手册要好得多)。如果您在任何代码中编写或阅读PO文件,我强烈推荐它。
答案 1 :(得分:1)
我发现了问题。我需要在每个\
旁边手动添加"
,其中poedit会给出错误...我一点一点地修复它并且有效:)
答案 2 :(得分:0)
对于阅读此书并调试po文件中POEdit中显示的错误时遇到麻烦的任何人,您可以运行:
msgfmt -v -c mypofile.po
它将显示po文件中显示的每个错误以及与之相关的行。
此外,您可以从POEdit菜单中使用Catalogue > Purge Deleted Translations
,这将为您节省大量的麻烦并减轻您的po文件的负担。