diff --git modules/locale/locale.module modules/locale/locale.module index 9c3ae36..64f4899 100644 --- modules/locale/locale.module +++ modules/locale/locale.module @@ -382,6 +382,13 @@ function locale_form_node_type_form_alter(&$form, &$form_state) { '#options' => array(t('Disabled'), t('Enabled')), '#description' => t('Enable multilingual support for this content type. If enabled, a language selection field will be added to the editing form, allowing you to select from one of the enabled languages. If disabled, new posts are saved with the default language. Existing content will not be affected by changing this option.', array('!languages' => url('admin/config/regional/language'))), ); + $form['workflow']['language_content_type_neutral'] = array( + '#type' => 'radios', + '#title' => t('Language default'), + '#default_value' => variable_get('language_content_type_neutral_' . $form['#node_type']->type, 1), + '#options' => array(t('Site default'), t('Neutral')), + '#description' => t('If site default, the node will default to the language that is default for the site. If neutral, the node will default to have no specific language. This setting is independent of the multilingual support.'), + ); } } @@ -410,20 +417,28 @@ function locale_form_alter(&$form, &$form_state, $form_id) { } } if (isset($form['#id']) && $form['#id'] == 'node-form') { + if (isset($form['#node']->nid) && isset($form['#node']->language)) { + $default = $form['#node']->language; + } + elseif (variable_get('language_content_type_neutral_' . $form['#node']->type, 1) == 1) { + $default = ''; + } + else { + $default = language_default()->language; + } if (isset($form['#node']->type) && locale_multilingual_node_type($form['#node']->type)) { $form['language'] = array( '#type' => 'select', '#title' => t('Language'), - '#default_value' => (isset($form['#node']->language) ? $form['#node']->language : ''), + '#default_value' => $default, '#options' => array('' => t('Language neutral')) + locale_language_list('name'), ); } // 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 + '#value' => $default, ); } $form['#submit'][] = 'locale_field_node_form_submit';