You are here

function i18n_taxonomy_taxonomy_vocabulary_update in Internationalization 7

Implements hook_taxonomy_vocabulary_update()

1 call to i18n_taxonomy_taxonomy_vocabulary_update()
i18n_taxonomy_taxonomy_vocabulary_insert in i18n_taxonomy/i18n_taxonomy.module
Implements hook_taxonomy_vocabulary_insert()

File

i18n_taxonomy/i18n_taxonomy.module, line 648
i18n taxonomy module

Code

function i18n_taxonomy_taxonomy_vocabulary_update($vocabulary) {

  // Update language for related terms
  switch (i18n_taxonomy_vocabulary_mode($vocabulary)) {
    case I18N_MODE_LANGUAGE:
      $update['language'] = $vocabulary->language;
      break;
    case I18N_MODE_NONE:
      $update['language'] = LANGUAGE_NONE;
      break;
  }
  if (isset($update)) {
    db_update('taxonomy_term_data')
      ->fields($update)
      ->condition('vid', $vocabulary->vid)
      ->execute();
    drupal_set_message(t('Reset language for all terms.'));
  }

  // Update strings, always add translation if no language
  if (!i18n_object_langcode($vocabulary)) {
    i18n_string_object_update('taxonomy_vocabulary', $vocabulary);
  }
}