The problem lies on exporting a custom translation of Drupal 6.2 interface, in this case Spanish, built on the existing Spanish translation from Drupal.org for that language. I say custom because I have added translations for some missing items. I ceased translation to test an export/import to see if my added translations would be imported successfully without issues on a new install of Drupal 6.2. The issue seems to be with the plural versions of some strings that share the same ID. If I try to import the newly created .po, I get the following error:

-------------
The translation file es.po contains an error: "msgstr" was expected but not found on line 5135.
The translation import of es.po failed.
-------------

Inspection of the lines referenced here shows the following code:

These are lines 5131 through 5142. Line 5135 is the blank line after the line [ msgid_plural "The menu name can't be longer than @count characters." ]:

#:  modules/menu/menu.admin.inc:505
msgid "The menu name can't be longer than 1 character."
msgid_plural "The menu name can't be longer than @count characters."

#:  modules/menu/menu.module:23
msgid ""
"For more information, see the online handbook entry for <a "
"href=\"@menu\">Menu module</a>."
msgstr ""
"Para más información, consulte la referencia en el manual para el <a "
"href=\"@menu\">módulo menú</a>."

Further inspection inside the install of Drupal 6.2 that generated that .po export shows that, in fact, a translation had been provided for that line, but the export function failed to include it. I achieved this by searching for the string in the Translate interface section of the Administration area and noticed a translation had been provided with the downloaded Spanish translation from Drupal.org.

What are the steps required to reproduce the bug?
Add some missing translations to the existing Spanish translation download from Drupal.org and export it to a .po file. Try importing the exported .po either inside a new Drupal install or the same one that generated the .po file.

What behavior were you expecting?
Expected the import to be successful based on the options selected, either "Strings in the uploaded file replace existing ones, new ones are added" or "Existing strings are kept, only new strings are added".

What happened instead?
I got this error:

-------------
The translation file es.po contains an error: "msgstr" was expected but not found on line 5135.
The translation import of es.po failed.
-------------

If I manually add a translation string on the reported line to the .po file, i get the following error:

-------------
The translation file es.po contains an error: "msgstr" is unexpected on line 5134.
The translation import of es.po failed.
-------------

Comments

cog.rusty’s picture

One minor observation on fixing the file: You shouldn't try to add the translation of the singular alone into line 5134, but both translations must go together after the existing line 5134, like this

5135: msgstr[0] "translation of singular"
5136: msgstr[1] "translation of plural"
5137: [empty line]

(This is unrelated to the bug report, of course)

Anonymous’s picture

Title: Error importing a translation that has been exported with 6.2 » I have this bug as well in Spanish 6.2

Hello,

I have this bug as well and it's the same. However it hasn't happened to me till yesterday. I was using an exported po file and I got a 91% of the interface translated. However, it seems that i has been caused somehow at some moment when I started translating-refining my translation with the new translation interface provided directly in Drupal 6.2, not because of using poedit (that I have been using for a long time with no trouble).

I cannot reproduce the bug because it happened along a long session with stops for coffee and eating, but I suspect the most likely culprit could be the built-in translation interface.

Gustavo, from Madrid

Anonymous’s picture

I managed to rescue the translation with the hand method hinted by cog.rusty. However, when inspecting the po file to rebuild it, I saw that it lacked the plural strings for translation altogether, translated and untranslated ones.

Bye.

Damien Tournoud’s picture

Title: I have this bug as well in Spanish 6.2 » Spanish translation lacking proper Plural-Forms header
Project: Drupal core » Spanish translation
Version: 6.2 » 6.x-1.x-dev
Component: locale.module » PO files

This is a bug in the Spanish translation: the PO files seems to lack the Plural-Forms header.

cog.rusty’s picture

Then its should be added at the header of the po files. I don't know about Spanish, but for Greek we use

"Plural-Forms: nplurals=2; plural=(n!=1);\n"

which means there are 2 forms, one singular and one plural, and the plural is used when the number is not one (when it is many or zero). If it is the same for Spanish, that will do.

Jose Reyero’s picture

Status: Active » Fixed

I think it's a bug on the localization server, which is the tool we are using for translating and generating the po file.

However, I'll be fixing them manually, latest one should work

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

huizache’s picture

This cannot be a closed issue since the present spanish file still lacks the plural form.

huizache’s picture

Status: Closed (fixed) » Active

This cannot be a closed issue since the present spanish file still lacks the plural form.

Anonymous’s picture

That error was due to two lost closing brackets in the code of potx module (as referred in http://drupal.org/node/267926 ). That was solved in the last versions of that module, I believe (it was spotted in 6.2 and now Drupal is 6.8). I'd check that.

Gustavo

Jose Reyero’s picture

Status: Active » Closed (duplicate)

Ok, so it seems issue solved. Latest files have the proper plural header.

Augusto Ellacuriaga’s picture

We just updated from 6.x-1.x-dev to 6.x-1.3.tar for our site http://spanishtranslation.org/ and the plurals are working just fine. Thanks for the fix. Much appreciated.