Hi, I created Italian language, I exported the .po file, I manuallly modified it and, trying to reimporting it, I got the (in)famous
"msgstr" was expected but not found
error.
After searching troughout in drupal.org sites I ended up that the error is rised because:
- the .po is missing Plural-Formsheader
- string with plural form are missing msgstr[0] and msgstr[1] lines
i.e. the .po generated by export procedure is corrupted.
Why may this happen?
(For instance, after analyzing Locale module code and db tables I found that in languages table, in the italian language record, plurals and formula fields where empty and, after manually modifying that values, I was able to generate a well formed .po file with export procuder, but, after reimporting the .po, languages table was again corrupted.)
Comments
Comment #1
JirkaRybka commentedI confirm the bug. I exported Czech translations from my 6.x test-install, to be later imported to production site when it goes to 6.x (5.x to 6.x upgrade). The situation on my install is a bit unclear due to the fact, that I had two exports (done at different points through the translation process), first of which (exported last, imported first) failed to import (the above mentioned (un)famous error), second imported without errors.
But anyway, since I did both the imports with the "keep existing strings, only add new ones", and all the installs involved are basically copies of the same database (only just translated to various extents), the plurals settings should definitely NOT be changed. I, too, had to re-populate the number of plurals and formula in my database manually, to fix the site. All is on 6.13.
Comment #2
gábor hojtsyYou should have imported a broken .po file at one point. You can fix this by importing a .po file with the right plural formula. I'd also welcome support for the core bug at #566390: Apply locale import protection to the plural forms, which would have plural modifications sidestepped in the "keep existing stuff" mode, which is not how it is done so far. That would help solve almost all of these issues, since people tend to import a good .po file first. Then they will still be able to correct by importing a .po file in overwrite mode, but will not break their site by importing a broken .po in keep mode.
Comment #3
gábor hojtsy