Search code examples
gnugettextpomsgfmt

msgfmt returns the wrong line with an error


today I'm having a problem. I deliberately created a .po file in which there is an error. I expect that the backtrace error appears on the 39 string. Instead, the validator shows

test.po:1: missing 'msgstr' section - means that validator found error on first line

Attaching a file

msgid ""
msgstr ""
"Language: en_EN\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Project-Id-Version: \n"
"POT-Creation-Date: \n"
"PO-Revision-Date: \n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 2.0.3\n"

msgid "About"
msgstr "About"

msgid "Team"
msgstr "Team"

msgid "ICO"
msgstr "ICO"

msgid "Partners"
msgstr "Partners"

msgid "Blog"
msgstr "Blog"

msgid "contacts"
msgstr "contacts"

msgid "Subscribe"
msgid "Subscribe" // << Here must be an error

Please,help


Solution

  • The problem was in carriage return ^M. I converted that carriage return to \n and it works like a charm