From ba2761929c4200c28ff658ecdb83158f1a9deb36 Mon Sep 17 00:00:00 2001 From: Steven Wittens Date: Sat, 16 Oct 2004 01:00:23 +0000 Subject: #7289: locale import fixes --- includes/locale.inc | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'includes') diff --git a/includes/locale.inc b/includes/locale.inc index 5e4e19333..ec6884935 100644 --- a/includes/locale.inc +++ b/includes/locale.inc @@ -186,23 +186,19 @@ function _locale_import_po($file, $lang, $mode) { db_query("INSERT INTO {locales_target} (lid, locale, translation, plid, plural) VALUES (%d, '%s', '%s', %d, %d)", $lid, $lang, $trans, $plid, $key); $additions++; } // translation exists - else if ($mode == 'overwrite') { //overwrite in any case - db_query("UPDATE {locales_target} SET translation = '%s', plid = %d, plural = %d WHERE locale = '%s' AND lid = %d", $trans, $lang, $lid, $plid, $key); + else if ($mode == 'overwrite' || $trans2->translation == '') { + db_query("UPDATE {locales_target} SET translation = '%s', plid = %d, plural = %d WHERE locale = '%s' AND lid = %d", $trans, $plid, $key, $lang, $lid); if ($trans2->translation == '') { $additions++; } else { $updates++; } - } // overwrite if empty string - else if ($trans2->translation == '') { - db_query("UPDATE {locales_target} SET translation = '%s', plid = %d, plural = %d WHERE locale = '%s' AND lid = %d", $trans, $lang, $lid, $plid, $key); - $additions++; } } else { // no string - db_query("INSERT INTO {locales_source} (location, source) VALUES ('%s', '%s')", $comments, $english); - $loc = db_fetch_object(db_query("SELECT lid FROM {locales_source} WHERE source = '%s'", $english)); + db_query("INSERT INTO {locales_source} (location, source) VALUES ('%s', '%s')", $comments, $english[$key]); + $loc = db_fetch_object(db_query("SELECT lid FROM {locales_source} WHERE source = '%s'", $english[$key])); $lid = $loc->lid; db_query("INSERT INTO {locales_target} (lid, locale, translation, plid, plural) VALUES (%d, '%s', '%s', %d, %d)", $lid, $lang, $trans, $plid, $key); if ($trans != '') { -- cgit v1.2.3