/**
 * executa um insert no banco de dados de um objeto po
 * @param unknown_type $entry
 * @param unknown_type $group
 * @return Ambigous <Ambigous, resource>
 * @todo atualizar para que o insert também faça um update
 */
function insertTranslation(&$entry, $group = 'default')
{
    global $cfg;
    $mysql = new MYSQL($cfg);
    $args = po_db($entry, $group);
    return $mysql->SqlSelect($mysql->SqlInsert($args), __FILE__, __LINE__);
}
 public function LoadLanguage($group = 'default')
 {
     $mysql = new MYSQL($this);
     $langto = $this->cfg['language_default'];
     $sql = "SELECT s.lid, s.source, s.textgroup, s.location, t.translation, t.plid,\n\t\t\t\t\t(SELECT t.translation FROM {$this->cfg[db_prefix]}locales_target t WHERE s.lid = t.plid) AS tplural,\n\t\t\t\t\t(SELECT s.source FROM  {$this->cfg[db_prefix]}locales_source s Where s.lid = \n\t\t\t\t\t(SELECT t.lid FROM {$this->cfg[db_prefix]}locales_target t WHERE t.translation = tplural)) AS plural\n\t\t\t\tFROM {$this->cfg[db_prefix]}locales_source s\n\t\t\t\tLEFT JOIN  {$this->cfg[db_prefix]}locales_target  t ON s.lid = t.lid\n\t\t\t\tAND t.language = '{$langto->language}'\n\t\t\t\tWHERE s.textgroup = '{$group}' AND t.plural = false";
     $result = $mysql->SqlSelect($sql, __FILE__, __LINE__);
     if (mysql_affected_rows() > 0) {
         while ($linha = mysql_fetch_assoc($result)) {
             $args = poFormater($linha);
             $this->language['translation'][$linha['source']] = new Translation_Entry($args);
         }
     } else {
         if ($po_file = $this->LoadPo($langto->language, $group)) {
             //carrega uma linguagem para o banco de dados caso não exista nenhuma
             $args = po_db($po_file, $group);
             $result = $mysql->SqlSelect($mysql->SqlInsert($args), __FILE__, __LINE__);
             $this->language['translation'] = $po_file;
         }
     }
 }