You are here

function _locale_string_edit_submit in Drupal 5

Same name and namespace in other branches
  1. 4 includes/locale.inc \_locale_string_edit_submit()

Process string editing form submissions. Saves all translations of one string submitted from a form.

1 call to _locale_string_edit_submit()
locale_admin_string_edit_submit in modules/locale/locale.module
Process the string edit form.

File

includes/locale.inc, line 448
Admin-related functions for locale.module.

Code

function _locale_string_edit_submit($form_id, $form_values) {
  $lid = $form_values['lid'];
  foreach ($form_values['translations'] as $key => $value) {
    $trans = db_fetch_object(db_query("SELECT translation FROM {locales_target} WHERE lid = %d AND locale = '%s'", $lid, $key));
    if (isset($trans->translation)) {
      db_query("UPDATE {locales_target} SET translation = '%s' WHERE lid = %d AND locale = '%s'", $value, $lid, $key);
    }
    else {
      db_query("INSERT INTO {locales_target} (lid, translation, locale) VALUES (%d, '%s', '%s')", $lid, $value, $key);
    }
  }
  drupal_set_message(t('The string has been saved.'));

  // Refresh the locale cache.
  locale_refresh_cache();

  // Rebuild the menu, strings may have changed.
  menu_rebuild();
  return 'admin/settings/locale/string/search';
}