I have set my i18n languages options so that the interface and node language can be changed independently.

Since I installed node translationship the references shown in the autocomplete text field, are in the interface language, not the node language.

The "noderef" view shows the nodes in all languages. I have added the i18n negotiation filter, but then only the interface language is selected.

The only solution I have for the moment is to enable the multilingual option:
"Switch interface for translating"

Comments

markus_petrux’s picture

I think the queries behind the autocomplete widget of the node reference field are filtered by interface language (based on language selection rules defined to i18n module), so the translation of node references tries to match the same behavior, otherwise the node reference module will complain because of invalid node referenced in field. And yes, I think this also requires us to enable the "Switch interface for translating" option (and enable the i18n negotiation filter to noderef views) so that all layers are in sync.

I'm tempted to say "by design" and document this behavior in the README as well as the project page. Is there any problem with this approach?

tomsm’s picture

No, I do not have any problem with this approach. Maybe i18n should enable the "switch interface for translating" option by default or just remove it?

Before I installed node relationships the autocomplete widget did filter by node language instead of interface language.
So, I only wanted to report this issue.

tomsm’s picture

Sorry, I need to correct my previous posts.

The autocomplete widget language behavior changed since I installed CCK 6.x-3.x-dev.
I also added my node reference fields to multigroup fields.

With CCK 6.x-2.x-dev it was as I described in my first post.

markus_petrux’s picture

hmm... CCK3 does not change anything related to node reference compared to CCK2.

Also Node Relationships module (NR) does not alter the behavior of the queries executed with the autocomplete widget.

For reference: the translate and reference feature in NR was implemented behind the following issue: #514956: Add an option to "Translate and reference"; the code can be found in noderelationships.translation.inc.

tomsm’s picture

You are right.
I have restored a backup with CCK2 and it has the same behavior as CCK3. I am looking what module update caused this change, probably i18n.

Sorry for the wrong information. I will report back if I find the cause.

tomsm’s picture

I have found the reason, and it is the same for CCK2 and CCK3.

There is a different behavior if the translation already exists or not.

If the translation does not exist, the node reference widget shows node titles in the node's language, no matter what interface language is selected.

If the translation already exists, and I edit it again, the node references are shown in the interface language.

I never noticed this because I always added new translations. But when I tested node relationships for the first time, I reopened an already translated node.

The only solution is to check the "switch interface for translating" option.

markus_petrux’s picture

Status: Active » Fixed

Ok, I have added a check for i18n module in the "Node reference extras" tab for content types.

If the translation module is installed, but the i18n module is not, the following warning will be rendered on top of the page:

It is recommended to install the Internationalization module in order to take full advantage of the "Translate and reference" feature.

If the i18n is installed, but the "Switch interface for translating" option is not enabled, then the following warning will be rendered:

It is recommended to enable the "Switch interface for translating" option in the <em>Multilingual system settings</em> page for the "Translate and reference" feature to work properly.

This has been committed to CVS. Also, I have added a note in the project page.

Thank you very much for pointing this out!

tomsm’s picture

My pleasure.

Maybe this issue applies more to "CCK" then to "Node Relationships"?
I have noticed the issue (see #6) when I was working with CCK only. The Node Relationships module was not installed.

So I think that this warning should also be added to CCK.

Status: Fixed » Closed (fixed)

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

Bensbury’s picture

This needs re-opening.
It definitely applies to CCK and needs a warning or fixed.

Only by finding this thread did I recover from a huge sense of doom as the node reference autocomplete field failed to locate the translated nodes!

Is it possible for node reference to recognise the language of the node it is on and not the language of the page?

rp7’s picture

I have to agree with Bensbury. I'd like to refer to a issue created in the i18n project: #314721: Node reference: results returned for interface language rather than node language .

This is making translating nodes with Node Reference fields using the autocomplete field a huge pain.