function i18ntaxonomy_update_1 in Internationalization 6
Drupal 6 update.
Move i18n vocabulary options to new variables.
File
- i18ntaxonomy/
i18ntaxonomy.install, line 59 - Installation file for i18ntaxonomy module.
Code
function i18ntaxonomy_update_1() {
$items = array();
$options = variable_get('i18ntaxonomy_vocabulary', array());
$translate = variable_get('i18ntaxonomy_vocabularies', array());
foreach (taxonomy_get_vocabularies() as $vid => $vocabulary) {
if ($vocabulary->language) {
$options[$vid] = I18N_TAXONOMY_LANGUAGE;
}
elseif (isset($translate[$vid]) && $translate[$vid]) {
$options[$vid] = I18N_TAXONOMY_LOCALIZE;
}
else {
// Search for terms with language.
$count = db_result(db_query("SELECT COUNT(language) FROM {term_data} WHERE vid = %d AND NOT language = ''", $vid));
if ($count) {
$options[$vid] = I18N_TAXONOMY_TRANSLATE;
}
elseif (!isset($options[$vid])) {
$options[$vid] = I18N_TAXONOMY_NONE;
}
}
}
variable_set('i18ntaxonomy_vocabulary', $options);
drupal_set_message(t('The multilingual vocabulary settings have been updated. Please review them in the <a href="@taxonomy_admin page">taxonomy administration</a>.', array(
'@taxonomy_admin' => url('admin/content/taxonomy'),
)));
// @ TODO Update strings in localization tables.
return $items;
}