Changeset 900 for trunk/Modules/Translation
- Timestamp:
- Apr 10, 2024, 11:49:39 PM (9 months ago)
- Location:
- trunk/Modules/Translation
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/Translation/Comparison.php
r893 r900 47 47 if ($User->Licence(LICENCE_USER)) 48 48 { 49 $Output = 'Text je porovnáván vždy ku předešlému (vlevo). Změny jsou zvýrazněny <span class="edit">barvou.</span><br /><br />'; 49 $Output = 'Text je porovnáván vždy ku předešlému (vlevo). Změny jsou zvýrazněny <span class="edit">barvou.</span><br /><br />'; 50 51 $GroupId = LoadGroupIdParameter(); 52 $Table = $TranslationTree[$GroupId]['TablePrefix']; 50 53 51 $GroupId = LoadGroupIdParameter(); 52 $Table = $TranslationTree[$GroupId]['TablePrefix']; 54 if (array_key_exists('entry', $_GET)) 55 { 56 $Textentry = $_GET['entry']; 57 if ((array_key_exists('ID1', $_GET)) and ($_GET['ID1'] <> -1)) //porovnání pouze 2 textů 58 { 59 $TextID1 = $_GET['ID1']; 60 $TextID2 = $_GET['ID2']; 61 $WhereID = ' AND ((`'.$Table.'`.`ID` = '.$TextID1.') OR (`'.$Table.'`.`ID` = '.$TextID2.'))'; 62 } else $WhereID = ''; 53 63 54 if (array_key_exists('entry', $_GET)) 55 { 56 $Textentry = $_GET['entry']; 57 if ((array_key_exists('ID1', $_GET)) and ($_GET['ID1'] <> -1)) //porovnání pouze 2 textů 58 { 59 $TextID1 = $_GET['ID1']; 60 $TextID2 = $_GET['ID2']; 61 $WhereID = ' AND ((`'.$Table.'`.`ID` = '.$TextID1.') OR (`'.$Table.'`.`ID` = '.$TextID2.'))'; 62 } else $WhereID = ''; 63 64 $DataID = $this->Database->query('SELECT `'.$Table.'`.*, `User`.`Name` AS `UserName`, '. 64 $DataID = $this->Database->query('SELECT `'.$Table.'`.*, `User`.`Name` AS `UserName`, '. 65 65 '`Language`.`Name` AS `LanguageName` '. 66 66 'FROM '.$Table.' LEFT JOIN `User` ON `User`.`Id` = `'.$Table.'`.`User` '. 67 67 ' LEFT JOIN `Language` ON `Language`.`Id` = `'.$Table.'`.`Language` '. 68 68 'WHERE `Entry` = '.$Textentry.' '.$WhereID.' ORDER BY `Language`'); 69 while ($Line[] = $DataID->fetch_assoc());70 array_pop($Line);69 while ($Line[] = $DataID->fetch_assoc()); 70 array_pop($Line); 71 71 72 $Output .= 'Počet porovnávaných textů: <strong>'.count($Line).'</strong><br /> ';72 $Output .= 'Počet porovnávaných textů: <strong>'.count($Line).'</strong><br /> '; 73 73 74 $Output .= '<strong>Číslo textu: <a href="http://www.wowhead.com/?quest='.$Textentry.'">'.$Textentry.'</a></strong>'.74 $Output .= '<strong>Číslo textu: <a href="http://www.wowhead.com/?quest='.$Textentry.'">'.$Textentry.'</a></strong>'. 75 75 '<table class="BaseTable">'. 76 76 '<tr><th>Přeložil</th>'; 77 foreach ($Line as $Index => $LineItem)78 $Output .= '<th>'.$LineItem['UserName'].'</th>';79 $Output .= '</tr>'.77 foreach ($Line as $Index => $LineItem) 78 $Output .= '<th>'.$LineItem['UserName'].'</th>'; 79 $Output .= '</tr>'. 80 80 '<tr>'. 81 81 '<th>ID textu</th>'; 82 foreach ($Line as $Index => $LineItem)83 $Output .= '<td><a href="form.php?group='.$GroupId.'&ID='.$LineItem['ID'].'">'.$LineItem['ID'].'</a></td>';84 $Output .= '</tr>'.82 foreach ($Line as $Index => $LineItem) 83 $Output .= '<td><a href="form.php?group='.$GroupId.'&ID='.$LineItem['ID'].'">'.$LineItem['ID'].'</a></td>'; 84 $Output .= '</tr>'. 85 85 '<tr><th>Převzato</th>'; 86 foreach ($Line as $Index => $LineItem)87 $Output .= '<td><a href="form.php?group='.$GroupId.'&ID='.$LineItem['Take'].'">'.$LineItem['Take'].'</a></td>';88 $Output .= '</tr>'.86 foreach ($Line as $Index => $LineItem) 87 $Output .= '<td><a href="form.php?group='.$GroupId.'&ID='.$LineItem['Take'].'">'.$LineItem['Take'].'</a></td>'; 88 $Output .= '</tr>'. 89 89 '<tr><th>'.T('Language').'</th>'; 90 foreach ($Line as $Index => $LineItem)91 $Output .= '<td>'.T($LineItem['LanguageName']).'</td>';92 $Output .= '</tr>'.90 foreach ($Line as $Index => $LineItem) 91 $Output .= '<td>'.T($LineItem['LanguageName']).'</td>'; 92 $Output .= '</tr>'. 93 93 '<tr><th>'.T('Version').'</th>'; 94 foreach ($Line as $Index => $LineItem) 95 $Output .= '<td>'.GetVersionWOW($LineItem['VersionStart']).' - '.GetVersionWOW($LineItem['VersionEnd']).'</td>'; 96 $Output .= '</tr>'; 97 foreach ($TranslationTree[$GroupId]['Items'] as $Index => $TextItem) 98 { 99 $writethis = false; 100 for ($i = 0; $i < count($Line); $i++) 94 foreach ($Line as $Index => $LineItem) 95 $Output .= '<td>'.GetVersionWOW($LineItem['VersionStart']).' - '.GetVersionWOW($LineItem['VersionEnd']).'</td>'; 96 $Output .= '</tr>'; 97 foreach ($TranslationTree[$GroupId]['Items'] as $Index => $TextItem) 101 98 { 102 if ($Line[$i][$TextItem['Column']] <> '') $writethis = true; 103 } 104 if ($writethis) 105 { 106 $Output .= '<tr><th>'.$TextItem['Name'].'</th>'; 99 $writethis = false; 107 100 for ($i = 0; $i < count($Line); $i++) 108 101 { 109 if ($i > 0) 102 if ($Line[$i][$TextItem['Column']] <> '') $writethis = true; 103 } 104 if ($writethis) 105 { 106 $Output .= '<tr><th>'.$TextItem['Name'].'</th>'; 107 for ($i = 0; $i < count($Line); $i++) 110 108 { 111 $Output .= '<td>'; 112 $Output .= str_replace("\n", '<br/>', $this->CompareString(htmlspecialchars($Line[$i][$TextItem['Column']]),htmlspecialchars($Line[$i - 1][$TextItem['Column']]))); 113 $Output .= '</td>'; 114 } else $Output .= '<td>'.htmlspecialchars($Line[$i][$TextItem['Column']]).'</td>'; 109 if ($i > 0) 110 { 111 $Output .= '<td>'; 112 $Output .= str_replace("\n", '<br/>', $this->CompareString(htmlspecialchars($Line[$i][$TextItem['Column']]),htmlspecialchars($Line[$i - 1][$TextItem['Column']]))); 113 $Output .= '</td>'; 114 } else $Output .= '<td>'.htmlspecialchars($Line[$i][$TextItem['Column']]).'</td>'; 115 } 116 $Output .= '</tr>'; 115 117 } 116 $Output .= '</tr>';117 118 } 118 } 119 $Output .= '</table>'; 120 } else $Output .= ShowMessage('Nebylo zadáno ID.', MESSAGE_CRITICAL); 121 } else $Output .= ShowMessage('Porovnávat můžou pouze překladatelé!', MESSAGE_CRITICAL); 119 $Output .= '</table>'; 120 } else $Output .= ShowMessage('Nebylo zadáno ID.', MESSAGE_CRITICAL); 121 } else $Output .= ShowMessage('Porovnávat můžou pouze překladatelé!', MESSAGE_CRITICAL); 122 122 123 123 return $Output; -
trunk/Modules/Translation/Form.php
r893 r900 28 28 $Table = $TranslationTree[$GroupId]['TablePrefix']; 29 29 if (array_key_exists('action', $_GET)) $Action = $_GET['action']; 30 else $Action = '';30 else $Action = ''; 31 31 32 32 if (array_key_exists('ID', $_GET)) … … 50 50 foreach ($TranslationTree[$GroupId]['Items'] as $Index => $TextItem) 51 51 $Columns .= ' `Orig`.`'.$TextItem['Column'].'` as `Orig_'.$TextItem['Column'].'`, `Tran`.`'.$TextItem['Column'].'` as `'.$TextItem['Column'].'`,'; 52 53 52 54 53 $sql = 'SELECT '.$Columns.' Tran.`Entry` FROM `'.$Table.'` as Tran'; … … 175 174 176 175 if ($TranslationTree[$GroupId]['WowheadName'] != '') 177 $WowheadLink = '<a href="http ://www.wowhead.com/?'.$TranslationTree[$GroupId]['WowheadName'].176 $WowheadLink = '<a href="https://www.wowhead.com/?'.$TranslationTree[$GroupId]['WowheadName']. 178 177 '='.$LineAJ['Entry'].'">'.$LineAJ['Entry'].'</a>'; 179 178 else $WowheadLink = $LineAJ['Entry']; 180 179 181 $Output .= '<input type="hidden" name="entry" value="'.$LineAJ['Entry'].'" /> 182 <input type="hidden" name="user" value="'.$User->Id.'" />183 <input type="hidden" name="ID" value="'.$TextID.'" />184 <table class="BaseTable">185 <tr>186 <th>'.T('Text number').': '.$WowheadLink.'</th>187 <th>'.T('Not translated').'</th>188 <th>'.T('Translated').'</th>189 </tr>190 <tr>191 <th>'.T('Language').'</th>192 <td>'.T('Original').'</td>193 <td>';180 $Output .= '<input type="hidden" name="entry" value="'.$LineAJ['Entry'].'" />'. 181 '<input type="hidden" name="user" value="'.$User->Id.'" />'. 182 '<input type="hidden" name="ID" value="'.$TextID.'" />'. 183 '<table class="BaseTable">'. 184 '<tr>'. 185 '<th>'.T('Text number').': '.$WowheadLink.'</th>'. 186 '<th>'.T('Not translated').'</th>'. 187 '<th>'.T('Translated').'</th>'. 188 '</tr>'. 189 '<tr>'. 190 '<th>'.T('Language').'</th>'. 191 '<td>'.T('Original').'</td>'. 192 '<td>'; 194 193 if ($Line['Language'] <> 0) $Language = $Line['Language']; 195 194 else if ($User->Id != 0) … … 239 238 if ($User->Licence(LICENCE_USER)) 240 239 $Output .= '<textarea rows="8" cols="40" onkeydown="ResizeTextArea(this)" class="textedit" id="'.$TextItem['Column'].'" name="'.$TextItem['Column'].'">'; 241 $Output .= 240 $Output .= htmlspecialchars($Line[$TextItem['Column']]); 242 241 if ($User->Licence(LICENCE_USER)) $Output .= '</textarea></td></tr>'; 243 242 } -
trunk/Modules/Translation/LoadNames.php
r893 r900 3 3 class PageLoadNames extends Page 4 4 { 5 function ReplaceTranslated($orig, $tran,$Text,$ID,$Group)5 function ReplaceTranslated($orig, $tran, $Text, $ID, $Group) 6 6 { 7 7 $tran_replace = str_replace(' ',' ',htmlspecialchars($tran)); … … 21 21 } 22 22 23 function ReplaceNotTranslated($orig, $tran,$Text,$ID,$Group)23 function ReplaceNotTranslated($orig, $tran, $Text, $ID, $Group) 24 24 { 25 25 $orig_replace = str_replace(' ',' ',htmlspecialchars($orig)); … … 96 96 } 97 97 //$LineAJ[$Column] 98 return $this->ColorNames(htmlspecialchars($Text), $names);98 return $this->ColorNames(htmlspecialchars($Text), $names); 99 99 } 100 100 -
trunk/Modules/Translation/Save.php
r893 r900 18 18 // Get data for english original 19 19 $DbResult = $this->Database->query('SELECT * FROM `'.$Table.'` WHERE (`Entry`='.$SourceText['Entry'].') '. 20 21 20 'AND (`Language` = '.Core::Cast($this->System)->Config['OriginalLanguage'].') AND (`VersionStart` = '.$SourceText['VersionStart'].') '. 21 'AND (`VersionEnd` = '.$SourceText['VersionEnd'].')'); 22 22 if ($DbResult->num_rows > 0) 23 23 { -
trunk/Modules/Translation/TranslationList.php
r893 r900 257 257 258 258 $Query = 'SELECT `T`.`ModifyTime`, `T`.`ID`, `T`.`Entry`, `T`.`VersionStart`, `T`.`VersionEnd`, '. 259 260 261 262 263 264 265 266 267 259 '`T`.`'.$TranslationTree[$Filter['Group']]['Items'][0]['Column'].'`, '. 260 '`User`.`Name` AS `UserName`, `User`.`ID` AS `UserId`, '. 261 '`Language`.`Name` AS `LanguageName`, `TS`.`Version` AS `VersionStartText`, `TE`.`Version` AS `VersionEndText` '. 262 'FROM `'.$Table.'` AS `T` '. 263 'LEFT JOIN `User` ON `User`.`ID` = `T`.`User` '. 264 'LEFT JOIN `Language` ON `Language`.`ID` = `T`.`Language` '. 265 'LEFT JOIN `ClientVersion` AS `TS` ON `TS`.`BuildNumber` = `T`.`VersionStart` '. 266 'LEFT JOIN `ClientVersion` AS `TE` ON `TE`.`BuildNumber` = `T`.`VersionEnd` '. 267 'WHERE 1 '.$Filter['SQL']; 268 268 269 269 // Get total item count 270 $DbResult = $this->Database->query('SELECT COUNT(*) FROM ('.$Query.') AS `TT`'); 270 $DbResult = $this->Database->query('SELECT COUNT(*) FROM ('.$Query.') AS `TT`'); 271 271 $DbRow = $DbResult->fetch_row(); 272 272 $PageList = GetPageList($DbRow[0]); … … 274 274 $Output .= $PageList['Output']; 275 275 $TableColumns = array( 276 277 278 279 280 281 282 283 276 array('Name' => 'ID', 'Title' => T('Number')), 277 array('Name' => 'Entry', 'Title' => T('Item')), 278 array('Name' => $TranslationTree[$Filter['Group']]['Items'][0]['Column'], 'Title' => T('Name')), 279 array('Name' => 'VersionStart', 'Title' => T('From version')), 280 array('Name' => 'VersionEnd', 'Title' => T('To version')), 281 array('Name' => 'LanguageName', 'Title' => T('Language')), 282 array('Name' => 'UserName', 'Title' => T('Translator')), 283 array('Name' => 'ModifyTime', 'Title' => T('Date')), 284 284 ); 285 285 286 286 $Order = GetOrderTableHeader($TableColumns, 'VersionStart', 1); 287 287 $Output .= '<table class="BaseTable">'. 288 288 $Order['Output']; 289 289 290 290 $DbResult = $this->Database->query($Query.' '.$Order['SQL'].' '.$PageList['SQLLimit']); 291 291 while ($Line = $DbResult->fetch_assoc()) 292 292 { 293 $Text = $Line[$TranslationTree[$Filter['Group']]['Items'][0]['Column']]; 294 if ($Text != null) $Text = htmlspecialchars($Text); 295 293 296 $Output .= '<tr><td><a href="'.$this->System->Link('/form.php?group='.$Filter['Group'].'&ID='.$Line['ID']).'">'.$Line['ID'].'</a></td>'. 294 297 '<td>'.$Line['Entry'].'</td>'. 295 '<td>'. htmlspecialchars($Line[$TranslationTree[$Filter['Group']]['Items'][0]['Column']]).'</td>'.298 '<td>'.$Text.'</td>'. 296 299 '<td><a href="'.$this->System->Link('/client-version/?action=item&id='. 297 300 GetVersionWOWId($Line['VersionStart'])).'">'.GetVersionWOW($Line['VersionStart']).'</a></td>'. … … 317 320 $Total = 0; 318 321 foreach ($TranslationTree as $Group) 322 { 319 323 if ($Group['TablePrefix'] != '') 320 324 { … … 326 330 $Total += $Line[0]; 327 331 } 328 $Output .= '<tr><td><strong>'.T('Total').'</strong></td><td><strong>'.$Total.'</strong></td></tr>'. 329 '</table>'; 330 return $Output; 332 } 333 $Output .= '<tr><td><strong>'.T('Total').'</strong></td><td><strong>'.$Total.'</strong></td></tr>'. 334 '</table>'; 335 return $Output; 331 336 } 332 337 … … 338 343 $GroupId = GetParameter('group', 0, true); 339 344 if ($GroupId == 0) $Output = ShowMessage('Skupina nenalezena', MESSAGE_CRITICAL); 340 else { 345 else 346 { 341 347 $Table = $TranslationTree[$GroupId]['TablePrefix']; 342 348 343 349 $Output = '<h3>'.T('Basic text filtering').'</h3><br/>'. 344 345 346 347 348 349 350 351 352 350 '<table class="BaseTable"><tr><th>'.T('Link').'</th><th>'.T('Description').'</th></tr>'. 351 '<tr><td><a title="'.T('All texts available in group').'" href="?group='.$GroupId.'&state=4">'.T('All').'</a></td>'. 352 '<td>'.T('Show all available original texts in group').'</td></tr>'. 353 '<tr><td><a title="'.T('Translated texts, you can modify them here').'" href="?group='.$GroupId.'&state=2">'.T('Translated').'</a></td>'. 354 '<td>'.T('Show only translated texts').'</td></tr>'. 355 '<tr><td><a title="'.T('Untranslated texts').'" href="?group='.$GroupId.'&state=1">'.T('Untranslated').'</a></td>'. 356 '<td>'.T('Not yet translated texts which need to be translated').'</td></tr>'. 357 '<tr><td><a title="'.T('Unfinished texts').'" href="?group='.$GroupId.'&state=3">'.T('Unfinished').'</a></td>'. 358 '<td>'.T('Texts marked as unfinished').'</td></tr>'; 353 359 354 360 if ($User->Licence(LICENCE_USER)) … … 361 367 362 368 $Output .= '<tr><td><form action="?group='.$GroupId.'&entry=" method="post"><div>'. 363 364 365 366 369 '<input type="text" name="text" size="8" />'. 370 '<input type="submit" value="'.T('Search').'" />'. 371 '</div></form>'. 372 '</td><td>'.T('Search using text').'</td></tr>'; 367 373 368 374 $Output .= '<tr><td><form action="?group='.$GroupId.'&text=" method="post"><div>'. 369 370 371 372 375 '<input type="text" name="entry" size="8" />'. 376 '<input type="submit" value="'.T('Search').'" />'. 377 '</div></form>'. 378 '</td><td>'.T('Show by datbase text ID').'</td></tr>'; 373 379 374 380 $Output .= '</table>'; … … 396 402 function ShowList() 397 403 { 398 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 404 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 399 405 $DbResult = $this->Database->query('SELECT COUNT(*) FROM `Group`'); 400 406 $DbRow = $DbResult->fetch_row(); … … 448 454 { 449 455 $Output = '<h3>Vložení nové překladové skupiny</h3>'. 450 451 452 453 454 455 456 '<form action="?action=groupaddfinish" method="post">'. 457 '<table>'. 458 '<tr><td>Název:</td><td><input type="text" name="Name"/></td></tr>'. 459 '<tr><td>Název tabulky v databázi:</td><td>Text<input type="text" name="TablePrefix"/></td></tr>'. 460 '<tr><td colspan="2"><input type="submit" name="add" value="Přidat"/></td></tr>'. 461 '</table></form>'; 456 462 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 457 463 return $Output;
Note:
See TracChangeset
for help on using the changeset viewer.