使用以下命令生成 .po 文件时:
xgettext test.js -o test.pot -L JavaScript --from-code=UTF-8
msginit -i test.pot -o de.po --locale=de
我得到以下标题:
# Copyright (C) 2021 THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# test <test@test.com>, 2021.
#
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-04-16 11:39+0300\n"
"PO-Revision-Date: 2021-04-16 11:40+0300\n"
"Last-Translator: test <test@test.com>\n"
"Language-Team: German\n"
"Language: de\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=ASCII\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
使用检查此文件时
msgfmt -cv /dev/null de.po
出现以下错误
msgfmt: /dev/null: warning: PO file header missing or invalid
warning: charset conversion will not work
msgfmt: found 1 fatal error
我在文件中更改了charset=ASCII
to但得到了同样的错误。我正在使用 Ubuntu Server 20.04 和 gettext-tools 版本 0.19.8.1charset=UTF-8
de.po