You are here

function lingotek_config_add_existing_translations in Lingotek Translation 7.7

Same name and namespace in other branches
  1. 7.6 lingotek.config.inc \lingotek_config_add_existing_translations()
1 call to lingotek_config_add_existing_translations()
lingotek_bulk_grid_parse_config_data in ./lingotek.config.inc

File

./lingotek.config.inc, line 128
Config grid form elements

Code

function lingotek_config_add_existing_translations($lids, $lang_codes) {
  $query = db_select('locales_target', 'lt')
    ->fields('lt', array(
    'lid',
    'language',
  ));
  $query
    ->condition('lid', $lids, 'IN');
  $result = $query
    ->execute()
    ->fetchAll();
  $existing_translations = array();
  foreach ($result as $key => $value) {
    $lang = Lingotek::convertDrupal2Lingotek($value->language);

    // This check is performed in lang_icons anyway so you might remove it
    if ($lang && array_key_exists($lang, $lang_codes)) {
      $existing_translations[$value->lid][] = Lingotek::convertDrupal2Lingotek($value->language);
    }
  }
  return $existing_translations;
}