when a multilingual support is disabled for given node type, then a saved node should not have language set in {node} nor in {url_alias} table, it should be saved with language = NULL

the problem is that some links will not show the url alias but shows the internal link, because the url alias does not exists for the actual language.. so I have to change the language manually for these nodes..

#14 locale.module.patch870 bytesmrbuom
#2 311158_node_language.patch1.48 KBPasqualle
Unable to apply patch 311158_node_language.patch
[ View ]


the problem is in locale_form_alter() function with this code snippet

        // Node type without language selector: assign the default for new nodes
        elseif (!isset($form['#node']->nid)) {
          $default = language_default();
          $form['language'] = array(
            '#type' => 'value',
            '#value' => $default->language

Version:6.x-dev» 7.x-dev
Status:Active» Needs review
new1.48 KB
Unable to apply patch 311158_node_language.patch
[ View ]

also changed the default language for multilingual nodes, because that should not default to Language neutral.

Status:Needs review» Needs work

The patch doesn't work for me, it still sets the language selector to "Language neutral".
When the locale_form_alter is called $form['#node']->language is set to an empty string.

Maybe change:

'#default_value' => (isset($form['#node']->language) ? $form['#node']->language : $default->language),


'#default_value' => (isset($form['#node']->language) && $form['#node']->language != '' ? $form['#node']->language : $default->language),

When the locale_form_alter is called $form['#node']->language is set to an empty string.

I see, that is a problem.

But I think your modification changes the node language even when you edit it, not only at node creation. Can you confirm that when you open a node for edit which is "Language neutral", it changes to default language automatically? That should be wrong also..

you are right - my modification wont work when you edit a node that is "Language neutral".

Maybe it would be better to just see if we are editing a node then and set the default language only if it is a new node.

We can check for the nid:

'#default_value' => (isset($form['#node']->nid) ? $form['#node']->language : $default->language),

that smells like a little hack to me :) The code should be easily readable. You are mixing two things here, at least it should be changed to an if statement with an explanation written in the code comment.

note: the isset($form['#node']->language) is used to avoid php notices, and possible problems. (although I do not know now, how could that isset() return false)

but the good solution would be to not set the node language outside the locale module. I do not understand why it is set to an empty string.

Title:language is set for non multilingual nodedefault node language
Component:path.module» locale.module

It looks like it is being set in the node module, node.pages.inc, function node_add

    $node = array('uid' => $user->uid, 'name' => (isset($user->name) ? $user->name : ''), 'type' => $type, 'language' => '');

Issue tags:+i18n sprint


the node.module uses the node language property, and it would be hard to remove. So I am fine with the isset($form['#node']->nid) check, just the code needs to be more readable..

new870 bytes

I am looking for something similar. I have made a vocabulary with language specific terms. This vocabulary is used in my forum. That way I have have a multi lingual forum because the forum page will only show the terms in the current site language. That is working perfectly. My issue is that the forum posts are posted language neutral and not in the current site language. Has anyone found a solution for that? I am using D6.12

Mrbuom's patch (#14) works perfectly, thanks!

#14: awesome, thanx

#14 worked fine for me on D6.14 too.
A pity core has to be hacked and this fixed has not been included in core over the last few months..

There is also a thread on removing "Language neutral", that was also needed for my multi-language form site, perhaps it interests other readers: http://drupal.org/node/250891