- Patch #11312 by killes: fixed problems with menu caching.

4.5.x
Dries Buytaert 2004-10-06 12:18:03 +00:00
parent 9a8cd6a2e7
commit 905d530abd
1 changed files with 14 additions and 7 deletions

View File

@ -254,8 +254,12 @@ function _locale_import_po($file, $lang, $mode) {
} }
// Successfull import // Successfull import
// rebuild locale cache
cache_clear_all("locale:$lang"); cache_clear_all("locale:$lang");
// rebuild the menu, strings may have changed
menu_rebuild(); menu_rebuild();
drupal_set_message(t('Translation successfully imported. %number translated strings added to language, %update strings updated.', array('%number' => $additions, '%update' => $updates))); drupal_set_message(t('Translation successfully imported. %number translated strings added to language, %update strings updated.', array('%number' => $additions, '%update' => $updates)));
watchdog('locale', t('Translation imported into %locale, %number translated strings added to language, %update strings updated.', array('%locale' => "<em>$lang</em>", '%number' => $additions, '%update' => $updates))); watchdog('locale', t('Translation imported into %locale, %number translated strings added to language, %update strings updated.', array('%locale' => "<em>$lang</em>", '%number' => $additions, '%update' => $updates)));
return TRUE; return TRUE;
@ -464,7 +468,7 @@ function _locale_import_parse_plural_forms($pluralforms) {
return array($nplurals, $plural); return array($nplurals, $plural);
} }
else { else {
drupal_set_message(t("Translation file broken: plural formula couldn't get parsed."), 'error'); drupal_set_message(t("Warning: plural formula couldn't get parsed."), 'error');
return FALSE; return FALSE;
} }
} }
@ -898,10 +902,10 @@ function _locale_export_remove_plural($entry) {
} }
function _locale_string_delete($lid) { function _locale_string_delete($lid) {
db_query("DELETE FROM {locales_source} WHERE lid = %d", $lid); db_query('DELETE FROM {locales_source} WHERE lid = %d', $lid);
db_query("DELETE FROM {locales_target} WHERE lid = %d", $lid); db_query('DELETE FROM {locales_target} WHERE lid = %d', $lid);
locale_refresh_cache(); locale_refresh_cache();
drupal_set_message(t("Deleted string")); drupal_set_message(t('Deleted string'));
} }
/** /**
@ -911,7 +915,7 @@ function _locale_string_delete($lid) {
*/ */
function _locale_string_save($lid) { function _locale_string_save($lid) {
$edit =& $_POST["edit"]; $edit =& $_POST['edit'];
foreach ($edit as $key => $value) { foreach ($edit as $key => $value) {
$trans = db_fetch_object(db_query("SELECT translation FROM {locales_target} WHERE lid = %d AND locale = '%s'", $lid, $key)); $trans = db_fetch_object(db_query("SELECT translation FROM {locales_target} WHERE lid = %d AND locale = '%s'", $lid, $key));
if (isset($trans->translation)) { if (isset($trans->translation)) {
@ -921,11 +925,14 @@ function _locale_string_save($lid) {
db_query("INSERT INTO {locales_target} (lid, translation, locale) VALUES (%d, '%s', '%s')", $lid, $value, $key); db_query("INSERT INTO {locales_target} (lid, translation, locale) VALUES (%d, '%s', '%s')", $lid, $value, $key);
} }
} }
// refresh the locale cache
locale_refresh_cache(); locale_refresh_cache();
// rebuild the menu, strings may have changed
menu_rebuild();
// delete form data so it will remember where it came from // delete form data so it will remember where it came from
$edit = ''; $edit = '';
drupal_set_message(t("Saved string")); drupal_set_message(t('Saved string'));
} }
/** /**
@ -935,7 +942,7 @@ function _locale_string_edit($lid) {
$languages = locale_supported_languages(FALSE, TRUE); $languages = locale_supported_languages(FALSE, TRUE);
unset($languages['name']['en']); unset($languages['name']['en']);
$result = db_query("SELECT DISTINCT s.source, t.translation, t.locale FROM {locales_source} s INNER JOIN {locales_target} t ON s.lid = t.lid WHERE s.lid = %d", $lid); $result = db_query('SELECT DISTINCT s.source, t.translation, t.locale FROM {locales_source} s INNER JOIN {locales_target} t ON s.lid = t.lid WHERE s.lid = %d', $lid);
$form = ''; $form = '';
while ($translation = db_fetch_object($result)) { while ($translation = db_fetch_object($result)) {
$orig = $translation->source; $orig = $translation->source;