I experienced some problems when using the translation form. There are some field display formatters that can break the translation form. E.g. the "commerce product add to cart" display formatter hijacks the complete form - if you try to save the translation the selected product is added to cart instead.
The media module shows a similar behaviour - but there the problem is more related to switching between field_attach_view and field_attach_view.

Atm. I don't know how the display of non translatable fields can be properly isolated to make sure it doesn't interfere with the actual translation form.
Any suggestions?

Comments

plach’s picture

Status: Needs work » Active

Honestly I did not think too much about this when I decided to display untranslatable fields as read-only values in the translation UI. I guess we could simply remove them to avoid further problems.

I thought having untranslatable fields values might help the user, who otherwise might ask himself why he's not seeing some fields on the translation UI, but that's only a guess. We might ask Bojhan's feedback about this.

Bojhan’s picture

I think its best to not display these, for a couple reasons :

1. We could be confusing/teasing the user with something thats not translatable, which is what they expected when they clicked on this link.
2. We are assuming that all the content displayed, is familiar to the user - where it could be themed very different in the front-end, making it not familiar at all.
3. We are assuming that this will all be related or needed to make proper translations, it might be displaying a whole lot of unrelated information that stretches the page very long.

plach’s picture

Ok, let's simply our life, then :)

plach’s picture

Status: Active » Needs review
StatusFileSize
new2.31 KB

Here is a patch removing the untranslatable fields from the translation form as per #2.

sun’s picture

Status: Needs review » Needs work

Something odd is going on here.

  1. Before this patch, the "Tags" taxonomy field in my Article content-type (not translatable) did not appear in the translation form.
  2. With this patch, the "Tags" field (still not translatable) appears in the translation form.
plach’s picture

StatusFileSize
new1.78 KB

Sorry, this one should work.

plach’s picture

Status: Needs work » Needs review
plach’s picture

Title: Translation form broken by some field display formatters. » Remove read-ony non translatable fields from the translation form

Better title

plach’s picture

Project: Content translation » Entity Translation
Version: 7.x-2.x-dev » 7.x-1.x-dev
das-peter’s picture

Thanks for the patch - I've just applied it. Looks good.

While playing around with the translation form I came across some saving / update issues.
I changed the saving code a little. But since I'm still working with the legacy translation module I can't create an appropriate patch atm.
The affected code is in here translation_edit_form_save_submit and looks now like this:

  $handler->setTranslation($translation, $form_state['values']);
  $form['#entity'] = (object) $form['#entity'];
  field_attach_form_validate($form['#entity_type'], $form['#entity'], $form, $form_state);
  entity_form_submit_build_entity($form['#entity_type'], $form['#entity'], $form, $form_state);
  field_attach_presave($form['#entity_type'], $form['#entity']);
  field_attach_update($form['#entity_type'], $form['#entity']);

  // Update URL alias.
  if (_translation_path_enabled($handler) && (user_access('create url aliases') || user_access('administer url aliases'))) {

I'll provide a patch and an extended description why I changed the code ;) asap.

plach’s picture

Status: Needs review » Fixed

The suggested changes are addressed in #1098106: Translated fields aren't validated (or processed with presave and submit field_attach_ hooks).

Committed #6 to HEAD. Thanks!

Status: Fixed » Closed (fixed)
Issue tags: -dcsprint5

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

  • Commit 51fc16f on master, et-permissions-1829630, factory, et-fc, revisions by plach:
    Issue #1032846 by plach, sun, das-peter: Removed read-ony non...

  • Commit 51fc16f on master, et-permissions-1829630, factory, et-fc, revisions, workbench by plach:
    Issue #1032846 by plach, sun, das-peter: Removed read-ony non...