I wasn't able to enable any language when creating new content with entity translation.
When activating "Exclude Language neutral from the available languages" it gave an 'illegal choice' errorwhen saving a node.

After turning of the i18n multilingual content module everything seems to be o.k.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

plach’s picture

Version: 7.x-1.0-beta2 » 7.x-1.x-dev
Component: Base system » Documentation

ET and multilingual content are incompatible, we should make this clear.

plach’s picture

Title: Falling back to language neutral when i18n multilingual content module enabled » Clarify that Multilingual content (i18n) and ET are not compatible
Category: bug » task
plach’s picture

my-family’s picture

I can confirm this. Enabling this modules together >> the user is unable to save any node.

my-family’s picture

Priority: Normal » Critical

>> critical

plach’s picture

What about providing some documentation instead of arbitrarily raising the priority? I'm afraid this won't change the importance this issue has to my eyes :)

my-family’s picture

#6: Sorry, probably I don't get your message. I think i simply used the comment form possibilities, is it wrong? I forgot to change the priority, so I made it in the next step. I will help you with documentation if needed, of course. However, I did not know that I can contribute to the documentation of certain module if I don't maintain the module. Tell me please how can I help.

plach’s picture

The documentation pages should be editable by any logged user, I'd probably add some notes about this here: http://drupal.org/node/1280800.

drzraf’s picture

You mean incompatible per content-type isn't ?
Using i18n for a very variable content-type and ET for another, more homogeneous, one is still possible. Am I wrong ?

plach’s picture

Node translation and field translation for nodes are compatible. The Multilingual content submodule may filter node listings (and menu items) by node language, depending on its settings. This usually causes troubles to ET, but it depends on your use case.

plach’s picture

Priority: Critical » Normal
marktheshark’s picture

Problem is that multilingual content allows e.g. hiding the content translation links (which can be hidden from the content type itself though).

I'd also like to note that I have a views block in a panel on my front page that doesn't select the correct language. The page view on the other hand does...

I have both multilingual select and multilingual content disabled.

plach’s picture

Problem is that multilingual content allows e.g. hiding the content translation links.

I'm sorry but ET and Multilingual content are architecturally incompatible. There's nothing to do here. However also ET lets you hide the content translation links in the latest versions.

marktheshark’s picture

Thanks, I just edited my note above about the setting per content type.

Could you take a look at this front page?

The view slide show block in the front page panel shows 2 latest news items in the default language and the 3rd is in the non-default language, for no good reason...

Whereas on the News page (accessible from menu), the language selection is better.

Any ideas?

plach’s picture

Please, let's not derail this issue. If you are having troubles and they are not related to multilingual content let's repopen the issue we came from and clarify what's wrong and how to reproduce it.

marktheshark’s picture

OK, will post in more appropriate thread.

plach’s picture

Title: Clarify that Multilingual content (i18n) and ET are not compatible » Clarify that Multilingual select (i18n) and ET are not compatible

Sorry, guys, actually the incompatibility is with the Multilingual select module. See #2107219: How to translate content type names? for details.

kitikonti’s picture

Issue summary: View changes

No i have to disagree, i have enabled the Multiligual content (i18n_node) module and Multilingual select (i18n_select) is disabled. I just need the Multilingual content module to translate my content type.
With this configuration i get exactly the same error described in the issue summary:

When activating "Exclude Language neutral from the available languages" it gave an 'illegal choice' error when saving a node.

So what is the solution for this Problem? In my opinion this are two necessary features to create a multilingual site. So currently it is not possible to create a multilingual site with d7 and entity translation, or am i wrong?

baso’s picture

See #18 in https://www.drupal.org/node/1669494 for a possible workaround.

gagarine’s picture

Priority: Normal » Major

This is something than don't let you adding content. Major.

gagarine’s picture

Title: Clarify that Multilingual select (i18n) and ET are not compatible » Clarify that Multilingual Content (i18n_node) and ET are not compatible

The problem is with i18n_node not i18n_select

markus_petrux’s picture

We have seen this problem when a particular content type in Entity Translation is configured to "Exclude Language neutral from the available languages", but the Content Translation (i18n_node) option "Default language for content types with Multilingual support disabled" is configured as " Language neutral (Recommended)".

i18n_node should not apply that setting when the content type is configured with Multilingual support enabled, with entity translation. This code in i18n_node.module:

function _i18n_node_form_node_form_alter($form, &$form_state) {
  $node = $form['#node'];
  if (i18n_node_type_enabled($node)) {
    if (!empty($form['language']['#options'])) {
      $form['language']['#options'] = i18n_node_language_list($node, TRUE, TRUE);
    }
  }
  elseif (variable_get('i18n_node_default_language_none', 0) && !isset($form['#node']->nid)) {
    // Override locale module setting default language to nodes. It is already in form_state.
    $form['language']['#value'] = $form_state['values']['language'] = LANGUAGE_NONE;
  }

The elseif part should not be done when translations are managed by Entity Translation.

It looks like that's a bug in i18n_node module?

Cyclodex’s picture

I also debugged the state of language in the form. And of course it seems that ii18n is overriding the language field and sets UND as language which then makes validation fail for entity_translation.

I could solve my issues with adding an other check to i18n_node.module in _i18n_node_form_node_form_alter()

if (i18n_node_type_enabled($node)) {
    if (!empty($form['language']['#options'])) {
      $form['language']['#options'] = i18n_node_language_list($node, TRUE, TRUE);
    }
  }
  elseif (variable_get('i18n_node_default_language_none', 0) && !isset($form['#node']->nid)) {
    // Only do this if the language is really disabled
    if (variable_get('language_content_type_' . $node->type, 0) == 0) {
      // Override locale module setting default language to nodes. It is already in form_state.
      $form['language']['#value'] = $form_state['values']['language'] = LANGUAGE_NONE;
    }
  }

With entity_translation the IF statement will report "4" (ENTITY_TRANSLATION_ENABLED) and therefore not make the language override.

The question is, if entity_translation should change the language field after i18n_node or if the behaviour of i18n_node is wrong. For me it looks like they should not do the change if there is "any" language enabled. What they check does not take into account that there can be content types with translation mode = 4 (ENTITY_TRANSLATION_ENABLED)

rv0’s picture

@Cyclodex
Thanks for that fix!
@lmeurs, @Cyclodex
Re-opened the linked issue.. You should considering posting your change there as a patch.

srclarkx’s picture

Since I have to add this as a patch, I've included a patch. It may not follow the current patch conventions, but it follows the conventions for our site.

srclarkx’s picture

The patch is actually not to the entity translation module. I think I'll put the patch in https://www.drupal.org/node/1662884

stefanos.petrakis@gmail.com’s picture

Status: Active » Closed (outdated)

This problem has been resolved with the patch submitted in #1662884: i18n_node_type_enabled is incompatible with Entity Translation (field translation) type, which means that i18n_node > 1.14 is what is needed to avoid it.

For reference:
As described in #1852102-22: Clarify that Multilingual Content (i18n_node) and ET are not compatible (thanks a lot @markus_petrux),
you need a version of i18n 1.14 (or earlier) and the following configuration:

  • Entity Translation: Exclude "Language neutral" for a specific content type
  • Multilingual content (i18n_node): under admin/config/regional/i18n/node, set "Default language for content types with Multilingual support disabled." to "Language neutral (Recommended)."

Once Drupal is configured like this, try to add a node for a content type that has "Multilingual support" > Enabled, with field translation. You should get the error "An illegal choice has been detected. Please contact the site administrator." at that point.