_locale_string_edit_submit
includes/locale.inc, строка 421
- Версии
- 5
_locale_string_edit_submit($form_id, $form_values)
Process string editing form submissions. Saves all translations of one string submitted from a form.
Код
<?php
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';
}
?>
Войдите или зарегистрируйтесь, чтобы получить возможность отправлять комментарии