Hi there,
I have a very nasty bug where when you have syncing of some fields enabled the "create translation" link doesn't save (the translation tab remains empty after saving the translated node). When checking the database in i18n_node I can see the trid is set for the translated item, but the trid for the default language is 0 and I guess that's why they don't match up.
Some further research with the sql logs from the dev module show that if no syncing fields are selected the following happens (1459 is the nid of the english source node):
18n_nodeapi DELETE FROM i18n_node WHERE nid=1464
i18n_nodeapi INSERT INTO i18n_node (nid, trid, language, status) VALUES(1464, '0', 'fr', '2')
translation_nodeapi UPDATE i18n_node SET trid = 669 WHERE nid=1464 OR nid=1459
which is fine, when syncing is enabled the order of these calls change and the following happens (in this order):
translation_nodeapi UPDATE i18n_node SET trid = 670 WHERE nid=1467 OR nid=1459
i18n_nodeapi DELETE FROM i18n_node WHERE nid=1459
i18n_nodeapi INSERT INTO i18n_node (nid, trid, language, status) VALUES(1459, '0', 'en', '0')
where the translation id for the english source node gets set to 0.
Any suggestions on how to work around this (or is this intended).
Tnx,
HnLn
P.S.: these issues seem related, but not sure if it's the same thing:
http://drupal.org/node/306340 & http://drupal.org/node/361625
Comments
Comment #1
Raverken commentedI have exactly the same problem.
Does anyone have ideas?
Comment #2
pkej commentedThe problem, as I noted in my last attach to http://drupal.org/node/361625, is that the translation thingamajiggies, don't happen in the node table.
The node table has:
nid, title, trid, language, ...
We have the following existing node:
22, English stuff here, 0, en
Then we try to translate by adding a norwegian node, and we get:
23, Norwegian stuff here, 22, nb
The thing is that the resulting table should actually look like this:
22, English stuff here, 22, en
23, Norwegian stuff here, 22, nb
But the original entry isn't altered. I don't actually think you have to care about i18n_node in this. Just updating node table should fix the translation in the translate tab of the node.
a quick workaround for now is to manually change the node table entry for the original node which doesn't get updated
The issue description is excellent, by the way, HnLn.
Comment #3
hnln commentedI need this for a big site so manually updating is no option. If you think you have the same issue in drupal 6, my fix was to use nodeapi to set the trid = nid if trid was 0 (since in 6 it's in the node table, unfortunately 5 has a different trid system).
I don't have the time to dig deeper then above, but it only happens when syncing fields is enabled and my guess is that in i18n_nodeapi following lines are applied when updating the source node for syncing and thus overwriting the initially stored trid.
case 'insert':
case 'update':
db_query("DELETE FROM {i18n_node} WHERE nid=%d",$node->nid);
HnLn
Comment #4
smh67 commentedHello.
I am not sure if this is the same problem, but it reads as if it might be. Please see my post #367118: Translation relationship broken with i18nsync and try if the proposed solution (changing one line of code in the i18nsync.module) works for you. And please report back :)
Comment #5
hnln commentedVery nice catch :-) !!!
and it fixed it for me (in 5.x-3.x).
That's what I thought what was going on here:
i18n_nodeapi INSERT INTO i18n_node (nid, trid, language, status) VALUES(1459, '0', 'en', '0')
Where indeed the node doesn't use the just updated trid.
FYI, the line in 5.x-3.x-dev is line 139 and changing it to your suggestion keeps the translation link intact.
I guess it's up to developers to pick up on this and patch ? (I'm not yet familiar enough with the whole cvs system).
HnLn
Comment #6
pkej commentedFixed it for me as well, I'm changing the status to reviewed and tested so that the developers might pick this up :).
Comment #7
Bevan commentedComment #8
Bevan commented#367118: Translation relationship broken with i18nsync needs to be backported.
Duplicates:
#306340: The translation doesn't save!!!
#361625: Translation nodes are lost if interface language == language translated to
#302979: the node translation relationship not be saved when translated a node
Comment #9
R.Hendel commentedDeprecated - D5 is no longer supported.