I have a site with CCK and i18n. Some of my node types have node reference fields in them. My i18n settings are set to "All content. No language conditions apply". When I go to translate a node from English to French for example, when I submit the form, I get the following error: "Featured media pick 1 : This post can't be referenced" Basically my new FR node is trying to reference EN nodes. Node reference fields are doing a validate check which i18n modifies the SQL for:

Line 452 nodereference.module

$result = db_queryd(db_rewrite_sql("SELECT n.nid, n.title AS node_title, n.type AS node_type FROM {node} n WHERE ". $related_clause ." ORDER BY n.title, n.type"), $args);

i18n overwrites this with i18n_db_rewrite_sql(), calling i18n_db_rewrite_where() with $mode = translate. Here, even though I've explicitly set i18n to use all content, it's still forcing language content:

    case 'translation':
      return "$alias.language ='".i18n_selection_mode('params')."' OR $alias.language ='' OR $alias.language IS NULL" ;

I guess I'm unclear on why translation options should be a different case than what was set in the admin settings- at the very least shouldn't this check variable_get('i18n_selection_mode', 'simple') to see if it should use languages should be checked? I'd be happy to offer a patch, but I'm guessing you're trying to accomplish something that I'm not quite catching

Comments

jose reyero’s picture

Yeah, you're right, it shouldn't switch to 'translation' mode if mode is previously set to all languages. This is done in translation_menu() hook.
The idea for this is that when you are translating a node, it should select content for that node language whatever the main interface language is.

So yes, I'd be happy to apply such a patch.

In the meanwhile, maybe this workaround may be some use:
- Set the nodereference field to select nodes from a view
- On that view, with i18n_views module, set the filter "Internationalization: Selection = All content. No language conditions apply".

zeropaper’s picture

Issue tags: +autocomplete, +nodereference

I'm also experiencing incoherences (with CCK 6.x-2.6 and i18n 6.x-1.2) between the autocomplete potential reference able nodes and the validation.
The i18n_selection_mode variable is set to "mixed".

I don't know exactly if this should be a new issue (as this own is for Drupal 5.x).

To try to fix that, I made a kind of copy of the nodereference_autocomplete function (passing the "parent" node language too), set the $language within a hook_init().

I'm clueless...

Obviously, this isn't a nodereference issue.

jose reyero’s picture

Status: Active » Closed (won't fix)

Won't fix for 5.x

There are many other open 6.x issues with nodereference and other fields...