Closed (fixed)
Project:
Recipe
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
28 Aug 2011 at 20:35 UTC
Updated:
4 Oct 2017 at 20:00 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
thepanz commentedI think that i18nsync should take care of it... (my 2 cents)
Comment #2
pacproduct commentedI think vadzen was just talking about default values (coming from the source node) that are filling the form when creating a new translation. I'm experiencing the same issue: It seems that extra fields (added with hook_field_extra_fields) are not copied like the others. So they are empty when creating a translation.
Though, I'm not sure if this is a Recipe issue, or a i18n issue?
(Looks like someone has a similar problem with Drupal 6: http://drupal.org/node/1174724)
Comment #3
pacproduct commentedAfter some digging, I think "recipe" is the one to be patched, as it seems to manage its custom fields its own way.
Here is a patch specifically addressing this lack of default values when adding a new translation to a recipe node.
Comment #4
alpp commentedi added the patch but i still have an empty translation page.
also, it would be too good if we could translate the ingredients, like any taxonomy term. that would speed up the translations (simply by not having to translate Tomatoes for a thousand times, but just once).
Comment #5
jgtrescazes commentedAfter applying this patch form is filled, but after validation ingredients are not saved on the translated node and are updated on the source node.
To avoid this, I just add a few lines on your patch that broke relation between node id and ingredient to force module to link ingredients to the new translated node.
Comment #6
gabriel. commentedI've created a patch that copies the source translation fields to new translations.
Comment #7
dcam commentedIt will need to be re-tested against 7.x-1.x-dev.
Comment #9
dcam commented#6: recipe-copy_source_values_to_translations-1262704.patch queued for re-testing.
Comment #11
gabriel. commentedRecreated above patch against 7.x-1.x-dev
Comment #12
gabriel. commentedComment #13
gabriel. commented[updated patch] Assign values to
$nodeto harden prepopulation of fields when translating.Comment #14
dcam commentedAfter taking a look at the previous patches I've decided that I prefer to do this in a hook_node_prepare() implementation rather than adding an additional responsibility to recipe_form(). Content Translation also inserts the source's title with its hook_node_prepare() implementation, so I'll take that as being a best practice. The catch is that our hook has to run after the Content Translation module's hook so that the translation source node's data will be added to the $node object. Hence the implementation of hook_module_implements_alter().
Comment #15
dcam commentedI wrote a test for it.
Comment #18
dcam commentedThank you to everyone who contributed to this patch.