Changeset 332
- Timestamp:
- Feb 22, 2010, 3:06:33 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/export/create_addon.php
r330 r332 40 40 $Man = str_replace(' ', '', $Man); 41 41 $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; 43 44 } 44 45 … … 80 81 } 81 82 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 82 99 function MakeLanguageFiles() 83 100 { … … 89 106 $CreatedFileListCount = array(); 90 107 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` != ""'); 92 111 while($Group = $DbResult->fetch_assoc()) 93 112 { … … 101 120 102 121 $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/', 125 0777, true); 105 126 echo($Column['AddonFileName'].': '); 106 127 $i = 0; 107 128 108 129 $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.'; 131 CZWOW_'.$Column['AddonFileName'].'_'.$FileIndex.'={'; 132 133 $Query = 'SELECT T2.'.$Column['Column'].' AS Translation, 134 T3.'.$Column['Column'].' as Original FROM (SELECT T1.entry, 135 T1.'.$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 140 JOIN '.$Group['TablePrefix'].' AS T3 ON (T2.entry = T3.entry) AND (T3.Language = 141 0)'; 112 142 $DbResult2 = $this->Database->query($Query); 113 143 114 144 115 145 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`) 147 FROM `'.$Group['TablePrefix'].'`'); 117 148 $BuildNumber_max = $ID->fetch_assoc(); 118 $BuildNumber_max = $BuildNumber_max['MAX(`VersionEnd`)']; 149 $BuildNumber_max = 150 $BuildNumber_max['MAX(`VersionEnd`)']; 119 151 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 153 Translation, T3.'.$Column['Column'].' as Original FROM (SELECT T1.entry, 154 T1.'.$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 158 GROUP BY T1.entry) as T2 JOIN '.$Group['TablePrefix'].' AS T3 ON (T2.entry = 159 T3.entry) AND (T3.Language = 0)'; 121 160 $DbResult2 = $this->Database->query($Query); 122 161 … … 134 173 } 135 174 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 176 CZWOW_".$Column['AddonFileName']."=0; end; 177 CZWOW_".$Column['AddonFileName']."=CZWOW_".$Column['AddonFileName']."+".$i.";\n" 178 ; 137 179 138 180 file_put_contents($FileName, $Buffer); … … 142 184 143 185 // 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/" 187 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 188 xsi:schemaLocation="http://www.blizzard.com/wow/ui/.\FrameXML\UI.xsd"><script 189 file="BookPage_1.lua"/>'."\n"; 145 190 foreach($CreatedFileList as $CreatedFile) 146 191 $Buffer .= '<script file="'.$CreatedFile.'.lua"/>'."\n"; … … 149 194 } 150 195 196 151 197 function MakeClientStrings() 152 198 { … … 155 201 $this->LoadFilters(); 156 202 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; 204 CzWoW_interface_entoname[en]=name; end; CzWoW_interface={ 205 };CzWoW_interface_entoname={ };\n"; 158 206 $Group = $TranslationTree[14]; // client table 159 207 $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, 209 T3.'.$Column['Column'].' as Original, T3.ShortCut FROM (SELECT T1.entry, 210 T1.'.$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 215 JOIN '.$Group['TablePrefix'].' AS T3 ON (T2.entry = T3.entry) AND (T3.Language = 216 0)'; 217 echo $Query; 161 218 $DbResult = $this->Database->query($Query); 162 219 while($Line = $DbResult->fetch_array()) 163 220 { 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']); 166 223 if ($this->ClientVersion['Version'] == '2.4.3') 167 224 { … … 169 226 $Translated = str_replace("|Hchannel:%d|h[%s]|h", '[%s]', $Translated); 170 227 } 171 $Buffer .= 'f("'.addslashes($Line['ShortCut']).'", "'.$Original.'", "'.$Translated.'");'."\n"; 228 $Buffer .= 'f("'.addslashes($Line['ShortCut']).'", "'.$Original.'", 229 "'.$Translated.'");'."\n"; 172 230 } 173 231 174 if(!file_exists($this->TempDir.'CzWoW/')) mkdir($this->TempDir.'CzWoW/', 0777, true); 232 if(!file_exists($this->TempDir.'CzWoW/')) mkdir($this->TempDir.'CzWoW/', 233 0777, true); 175 234 file_put_contents($this->TempDir.'CzWoW/LocalizationStrings.lua', $Buffer); 176 235 } … … 186 245 function MakeReadme() 187 246 { 188 $DbResult = $this->Database->query('SELECT * FROM verseclient ORDER BY DATE DESC'); 247 $DbResult = $this->Database->query('SELECT * FROM verseclient ORDER BY DATE 248 DESC'); 189 249 $Line = $DbResult->fetch_assoc(); 190 250 … … 192 252 Čeština pro klienty: 193 253 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í 255 texty 195 256 196 257 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/". 198 260 199 261 Verze: … … 204 266 205 267 '; 206 $DbResult = $Database->query('SELECT * FROM verseclient ORDER BY DATE DESC'); 268 $DbResult = $Database->query('SELECT * FROM verseclient ORDER BY DATE 269 DESC'); 207 270 while($Line = $DbResult->fetch_assoc()) 208 271 {
Note:
See TracChangeset
for help on using the changeset viewer.