Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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
Comment #1
markus_petrux CreditAttribution: markus_petrux commentedI 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?
Comment #2
tomsm CreditAttribution: tomsm commentedNo, 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.
Comment #3
tomsm CreditAttribution: tomsm commentedSorry, 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.
Comment #4
markus_petrux CreditAttribution: markus_petrux commentedhmm... 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.
Comment #5
tomsm CreditAttribution: tomsm commentedYou 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.
Comment #6
tomsm CreditAttribution: tomsm commentedI 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.
Comment #7
markus_petrux CreditAttribution: markus_petrux commentedOk, 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:
If the i18n is installed, but the "Switch interface for translating" option is not enabled, then the following warning will be rendered:
This has been committed to CVS. Also, I have added a note in the project page.
Thank you very much for pointing this out!
Comment #8
tomsm CreditAttribution: tomsm commentedMy 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.
Comment #10
Bensbury CreditAttribution: Bensbury commentedThis 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?
Comment #11
rp7 CreditAttribution: rp7 commentedI 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.