msgfmt returns the wrong line with an error

419 views Asked by At

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

2

There are 2 answers

0
Yaroslav Andriychuk On BEST ANSWER

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

0
Hannes On

I know this is quite old for now, but if there is someone out there like me who got redirected to this question here's the problem:

Investigate the last line a bit further then you'll see that there stands msgid instead of msgstr.

So change from:

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

To this one:

msgid "Subscribe"
msgstr "Subscribe" // << Here was the error

One thing to mention: Another problem which could occur is that the " get wrong converted when you are copying your message strings from documents (e.g. Pages, Word, etc.). So keep that in mind.