node_save does not save language I cannot programmatically create a node in anything other than en language.

My site has 3 languages:


en
fr
de


And the code for creating a node is:

define('DRUPAL_ROOT', ...); 
require_once DRUPAL_ROOT . 'includes/bootstrap.inc'; 
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); 

$node = new stdClass();
$node-&gt;type = "foobar";
node_object_prepare($node);
$node-&gt;title = 'test title';
$node-&gt;uid = 1;
$node-&gt;language = 'fr'; // *** this doesn't seem to work

if ($node = node_submit($node)) {
  node_save($node);
}


No matter what I type in the $node-&gt;language = '...'; the result is always the same. The node is created in the English language. I confirm that via looking at admin/content.

I've even tried stuffing this variable with a proper language object which I got out of the enabled languages of my site:

$languages = language_list('enabled');
$lang = $languages[1]['de'];
$node-&gt;language = $lang;
The behavior was an unfortunate side-effect of the admin_language module and the setting Force use of default language.

The "offending" code is at http://drupalcode.org/project/admin_language.git/blob/0167e36c45661502ee6907a5b2b7cad8538b19cf:/admin_language.module#l112

Disabling this options solves the issue.