Link to node retrieves all languages in the system, including those not enabled. If a node has a language not enabled this language is still set.
This isn't so odd. It occurs when you have translation set to 'Enabled, with translation' (you can translate to not enabled languages - the translated node links to the translation just fine). It will also happen if you disable a language.
Core doesn't mind about this but doesn't detect language codes not enabled in paths (paths are always just node/1234 for them).

Attached a patch that just uses enabled languages, leaving the rest to default (as happens elsewhere).

Comments

ekes’s picture

Title: 'Link to node' adds language for all nodes defined by their langugage including those not presently enabled » language_url_rewrite() creates 404 paths with url() when passed a language in $options that is not enabled.
Project: Views (for Drupal 7) » Drupal core
Version: 6.x-2.x-dev » 6.x-dev
Component: Code » language system
StatusFileSize
new980 bytes

On further investigation I found this fixed with Views 3 and Drupal 7 - with the same code in views. The issue is with core, and is fixed in 7.

locale_language_url_rewrite_url() [D7] does a check to make sure that the language is enabled; language_url_rewrite() [D6] doesn't. I've ported back a bit of code from one to the other to stop url() creating invalid paths.

Status: Needs review » Needs work

The last submitted patch, 105620-1-language.inc_.patch, failed testing.

ekes’s picture

ekes’s picture

Status: Needs work » Needs review

Status: Needs review » Closed (outdated)

Automatically closed because Drupal 6 is no longer supported. If the issue verifiably applies to later versions, please reopen with details and update the version.