I'm importing translations to localize.drupal.org, and some of the imports end with error messages like:
The translation file modules-fieldgroup-panels-content_types.po ended unexpectedly at line 24.
The line number is one greater than the number of lines in the .po file (so in this example, the file had 23 lines).
I found that when the last string in the file is untranslated, I get this error message. When it's translated, everything's OK.
Weirdly enough, the import appears to succeed also when I get the error message. I tested this by importing a file which gave an error message, then translating the last string and importing it again. The second time, I got
The translation was successfully imported.
(number of strings) translations unchanged.
I got the files by extracting them from our old translation server (potx 5.x-1,3, l10n 5.x-1.0-alpha-3). But I did try to import one of the failing files to a Drupal site, and that went fine, so I assume the problem is with the import at the l10n server.
I've attached a few example files, so others can try to recreate the problem. The big file is all of CCK, the small file is modules-fieldgroup-panels-content_types.po (from CCK), both for 6.x. The language is nb (Norwegian bokmål).
| Comment | File | Size | Author |
|---|---|---|---|
| big-example-ok.po | 70.11 KB | zirvap | |
| big-example-not-ok.po | 70.06 KB | zirvap | |
| small-example-ok.po | 851 bytes | zirvap | |
| small-example-not-ok.po | 792 bytes | zirvap |
Comments
Comment #1
kiho commentedI had the same error message when importing to language nn (Norwegian nynorsk).
The .po-files that gives an error message has the last phrase in the file not translated. When the last phrase is translated, import gives no error message.
When import gives the error message, all phrases are still imported OK.
Comment #2
gábor hojtsyThe file is not imported in a transaction, so the previous strings are already stored by the time this error is reached. Looks like our state machine has some problem. Which is interesting given that it is a direct copy of the Drupal 7 core code and you said you did not reproduce this with core (I'd assume Drupal 6). There was some little changes around the import code with contexts and that might have caused this.
Comment #3
zirvap commentedYes, that's right.
Comment #4
gábor hojtsyWhile this is a standalone issue, I'm bringing this under #610768: Clean up import UI, fix last string bug and add tests where I'll hopefully accompany fixes with tests. Since these issues are all around the same codebase and writing tests and fixes for them at once is easier, I'm taking this under #610768: Clean up import UI, fix last string bug and add tests.
Comment #5
gábor hojtsy#610768: Clean up import UI, fix last string bug and add tests just got a fix which was committed, but not yet deployed.
Comment #6
gábor hojtsyFollowup Drupal core bug with suggested patch opened at #611786: .po file should not be considered broken if last msgstr is empty.