Index: i18ntaxonomy/i18ntaxonomy.js =================================================================== --- i18ntaxonomy/i18ntaxonomy.js (revision 0) +++ i18ntaxonomy/i18ntaxonomy.js (revision 0) @@ -0,0 +1,16 @@ +Drupal.behaviors.i18ntaxonomy = function (context) { + if (Drupal.settings && Drupal.settings.i18ntaxonomy_vocabulary_form) { + $('form#taxonomy-form-vocabulary input.form-radio', context).filter('[name=i18nmode]').click(function () { + var languageSelect = $('form#taxonomy-form-vocabulary select#edit-language', context); + if ($(this).val() == Drupal.settings.i18ntaxonomy_vocabulary_form.I18N_TAXONOMY_LANGUAGE) { + // Make sure language form is enabled when I18N_TAXONOMY_LANGUAGE is clicked + languageSelect.removeAttr("disabled"); + } + else { + // Make sure language form is disabled otherwise and set to blank. + languageSelect.val(""); + languageSelect.attr("disabled", "disabled"); + } + }); + } +}; Index: i18ntaxonomy/i18ntaxonomy.module =================================================================== --- i18ntaxonomy/i18ntaxonomy.module (revision 22167) +++ i18ntaxonomy/i18ntaxonomy.module (working copy) @@ -347,6 +347,8 @@ $vocabulary = NULL; $mode = I18N_TAXONOMY_NONE; } + drupal_add_js(drupal_get_path('module', 'i18ntaxonomy') . '/i18ntaxonomy.js'); + drupal_add_js(array('i18ntaxonomy_vocabulary_form' => array('I18N_TAXONOMY_LANGUAGE' => I18N_TAXONOMY_LANGUAGE)), 'setting'); $form['i18n'] = array( '#type' => 'fieldset', '#title' => t('Multilingual options'), @@ -368,6 +370,7 @@ '#description' => t('Language for this vocabulary. If set, it will apply to all terms in this vocabulary.'), '#disabled' => ($vocabulary && $mode != I18N_TAXONOMY_LANGUAGE), ); + $form['#validate'][] = 'i18ntaxonomy_form_vocabulary_validate'; break; case 'taxonomy_form_term': // Taxonomy term @@ -433,6 +436,13 @@ } } +function i18ntaxonomy_form_vocabulary_validate($form, &$form_state) { + $language = isset($form_state['values']['language']) ? $form_state['values']['language'] : ''; + if ($form_state['values']['i18nmode'] != I18N_TAXONOMY_LANGUAGE && $language) { + form_set_error('language', t('Setting a vocabulary language only makes sense in the "Set language to vocabulary" translation mode. Either change to this mode or do not select a language.')); + } +} + /** * Localize a taxonomy_form_all() kind of control *