Comments

thepanz’s picture

I think that i18nsync should take care of it... (my 2 cents)

pacproduct’s picture

Version: 7.x-1.1 » 7.x-1.2

I 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)

pacproduct’s picture

Status: Active » Needs review
StatusFileSize
new2.15 KB

After 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.

alpp’s picture

i 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).

jgtrescazes’s picture

After 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.

+    // Remove relation between node and ingredient as they are linked to source node
+    // without this, ingredients would be updated on source node and not created for translation node
+    foreach($node->recipe_ingredients['ing'] as $key => &$ingredient) {
+      if ($ingredient['ri_id']) {
+        $ingredient['ri_id'] = NULL;
+      }
+    }
gabriel.’s picture

Version: 7.x-1.2 » 7.x-1.3
StatusFileSize
new1.84 KB

I've created a patch that copies the source translation fields to new translations.

dcam’s picture

Version: 7.x-1.3 » 7.x-1.x-dev

It will need to be re-tested against 7.x-1.x-dev.

Status: Needs review » Needs work

The last submitted patch, recipe-copy_source_values_to_translations-1262704.patch, failed testing.

dcam’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, recipe-copy_source_values_to_translations-1262704.patch, failed testing.

gabriel.’s picture

Recreated above patch against 7.x-1.x-dev

gabriel.’s picture

Status: Needs work » Needs review
gabriel.’s picture

[updated patch] Assign values to $node to harden prepopulation of fields when translating.

dcam’s picture

Title: Copying ingredients, notes, descriptions and instruction to translate page. » Copy recipe data to translation node forms
Category: Feature request » Task
Issue summary: View changes
StatusFileSize
new2.04 KB

After 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().

dcam’s picture

StatusFileSize
new7.13 KB
new9.17 KB

I wrote a test for it.

The last submitted patch, 15: 1262704-15-tests-only.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

  • dcam committed 3e09314 on 7.x-1.x
    Issue #1262704 by gabriel., dcam, pacproduct, jgtrescazes: Copy recipe...
dcam’s picture

Status: Needs review » Fixed

Thank you to everyone who contributed to this patch.

Status: Fixed » Closed (fixed)

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