When creating a node and translating it the cache for the original node doesn't get reset. So both the translate tab shows a add translation link in the translate tab on the original node.
In the cache the node doesn't have a tnid so it shows the add translation link instead of the translated node.
To reproduce:
1. Enable entity cache
2. Enable i18n and set a node type to be multilanguage with translations
3. Have 2 enabled languages
4. Create a node in language 1
5. Translate that node through translate tab
6. Go to the translate tab on the original node(Langauge 1). It will show a "add translation" link even though there is a translation in the db and you can't create a translation.
7. Clear cache and see the "add translation" link disappear.
Comments
Comment #1
david.gil CreditAttribution: david.gil commentedsame here!
Comment #2
webflo CreditAttribution: webflo commentedTagging.
Comment #3
webflo CreditAttribution: webflo commentedCannot reproduce with the latest version of i18n. Please update to i18n-7.x-1.3.
Comment #4
webflo CreditAttribution: webflo commentedOhh no. You are right. There are some issues. I am working on it.
Comment #5
webflo CreditAttribution: webflo commentedPlease review the patch in #1405234: Implement update hooks for node translation sets. Clean-up node translation sets..
Comment #6
david.gil CreditAttribution: david.gil commentedHi, Any advance with this, i cannot figure what to do to enable entity cache with i18n active. if you give me some orientation i can try to solve it...
Best
David
Comment #7
drasgardian CreditAttribution: drasgardian commentedThat patch does appear to solve this issue for me. Although from the look of the #1405234: Implement update hooks for node translation sets. Clean-up node translation sets. thread it doesn't sound like it will be the final solution.
edit - actually I was mistaken, that patch didn't solve it at all.
Comment #8
drasgardian CreditAttribution: drasgardian commentedI had success with this patch: http://drupal.org/node/1463402#comment-6137776
Comment #9
DamienMcKennaIs #1851430: cache per language related?
Comment #10
drasgardian CreditAttribution: drasgardian commentedNot really. This issue relates to traditional node translation, whereas #1851430: cache per language relates to translations within a single node, i.e. using the entity_translation module.
Comment #11
Devin Carlson CreditAttribution: Devin Carlson commentedMarked #1591570: Link to translated node doesn’t work, #1463402: Translating nodes duplicates content, not linked and #2060407: Core content translation not working as duplicates.
Comment #12
Devin Carlson CreditAttribution: Devin Carlson commentedI ran into this while investigating #2070127: Source translated wiki page is not connected to translated pages. The issue can be demonstrated by running the core Translation module's test cases with Entity Cache enabled.
I believe the solution would be to force the translation information to be added on each request, à la
book_node_load()
inbook_entitycache_node_load()
, to avoid expensive cache clearing in order to get "accurate" translation information.Comment #14
Devin Carlson CreditAttribution: Devin Carlson commentedComment #15
lmeurs CreditAttribution: lmeurs commented@Devin Carlson: I just manually added the
translation_entitycache_node_load()
implementation from #12 and it works for me so far!Comment #16
operations CreditAttribution: operations commentedPatch #13 translation_entitycache_node_load() works for me also..
Comment #17
Pomliane CreditAttribution: Pomliane commentedWorks well here too. Thanks @Devin Carlson.
Comment #18
lex0r CreditAttribution: lex0r commentedHi guys,
what about not doing extra queries each time node is loaded from cache? I will post a solution soon. The idea is to clear entity cache when entity is translated. We do it once and then there's no need to query database each time - PROFIT :)
Comment #19
lex0r CreditAttribution: lex0r commentedHere is a patch that evades doing unnecessary selects each time a node is loaded from cache (slightly better performance than #12).
Comment #20
lex0r CreditAttribution: lex0r commentedSorry, didn't figure it out how to add comments and files :)
Comment #23
jrbeemanRe-roll patch from #12 against latest 7.x-1.x-dev
Comment #24
lex0r CreditAttribution: lex0r commented@jrbeeman, you didn't like SQL-less solution from #20?
Comment #25
sebdec CreditAttribution: sebdec commentedthe patch in #23 works whith the node translations (tnid), thanks!
whe have the same problem with the terms translations and the field tsid
Comment #26
maggie_s CreditAttribution: maggie_s commentedI have the same problem and I don't have Entity Cache enabled.
Drupal 7.25
Comment #27
Cyclodex CreditAttribution: Cyclodex commentedWe also have the same issue, on our latest projects, but don't have entity cache enabled. So the bug could be somewhere else so it looks... Lets see if we can find out something, but nobody has an idea yet about that?
We probably should make a separate ticket which does show how to reproduce the problem without entity cache...
Comment #28
Cyclodex CreditAttribution: Cyclodex commentedFor those who don't use "entity cache" module and are having this issue:
Looks like I found the issue, please see this ticket here which solves the problem for me.
See comment 24 which has the patch (and seems to be in the current dev release of i18n).
This, or my issue, also had nothing to do with the "entity cache" module. (not using it)
Comment #29
torotil CreditAttribution: torotil commentedI'd prefer the solution from #20, because it doesn't slow-down node loads. Any idea why the test fails?
Comment #30
hefox CreditAttribution: hefox commented#1932954: Source node missing added translation
Looking for a core bug report because this /is/ a core bug
It updates the node table in translation but never resets the cache for that node.
Comment #31
hefox CreditAttribution: hefox commentedFound it #1936942: translation_node_insert() updates the node table directly without also flushing the entity load cache
Comment #32
hefox CreditAttribution: hefox commentedCan anyone review the core issue?
Comment #33
jweowu CreditAttribution: jweowu commentedn.b. That core patch (#1936942: translation_node_insert() updates the node table directly without also flushing the entity load cache) has now been committed.
Comment #35
Devin Carlson CreditAttribution: Devin Carlson commentedThe tests-only patch from #12 now passes, confirming that this was fixed by #1936942: translation_node_insert() updates the node table directly without also flushing the entity load cache.
Re-attaching the tests-only patch from #12 as it would be great to have test coverage for translations but the bug itself is now fixed in Drupal 7 HEAD.
Comment #36
Devin Carlson CreditAttribution: Devin Carlson commentedRetitling issue and lowering priority to accurately reflect the remaining task.
Comment #37
catchCommitted/pushed to 7.x-1.x, thanks!