Example #1
0
 protected static function getQueryCompletedConfigTranslations($drupal_codes)
 {
     // return a query object that contains all fully-translated/current strings
     // or ones that were not translated by Lingotek.
     // use the first addtl language as the query's base.
     $first_lang = array_shift($drupal_codes);
     $lingotek_id = LingotekConfigChunk::getLingotekTranslationAgentId();
     $primary_or = db_or()->condition('lt0.i18n_status', 0)->condition('lt0.translation_agent_id', $lingotek_id, '!=');
     $query = db_select('{locales_target}', "lt0")->fields('lt0', array('lid'))->condition('lt0.language', $first_lang)->condition($primary_or);
     $addtl_joins = 0;
     foreach ($drupal_codes as $new_join) {
         // join a new instance of locales_target for each target language
         // where an entry for the language exists for the given lid and
         // it is "current" (ie. i18n_status field is set to 0)
         $addtl_joins++;
         $ja = "lt{$addtl_joins}";
         // join alias
         $join_str = "{$ja}.lid = lt0.lid and {$ja}.language = '{$new_join}' and ({$ja}.i18n_status = 0 or {$ja}.translation_agent_id != {$lingotek_id})";
         $query->join('{locales_target}', $ja, $join_str);
     }
     return $query;
 }