Ignore:
Timestamp:
Feb 22, 2010, 3:06:33 PM (15 years ago)
Author:
maron
Message:

oprava generování u addonu zdvojených znaků

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/export/create_addon.php

    r330 r332  
    4040      $Man = str_replace(' ', '', $Man);
    4141      $Woman = str_replace(' ', '', $Woman);
    42       $string = $Before.'"..gsub(gsub(UnitSex("player"), "^2$", "'.$Man.'"), "^3$", "'.$Woman.'").."'.$After;
     42      $string = $Before.'"..gsub(gsub(UnitSex("player"), "^2$", "'.$Man.'"),
     43"^3$", "'.$Woman.'").."'.$After;
    4344    }
    4445
     
    8081  }
    8182
     83  function my_trim($string)
     84  {
     85    $string = addslashes($string);
     86    $string = str_replace("\n", '\r\\'."\n",$string);
     87    $string = str_replace("\r", '',$string);
     88    $string = str_replace("\\\\\\", '\\\\',$string);
     89    $string = str_replace("\\\\\\", '\\\\',$string);
     90    $string = str_replace("\\\\\\", '\\\\',$string);
     91    $string = str_replace("\\\\32", '\\32',$string);
     92    $string = str_replace('\\\\"', '\\"',$string);
     93    $string = str_replace('\\\\n', '\\n',$string);
     94    $string = str_replace('\\\\124', '\\124',$string);
     95
     96    return ($string);
     97  }
     98
    8299  function MakeLanguageFiles()
    83100  {
     
    89106    $CreatedFileListCount = array();
    90107 
    91     $DbResult = $this->Database->query('SELECT `group`.* FROM `ExportGroup` JOIN `group` ON `group`.`Id` = `ExportGroup`.`Group` WHERE `ExportGroup`.`Export`='.$this->Id.' AND `group`.`TablePrefix` != ""');
     108    $DbResult = $this->Database->query('SELECT `group`.* FROM `ExportGroup` JOIN
     109`group` ON `group`.`Id` = `ExportGroup`.`Group` WHERE
     110`ExportGroup`.`Export`='.$this->Id.' AND `group`.`TablePrefix` != ""');
    92111    while($Group = $DbResult->fetch_assoc())
    93112    {
     
    101120   
    102121        $CreatedFileList[] = $Column['AddonFileName'].'_'.$FileIndex;
    103         $FileName = $this->TempDir.'CzWoW/'.$Column['AddonFileName'].'_'.$FileIndex.'.lua';
    104         if(!file_exists($this->TempDir.'CzWoW/')) mkdir($this->TempDir.'CzWoW/', 0777, true);
     122        $FileName =
     123$this->TempDir.'CzWoW/'.$Column['AddonFileName'].'_'.$FileIndex.'.lua';
     124        if(!file_exists($this->TempDir.'CzWoW/')) mkdir($this->TempDir.'CzWoW/',
     1250777, true);
    105126        echo($Column['AddonFileName'].': ');
    106127        $i = 0;
    107128
    108129        $Buffer = 'CZWOW_'.$Column['AddonFileName'].
    109         '_count='.$FileIndex.'; CZWOW_'.$Column['AddonFileName'].'_'.$FileIndex.'={';
    110    
    111         $Query = 'SELECT T2.'.$Column['Column'].' AS Translation, T3.'.$Column['Column'].' as Original FROM (SELECT T1.entry, T1.'.$Column['Column'].' FROM (SELECT entry,'.$Column['Column'].' FROM '.$Group['TablePrefix'].' WHERE (Complete = 1) AND VersionStart <= '.$this->ClientVersion['BuildNumber'].' AND VersionEnd >= '.$this->ClientVersion['BuildNumber'].' AND '.$this->WhereLang.' AND '.$this->WhereUsers.$this->OrderByUserList.') AS T1 GROUP BY T1.entry) as T2 JOIN '.$Group['TablePrefix'].' AS T3 ON (T2.entry = T3.entry) AND (T3.Language = 0)';
     130        '_count='.$FileIndex.';
     131CZWOW_'.$Column['AddonFileName'].'_'.$FileIndex.'={';
     132   
     133        $Query = 'SELECT T2.'.$Column['Column'].' AS Translation,
     134T3.'.$Column['Column'].' as Original FROM (SELECT T1.entry,
     135T1.'.$Column['Column'].' FROM (SELECT entry,'.$Column['Column'].' FROM
     136'.$Group['TablePrefix'].' WHERE (Complete = 1) AND VersionStart <=
     137'.$this->ClientVersion['BuildNumber'].' AND VersionEnd >=
     138'.$this->ClientVersion['BuildNumber'].' AND '.$this->WhereLang.' AND
     139'.$this->WhereUsers.$this->OrderByUserList.') AS T1 GROUP BY T1.entry) as T2
     140JOIN '.$Group['TablePrefix'].' AS T3 ON (T2.entry = T3.entry) AND (T3.Language =
     1410)';
    112142        $DbResult2 = $this->Database->query($Query);
    113143       
    114144       
    115145        if ($this->Database->affected_rows == 0) {
    116                         $ID = $this->Database->query('SELECT MAX(`VersionEnd`) FROM `'.$Group['TablePrefix'].'`');
     146                        $ID = $this->Database->query('SELECT MAX(`VersionEnd`)
     147FROM `'.$Group['TablePrefix'].'`');
    117148                        $BuildNumber_max = $ID->fetch_assoc();
    118                         $BuildNumber_max = $BuildNumber_max['MAX(`VersionEnd`)'];
     149                        $BuildNumber_max =
     150$BuildNumber_max['MAX(`VersionEnd`)'];
    119151                       
    120                         $Query = 'SELECT T2.'.$Column['Column'].' AS Translation, T3.'.$Column['Column'].' as Original FROM (SELECT T1.entry, T1.'.$Column['Column'].' FROM (SELECT entry,'.$Column['Column'].' FROM '.$Group['TablePrefix'].' WHERE (Complete = 1) AND VersionStart <= '.$BuildNumber_max.' AND VersionEnd >= '.$BuildNumber_max.' AND '.$this->WhereLang.' AND '.$this->WhereUsers.$this->OrderByUserList.') AS T1 GROUP BY T1.entry) as T2 JOIN '.$Group['TablePrefix'].' AS T3 ON (T2.entry = T3.entry) AND (T3.Language = 0)';
     152                        $Query = 'SELECT T2.'.$Column['Column'].' AS
     153Translation, T3.'.$Column['Column'].' as Original FROM (SELECT T1.entry,
     154T1.'.$Column['Column'].' FROM (SELECT entry,'.$Column['Column'].' FROM
     155'.$Group['TablePrefix'].' WHERE (Complete = 1) AND VersionStart <=
     156'.$BuildNumber_max.' AND VersionEnd >= '.$BuildNumber_max.' AND
     157'.$this->WhereLang.' AND '.$this->WhereUsers.$this->OrderByUserList.') AS T1
     158GROUP BY T1.entry) as T2 JOIN '.$Group['TablePrefix'].' AS T3 ON (T2.entry =
     159T3.entry) AND (T3.Language = 0)';
    121160            $DbResult2 = $this->Database->query($Query);
    122161                       
     
    134173        }
    135174   
    136         $Buffer = $Buffer."\n};if not CZWOW_".$Column['AddonFileName']." then CZWOW_".$Column['AddonFileName']."=0; end; CZWOW_".$Column['AddonFileName']."=CZWOW_".$Column['AddonFileName']."+".$i.";\n";
     175        $Buffer = $Buffer."\n};if not CZWOW_".$Column['AddonFileName']." then
     176CZWOW_".$Column['AddonFileName']."=0; end;
     177CZWOW_".$Column['AddonFileName']."=CZWOW_".$Column['AddonFileName']."+".$i.";\n"
     178;
    137179
    138180        file_put_contents($FileName, $Buffer);
     
    142184 
    143185    // Generate file Translates.xml
    144     $Buffer = '<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/.\FrameXML\UI.xsd"><script file="BookPage_1.lua"/>'."\n";
     186    $Buffer = '<Ui xmlns="http://www.blizzard.com/wow/ui/"
     187xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     188xsi:schemaLocation="http://www.blizzard.com/wow/ui/.\FrameXML\UI.xsd"><script
     189file="BookPage_1.lua"/>'."\n";
    145190    foreach($CreatedFileList as $CreatedFile)
    146191      $Buffer .= '<script file="'.$CreatedFile.'.lua"/>'."\n";
     
    149194  }
    150195
     196
    151197  function MakeClientStrings()
    152198  {
     
    155201    $this->LoadFilters();
    156202 
    157     $Buffer = "local f=function(name, en, cz) CzWoW_interface[name]=cz; CzWoW_interface_entoname[en]=name; end; CzWoW_interface={ };CzWoW_interface_entoname={ };\n";
     203    $Buffer = "local f=function(name, en, cz) CzWoW_interface[name]=cz;
     204CzWoW_interface_entoname[en]=name; end; CzWoW_interface={
     205};CzWoW_interface_entoname={ };\n";
    158206    $Group = $TranslationTree[14]; // client table
    159207    $Column['Column'] = 'Text';
    160     $Query = 'SELECT T2.'.$Column['Column'].' AS Translation, T3.'.$Column['Column'].' as Original, T3.ShortCut FROM (SELECT T1.entry, T1.'.$Column['Column'].' FROM (SELECT entry,'.$Column['Column'].' FROM '.$Group['TablePrefix'].' WHERE (Complete = 1) AND VersionStart <= '.$this->ClientVersion['BuildNumber'].' AND VersionEnd >= '.$this->ClientVersion['BuildNumber'].' AND '.$this->WhereLang.' AND '.$this->WhereUsers.$this->OrderByUserList.') AS T1 GROUP BY T1.entry) as T2 JOIN '.$Group['TablePrefix'].' AS T3 ON (T2.entry = T3.entry) AND (T3.Language = 0)';
     208    $Query = 'SELECT T2.'.$Column['Column'].' AS Translation,
     209T3.'.$Column['Column'].' as Original, T3.ShortCut FROM (SELECT T1.entry,
     210T1.'.$Column['Column'].' FROM (SELECT entry,'.$Column['Column'].' FROM
     211'.$Group['TablePrefix'].' WHERE (Complete = 1) AND VersionStart <=
     212'.$this->ClientVersion['BuildNumber'].' AND VersionEnd >=
     213'.$this->ClientVersion['BuildNumber'].' AND '.$this->WhereLang.' AND
     214'.$this->WhereUsers.$this->OrderByUserList.') AS T1 GROUP BY T1.entry) as T2
     215JOIN '.$Group['TablePrefix'].' AS T3 ON (T2.entry = T3.entry) AND (T3.Language =
     2160)';
     217    echo $Query;
    161218    $DbResult = $this->Database->query($Query);
    162219    while($Line = $DbResult->fetch_array())
    163220    {
    164       $Original = str_replace("\r", '', str_replace("\n", '\r\\'."\n", addslashes($Line['Original'])));
    165       $Translated = str_replace("\r", '', str_replace("\n", '\r\\'."\n", addslashes($Line['Translation'])));
     221      $Original = $this->my_trim($Line['Original']);
     222      $Translated = $this->my_trim($Line['Translation']);
    166223      if ($this->ClientVersion['Version'] == '2.4.3')
    167224      {
     
    169226        $Translated = str_replace("|Hchannel:%d|h[%s]|h", '[%s]', $Translated);
    170227      }
    171       $Buffer .= 'f("'.addslashes($Line['ShortCut']).'", "'.$Original.'", "'.$Translated.'");'."\n";
     228      $Buffer .= 'f("'.addslashes($Line['ShortCut']).'", "'.$Original.'",
     229"'.$Translated.'");'."\n";
    172230    }
    173231
    174     if(!file_exists($this->TempDir.'CzWoW/')) mkdir($this->TempDir.'CzWoW/', 0777, true);
     232    if(!file_exists($this->TempDir.'CzWoW/')) mkdir($this->TempDir.'CzWoW/',
     2330777, true);
    175234    file_put_contents($this->TempDir.'CzWoW/LocalizationStrings.lua', $Buffer);
    176235  }
     
    186245  function MakeReadme()
    187246  {
    188     $DbResult = $this->Database->query('SELECT * FROM verseclient ORDER BY DATE DESC');
     247    $DbResult = $this->Database->query('SELECT * FROM verseclient ORDER BY DATE
     248DESC');
    189249    $Line = $DbResult->fetch_assoc();
    190250
     
    192252 Čeština pro klienty:
    193253  Vytvořeno v projektu http://wowpreklad.zdechov.net/
    194   Obsahuje Fonty pro správné zobrazování českých znaků, WoW addon překládající texty
     254  Obsahuje Fonty pro správné zobrazování českých znaků, WoW addon překládající
     255texty
    195256 
    196257 Instalace:
    197   Soubory rozbalte/zkopírujte do kořenové složky s hrou. Obvikle bývá "C:/Program Files/World of Warcraft/".
     258  Soubory rozbalte/zkopírujte do kořenové složky s hrou. Obvikle bývá
     259"C:/Program Files/World of Warcraft/".
    198260 
    199261 Verze:
     
    204266 
    205267    ';
    206     $DbResult = $Database->query('SELECT * FROM verseclient ORDER BY DATE DESC');
     268    $DbResult = $Database->query('SELECT * FROM verseclient ORDER BY DATE
     269DESC');
    207270    while($Line = $DbResult->fetch_assoc())
    208271    {
Note: See TracChangeset for help on using the changeset viewer.