- Timestamp:
- Nov 26, 2013, 10:12:48 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/FrontPage/FrontPage.php
r603 r608 18 18 $this->System->RegisterPage('', 'PageFrontPage'); 19 19 $this->System->RegisterMenuItem(array( 20 'Title' => 'Domů',21 'Hint' => 'Hlavní stránka',20 'Title' => T('Home'), 21 'Hint' => T('Main page'), 22 22 'Link' => $this->System->Link('/'), 23 23 'Permission' => LICENCE_ANONYMOUS, … … 89 89 { 90 90 $Count = 40; 91 $Output = '<strong> Poslední překlady:</strong>';91 $Output = '<strong>'.T('Last translated').':</strong>'; 92 92 93 93 $GroupListQuery = 'SELECT `Group`.* FROM `Group`'; -
trunk/Modules/News/News.php
r581 r608 33 33 while($DbRow = $DbResult->fetch_assoc()) 34 34 $Output .= '<div><strong>'.$DbRow['Title'].' ('.HumanDate($DbRow['Time']).')</strong> <br />'.$DbRow['Text'].' ('.$DbRow['Name'].')</div>'; 35 $Output .= '<a href="'.$this->System->Link('/news/').'"> Všechny zprávy</a>';35 $Output .= '<a href="'.$this->System->Link('/news/').'">'.T('All news').'</a>'; 36 36 $Output .= '</div>'; 37 37 return($Output); … … 82 82 $Output = '<h3>Novinky</h3>'.$PageList['Output']; 83 83 if($this->System->User->Licence(LICENCE_ADMIN)) 84 $Output .= ' <a href="?a=add"> Vložit</a>';84 $Output .= ' <a href="?a=add">'.T('Add').'</a>'; 85 85 $Output .= '<div class="shoutbox">'; 86 86 $DbResult = $this->System->Database->query('SELECT `News`.`Time`, `News`.`Text`, `News`.`Title`, '. … … 103 103 '<input type="submit" value="Uložit"/><br/>'. 104 104 '</form>'; 105 } else $Output = ShowMessage( 'Nemáte oprávnění', MESSAGE_CRITICAL);105 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 106 106 return($Output); 107 107 } … … 120 120 $Output .= $this->ShowList(); 121 121 } else $Output = ShowMessage('Nezadány údaje', MESSAGE_CRITICAL); 122 } else $Output = ShowMessage( 'Nemáte oprávnění', MESSAGE_CRITICAL);122 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 123 123 return($Output); 124 124 } -
trunk/Modules/User/Profile.php
r577 r608 18 18 if(@mail($Email, $Subject, $Text, 'From: '.$this->System->Config['Web']['AdminEmail'].'\nReply-To: '.$this->System->Config['Web']['AdminEmail'].'\nX-Mailer: PHP/')) 19 19 { 20 $Output .= ShowMessage( 'Zpráva byla odeslána.');20 $Output .= ShowMessage(T('Message was sent.')); 21 21 } 22 22 else $Output .= ShowMessage('Nepodařilo se odesat E-mail.', MESSAGE_CRITICAL); -
trunk/admin/UpdateTrace.php
r605 r608 2623 2623 } 2624 2624 2625 function UpdateTo609($Manager) 2626 { 2627 $Manager->Execute('CREATE TABLE IF NOT EXISTS `Locale` ( 2628 `Id` int(11) NOT NULL AUTO_INCREMENT, 2629 `Language` int(11) NOT NULL, 2630 `Original` varchar(255) NOT NULL, 2631 `Translated` varchar(255) NOT NULL, 2632 `Fuzzy` int(11) NOT NULL, 2633 PRIMARY KEY (`Id`), 2634 KEY `Language` (`Language`) 2635 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;'); 2636 2637 $Manager->Execute('ALTER TABLE `Locale` 2638 ADD CONSTRAINT `Locale_ibfk_1` FOREIGN KEY (`Language`) REFERENCES `Language` (`Id`);'); 2639 } 2640 2625 2641 $Updates = array( 2626 2642 498 => array('Revision' => 506, 'Function' => 'UpdateTo506'), … … 2635 2651 585 => array('Revision' => 600, 'Function' => 'UpdateTo600'), 2636 2652 600 => array('Revision' => 604, 'Function' => 'UpdateTo604'), 2653 604 => array('Revision' => 609, 'Function' => 'UpdateTo609'), 2637 2654 ); -
trunk/admin/index.php
r607 r608 22 22 '<a href="'.$System->Link('/admin/?action=testing').'">Testování</a><br/>'. 23 23 '<small>Testovací funkce</small><br/><br/>'. 24 '<a href="'.$System->Link('/admin/?action=locale').'">Exportovat překlad rozhraní</a><br/>'. 25 '<small>Exportovat texty z PHP souborů pro překlad rozhraní</small><br/><br/>'. 24 26 '<a href="'.$System->Link('/admin/?action=uncomplete').'">Nastavit nekompletní texty</a><br/>'. 25 27 '<small>Nastaví questy, které jsou v popisu nebo objektu stejné jako nedokončené</small><br/><br/>'; … … 88 90 } 89 91 92 function ShowLocale() 93 { 94 global $Locale, $System; 95 96 $Locale->AnalyzeCode(dirname(dirname(__FILE__))); 97 $Locale->UpdateToDatabase($System->Database, 3); 98 $FileName = dirname(dirname(__FILE__)).'/locale/'.$Locale->Texts->Code.'.php'; 99 $Locale->SaveToFile($FileName); 100 $Output = 'Překlad rozhraní přegenerován'; 101 $Output .= '<table class="BaseTable"><tr><th>Originál</th><th>Překlad</th></tr>'; 102 foreach($Locale->Texts->Data as $Index => $Item) 103 $Output .= '<tr><td>'.$Index.'</td><td>'.$Item.'</td></tr>'; 104 $Output .= '</table>'; 105 $Output .= 'Překladová soubor '.$FileName.' zaktualizován'; 106 return($Output); 107 } 108 90 109 $Output = ''; 91 110 if($User->Licence(LICENCE_ADMIN)) … … 99 118 else if($_GET['action'] == 'testing') $Output .= Testing(); 100 119 else if($_GET['action'] == 'phpinfo') $Output .= ShowPHPInfo(); 120 else if($_GET['action'] == 'locale') $Output .= ShowLocale(); 101 121 else if($_GET['action'] == 'uncomplete') $Output .= Uncomplete(); 102 122 else $Output .= ShowMenu(); -
trunk/includes/Database.php
r553 r608 161 161 { 162 162 return(addslashes($Text)); 163 } 164 165 function quote($Text) 166 { 167 return($this->PDO->quote($Text)); 163 168 } 164 169 } -
trunk/includes/Locale.php
r603 r608 4 4 { 5 5 var $Data; 6 var $Code; 6 7 7 8 function __construct() 8 9 { 9 10 $this->Data = array(); 11 $this->Code = 'en'; 10 12 } 11 13 … … 15 17 } 16 18 17 class Locale 19 class Locale extends Model 18 20 { 19 21 var $Texts; … … 42 44 $this->Texts->Load(); 43 45 } 46 47 function AnalyzeCode($Path) 48 { 49 // Search for php files 50 $FileList = scandir($Path); 51 foreach($FileList as $FileName) 52 { 53 $FullName = $Path.'/'.$FileName; 54 if(($FileName == '.') or ($FileName == '..')) ; // Skip virtual items 55 else if(substr($FileName, 0, 1) == '.') ; // Skip Linux hidden files 56 else if(is_dir($FullName)) $this->AnalyzeCode($FullName); 57 else if(file_exists($FullName)) 58 { 59 if(substr($FullName, -4) == '.php') 60 { 61 $Content = file_get_contents($FullName); 62 // Search occurence of T() function 63 while(strpos($Content, 'T(') !== false) 64 { 65 $Previous = strtolower(substr($Content, strpos($Content, 'T(') - 1, 1)); 66 $Content = substr($Content, strpos($Content, 'T(') + 2); 67 $Ord = ord($Previous); 68 //echo($Ord.','); 69 if(!(($Ord >= ord('a')) and ($Ord <= ord('z')))) 70 { 71 // Do for non-alpha previous character 72 $Original = substr($Content, 0, strpos($Content, ')')); 73 $Original2 = ''; 74 if((substr($Original, 0, 1) == "'") and (substr($Original, -1, 1) == "'")) 75 $Original2 = substr($Original, 1, -1); 76 if((substr($Original, 0, 1) == '"') and (substr($Original, -1, 1) == '"')) 77 $Original2 = substr($Original, 1, -1); 78 if($Original2 != '') 79 { 80 if(!array_key_exists($Original2, $this->Texts->Data)) 81 $this->Texts->Data[$Original2] = ''; 82 } 83 } 84 } 85 } 86 } 87 } 88 } 89 90 function SaveToFile($FileName) 91 { 92 $Content = '<?php'."\n". 93 ''."\n". 94 'class LocaleText'.$this->Texts->Code.' extends LocaleText'."\n". 95 '{'."\n". 96 ' function Load()'."\n". 97 ' {'."\n". 98 ' $this->Code = \'cs\';'."\n". 99 ' $this->Data = array('."\n"; 100 foreach($this->Texts->Data as $Index => $Item) 101 { 102 $Content .= " '".$Index."' => '".$Item."',\n"; 103 } 104 $Content .= ' );'."\n". 105 ' }'."\n". 106 '}'."\n"; 107 file_put_contents($FileName, $Content); 108 } 109 110 function LoadFromDatabase($Database, $LanguageId) 111 { 112 $this->Texts->Data = array(); 113 $DbResult = $Database->select('Locale', '`Original`, `Translated`', '`Language`='.$LanguageId * 1); 114 while($DbRow = $DbResult->fetch_assoc()) 115 $this->Texts->Data[$DbRow['Original']] = $DbRow['Translated']; 116 } 117 118 function SaveToDatabase(Database $Database, $LanguageId) 119 { 120 $Database->delete('Locale', '`Language`='.$LanguageId * 1); 121 foreach($this->Texts->Data as $Index => $Item) 122 $Database->query('INSERT INTO `Locale` (`Language`,`Original`,`Translated`) '. 123 'VALUES('.$LanguageId.','.$Database->quote($Index).','.$Database->quote($Item).')'); 124 } 125 126 function UpdateToDatabase(Database $Database, $LanguageId) 127 { 128 foreach($this->Texts->Data as $Index => $Item) 129 { 130 $DbResult = $Database->select('Locale', '*', '`Original` ='.$Database->quote($Index)); 131 if($DbResult->num_rows > 0) 132 $Database->update('Locale', '(`Language`='.($LanguageId * 1).') AND '. 133 '(`Original` ='.$Database->quote($Index).')', array('Translated' => $Item)); 134 else $Database->insert('Locale', array('Language' => $LanguageId * 1, 135 'Original' => $Index, 'Translated' => $Item)); 136 } 137 } 44 138 } 45 139 -
trunk/includes/Version.php
r607 r608 6 6 // and system will need database update. 7 7 8 $Revision = 60 7; // Subversion revision9 $DatabaseRevision = 60 4; // Database structure revision8 $Revision = 608; // Subversion revision 9 $DatabaseRevision = 608; // Database structure revision 10 10 $ReleaseTime = '2013-11-26'; -
trunk/locale/cs.php
r603 r608 1 1 <?php 2 2 3 class LocaleText Cs extends LocaleText3 class LocaleTextcs extends LocaleText 4 4 { 5 function Load() 6 { 7 $this->Data = array( 8 'Access denied' => 'Nemáte oprávnění', 9 'Show welcome' => 'Odkrýt úvod', 10 'Hide welcome' => 'Skrýt úvod', 11 'Registration' => 'Registrace', 12 'Menu' => 'Nabídka', 13 ); 14 } 5 function Load() 6 { 7 $this->Code = 'cs'; 8 $this->Data = array( 9 'Access denied' => 'Nemáte oprávnění', 10 'Show welcome' => 'Odkrýt úvod', 11 'Hide welcome' => 'Skrýt úvod', 12 'Registration' => 'Registrace', 13 'Menu' => 'Nabídka', 14 'Home' => 'Domů', 15 'Main page' => 'Hlavní stránka', 16 'Last translated' => 'Poslední překlady', 17 'All news' => 'Všechny zprávy', 18 'Add' => 'Vložit', 19 'Message was sent.' => 'Zpráva byla odeslána.', 20 ); 21 } 15 22 } 16
Note:
See TracChangeset
for help on using the changeset viewer.