Download & Extend

Duplicate entry 'xxx' for key 'PRIMARY'

Project:Translation table
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:reviewed & tested by the community

Issue Summary

Hi, I'm using the translation table to localize CCK labels and taxonomy terms.
It is a very useful module !
There is only an annoying issue when saving a page which contains already translated strings.

For example, I go a first time to the /admin/build/translate/table/cck page to translate certain labels: after populating all the fields, I press the Save button.
Then other CCK fields are created, so I have to return there to translate the new labels.
The already translated strings are populated, so it is very easy to individuate those new to localize.

Then I populate the empty fields and press the Save button but a message like the following pops up:

user warning: Duplicate entry 'en-9798-0' for key 'PRIMARY' query: INSERT INTO locales_target (lid, language, translation) VALUES (9798, 'en', 'Package quantity') in ...\sites\all\modules\translation_table\includes\admin.inc on line 95.

It's not a show stopper since the new translations are evenly saved, but it would be better to have a merge approach: insert the new strings or update those already there only if different.

Comments

#1

subscribe

#2

Status:active» reviewed & tested by the community

Please accept the attached patch which resolves this bug. Similar to the variable_set() function, the INSERT query must be prepended with @ due to platform variability.

AttachmentSize
admin.inc_.diff 626 bytes

#3

Hi, I have tested this patch on Drupal 6.22 + translation_table 6.x-1.4 and I can confirm that this removes the warnings and resolves the issue. Can this be committed? Thank you.

#4

#2 worked for me also.

nobody click here