Commit ba276192 authored by Steven Wittens's avatar Steven Wittens

#7289: locale import fixes

parent ea17f398
...@@ -186,23 +186,19 @@ function _locale_import_po($file, $lang, $mode) { ...@@ -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); db_query("INSERT INTO {locales_target} (lid, locale, translation, plid, plural) VALUES (%d, '%s', '%s', %d, %d)", $lid, $lang, $trans, $plid, $key);
$additions++; $additions++;
} // translation exists } // translation exists
else if ($mode == 'overwrite') { //overwrite in any case 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, $lang, $lid, $plid, $key); 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 == '') { if ($trans2->translation == '') {
$additions++; $additions++;
} }
else { else {
$updates++; $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 else { // no string
db_query("INSERT INTO {locales_source} (location, source) VALUES ('%s', '%s')", $comments, $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)); $loc = db_fetch_object(db_query("SELECT lid FROM {locales_source} WHERE source = '%s'", $english[$key]));
$lid = $loc->lid; $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); db_query("INSERT INTO {locales_target} (lid, locale, translation, plid, plural) VALUES (%d, '%s', '%s', %d, %d)", $lid, $lang, $trans, $plid, $key);
if ($trans != '') { if ($trans != '') {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment