Ignore:
Timestamp:
Dec 19, 2013, 11:23:12 PM (11 years ago)
Author:
maron
Message:
  • Fixed: Export dbc text only, if varible ($s1,$t1..) is keep
  • Added: Filter translation where varibles are bad translated
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Modules/Export/Export.php

    r646 r658  
    278278  "</document>";
    279279    return($Buffer);
    280   }     
     280  }   
     281 
     282  function HaveVarible($String1, $String2)
     283  {
     284          //Export only if translate have same varible %
     285            if (strpos($String1,'$')) {
     286              while (strpos($String1,'$')) {
     287                $String1 = substr($String1,strpos($String1,'$'));
     288                $varible = $String1;
     289                if (strpos($varible,' ')) $varible = substr($varible,0,strpos($varible,' '));
     290                if (strpos($varible,'.')) $varible = substr($varible,0,strpos($varible,'.'));
     291                if (strpos($varible,'%')) $varible = substr($varible,0,strpos($varible,'%'));
     292                if (strpos($varible,chr(10))) $varible = substr($varible,0,strpos($varible,chr(10)));
     293                if (false == strpos($String2,$varible)) {
     294
     295                 return(false);
     296                }
     297              }
     298            }
     299          return (true);
     300  } 
    281301
    282302  function ExportToDBC()
     
    309329        $LookupTable = array();
    310330        $DbResult2 = $this->Database->query($this->BuildQuery($Group));
    311         while($DbRow = $DbResult2->fetch_assoc())
    312           $LookupTable[$DbRow[$Group['PrimaryKeyItem']]] = $DbRow;
     331        while($DbRow = $DbResult2->fetch_assoc()) {
     332          //Export only if translate have same varible %
     333          $CanExport = true;
     334          foreach($TranslationTree[$Group['Id']]['Items'] as $Column)  {
     335            $DbRow[$Column['Column']] = str_replace ( '$ ','$',$DbRow[$Column['Column']]);
     336            if (!$this->HaveVarible($DbRow['En'.$Column['Column']],$DbRow[$Column['Column']])) {
     337              $CanExport = false;
     338            } 
     339            if (!$this->HaveVarible($DbRow[$Column['Column']],$DbRow['En'.$Column['Column']])) {
     340              $CanExport = false;
     341            } 
     342          }
     343
     344          if ($CanExport)
     345            $LookupTable[$DbRow[$Group['PrimaryKeyItem']]] = $DbRow;
     346          else echo 'NE='.$DbRow[$Column['ID']].',';
     347        }
    313348     
    314349        // Open original DBC file
     
    348383            $LookupTableItem = $LookupTable[$PrimaryKeyItem];         
    349384            foreach($TranslationTree[$Group['Id']]['Items'] as $GroupItem)
    350             {
     385            { 
    351386              if(array_key_exists($GroupItem['Id'], $ColumnIndexes))
    352387                $Line[$ColumnIndexes[$GroupItem['Id']]] = $LookupTableItem[$GroupItem['Column']];
Note: See TracChangeset for help on using the changeset viewer.