Summary: | Don't save po files correctly | ||
---|---|---|---|
Product: | [Unmaintained] kbabel | Reporter: | Ronny Kissing <ronny.kissing> |
Component: | general | Assignee: | Stanislav Visnovsky <visnovsky> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | nicolasg |
Priority: | NOR | ||
Version: | 1.11.1 | ||
Target Milestone: | --- | ||
Platform: | unspecified | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: | |||
Attachments: |
po file created by kdevelop, manually edited.
de.po hu.po pl.po ru.po |
Description
Ronny Kissing
2006-02-02 17:11:39 UTC
Can you attach the file to this bug report please? The error about \n is not KBabel's fault, as it is the job of the translator. As for a duplicate entry, I would suspect that it is not KBabel's problem either, as KBabel does not create new entries. So it probably mean that the file loaded into KBabel was already wrong. Have a nice day! Created attachment 14522 [details]
po file created by kdevelop, manually edited.
This po file was created from kdevelop an when manually edited, it works all
fine.
But kbabel does not handel this file well
Am Freitag, 3. Februar 2006 14:18 schrieb Nicolas Goutte: [bugs.kde.org quoted mail] The file is attached. But I don't know where else the error could be. Every po file kdevelop creates by adding a new translation, kbabel does not save it and allways show that error. KDevelop can not be the program which handles po files in the wrong way. By editing the po file by hand, adding the translated text, in an text editor, the po file is quiet ok and compiles well. I don't know what to do. cheers Ronny Kissing Created an attachment (id=14523) de.po Created an attachment (id=14524) hu.po Created an attachment (id=14525) pl.po Created an attachment (id=14526) ru.po On Friday 03 February 2006 14:28, Ronny Kissing wrote: (...) > ------- Additional Comments From ronny.kissing gmx net 2006-02-03 14:28 > ------- Created an attachment (id=14522) > --> (http://bugs.kde.org/attachment.cgi?id=14522&action=view) > po file created by kdevelop, manually edited. > > This po file was created from kdevelop an when manually edited, it works > all fine. The problem is that this PO file has no header at all. So if it is really something from KDevelop, then KDevelop must be fixed. > > But kbabel does not handel this file well Sure, KBabel expects that PO files have a header. (So indeed it is also KBabel's problem.) Have a nice day! I have checked how KBabel saves the de.po file. (KBabel *does* save. The error message is only from the msgfmt check and is done after writing the file.) KBabel tries to make a header out of the first message. That is why it is duplicated and also why there is this error about the \n mismatch. Of course, KBabel should create a header from scratch if there is not any and not do such a thing. What KBabel will probably not know how to fix is the encoding of the file, as de.po does not declare any encoding (as there is no header). Have a nice day! SVN commit 506958 by goutte: Create a temporary header if the header entry has a non-empty msgid BUG:121236 M +28 -8 gettextimport.cpp --- branches/KDE/3.5/kdesdk/kbabel/filters/gettext/gettextimport.cpp #506957:506958 @@ -128,11 +128,31 @@ kdDebug( KBABEL ) << "Parse error in header entry" << endl; return status; } - - // ### TODO: check that the msgid is empty (if not, we might have a PO file without header) - tempHeader.setMsgid( _msgid ); - tempHeader.setMsgstr( _msgstr ); - tempHeader.setComment( _comment ); + + kdDebug() << "HEADER MSGID: " << _msgid << endl; + kdDebug() << "HEADER MSGSTR: " << _msgstr << endl; + if ( !_msgid.isEmpty() && !_msgid.first().isEmpty() ) + { + // The header must have an empty msgid + kdWarning(KBABEL) << "Header entry has non-empty msgid. Creating a temporary header! " << _msgid << endl; + tempHeader.setMsgid( QStringList() ); + QStringList tmp; + tmp.append( + "Content-Type: text/plain; charset=UTF-8\\n" // Unknown charset + "Content-Transfer-Encoding: 8bit\\n" + "Mime-Version: 1.0" ); + tempHeader.setMsgstr( tmp ); + // We keep the comment of the first entry, as it might really be a header comment (at least partially) + const QString comment( "# Header entry was created by KBabel!\n#\n" + _comment ); + tempHeader.setComment( comment ); + recoveredErrorInHeader = true; + } + else + { + tempHeader.setMsgid( _msgid ); + tempHeader.setMsgstr( _msgstr ); + tempHeader.setComment( _comment ); + } if(tempHeader.isFuzzy()) { tempHeader.removeFuzzy(); @@ -358,7 +378,7 @@ ConversionStatus GettextImportPlugin::readEntry(QTextStream& stream) { - kdDebug( KBABEL ) << k_funcinfo << " START" << endl; + //kdDebug( KBABEL ) << k_funcinfo << " START" << endl; enum {Begin,Comment,Msgctxt,Msgid,Msgstr} part=Begin; QString line; @@ -382,7 +402,7 @@ line=stream.readLine(); - kdDebug() << "Parsing line: " << line << endl; + //kdDebug() << "Parsing line: " << line << endl; // ### Qt4: no need of a such a check if(line.isNull()) // file end @@ -785,7 +805,7 @@ } */ - kdDebug( KBABEL ) << k_funcinfo << " NEAR RETURN" << endl; + //kdDebug( KBABEL ) << k_funcinfo << " NEAR RETURN" << endl; if(error) return PARSE_ERROR; else if(recoverableError) |