You are here

function _translation_table_update_translation in Translation table 6

Same name and namespace in other branches
  1. 7 includes/admin.inc \_translation_table_update_translation()

Update, create or delete translation as needed.

1 call to _translation_table_update_translation()
translation_table_submit_translations in includes/admin.inc
Submit handler for the translation table.

File

includes/admin.inc, line 87
The administration interface.

Code

function _translation_table_update_translation($lid, $lang_code, $translation) {
  if ($translation == '') {
    db_query("DELETE FROM {locales_target} WHERE lid = %d AND language = '%s'", $lid, $lang_code);
    return;
  }
  db_query("UPDATE {locales_target} SET translation = '%s' WHERE lid = %d AND language = '%s'", $translation, $lid, $lang_code);
  if (!db_affected_rows()) {
    db_query("INSERT INTO {locales_target} (lid, language, translation) VALUES (%d, '%s', '%s')", $lid, $lang_code, $translation);
  }
}