Changeset 843 for trunk


Ignore:
Timestamp:
Jan 14, 2016, 10:25:47 PM (9 years ago)
Author:
chronos
Message:
  • Added: Support for translatable URLs. Now each language can have URL in its language.

This requires to all links inside web to use System->Link function which is responsible for translation.
All links need to be written in english so they can be translated to other language.

Location:
trunk
Files:
23 edited

Legend:

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

    r838 r843  
    4444    {
    4545      $YesNo = array('Ne', 'Ano');
    46       $DbResult = $this->System->Database->query('SELECT * FROM ClientVersion WHERE Id='.($_GET['id']*1));
     46      $DbResult = $this->System->Database->query('SELECT * FROM `ClientVersion` WHERE `Id`='.($_GET['id']*1));
    4747      if($DbResult->num_rows > 0)
    4848      {
     
    6161        $Output .= '<div><a href="?">'.T('All versions list').'</a></div>';
    6262        if($Version['Imported'])
    63           $Output .= '<div><a href="'.$this->System->Link('/progress/?Version='.$Version['Version']).'">'.T('Progress').'</a></div>';
     63          $Output .= '<div><a href="'.$this->System->Link('/progress/?Version='.
     64            $Version['Version']).'">'.T('Progress').'</a></div>';
    6465      } else $Output = ShowMessage(T('Item not found'), MESSAGE_CRITICAL);
    6566    } else $Output = ShowMessage(T('Item not found'), MESSAGE_CRITICAL);
  • trunk/Modules/Dictionary/Dictionary.php

    r841 r843  
    292292      if(!is_numeric($_SESSION['language'])) $Output .= '<td>'.$Line['LangName'].'</td>';
    293293      $Output .= '<td>'.$Line['Description'].'</td>'.
    294         '<td><a href="'.$this->System->Link('/user.php?user='.$Line['UserId']).'">'.
     294        '<td><a href="'.$this->System->Link('/user/?user='.$Line['UserId']).'">'.
    295295        $Line['UserName'].'</a></td>';
    296296      if($this->System->User->Licence(LICENCE_USER))
  • trunk/Modules/Download/Download.php

    r838 r843  
    3232  {
    3333    $fileslink = $this->System->Link('/files');
    34 $Output = '<h3>'.T('Accessories for client').'</h3>'.
     34    $Output = '<h3>'.T('Accessories for client').'</h3>'.
    3535  '<strong><a href="'.$fileslink.'/WowLua/wowpatcher.exe">wowpatcher</a></strong> - '.T('Tool to command line, which search and edit file wow.exe for support editing files Glue Strings.lua and GlobalStrings.lua.').' '.
    3636  T('Designed for one-time creation of new modified version of wow.exe. Help can be called with the - help option. The ability to modify future versions not guaranteed.').' '.
     
    8181    $Output = '<h3>'.T('Download czech').'</h3><br />';
    8282
    83     $Output .= T('Additional files: modified wow.exe, fonts to game, translated interface aowow and more can be found on page').' <a href="'.$this->System->Link('/download/?Files').'">'.T('Files').'</a><br />';
     83    $Output .= T('Additional files: modified wow.exe, fonts to game, translated interface aowow and more can be found on page').
     84      ' <a href="'.$this->System->Link('/download/?Files').'">'.T('Files').'</a><br />';
    8485    $Output .= T('If none of these files is suitable for you, for example, to the Czech without the translated interface. You can generate your own section in section').' <a href="'.$this->System->Link('/export').'">'.T('Export').'</a><br /><br />';
    8586    $Output .= T('The following files are generated every day, if needed. That means if is added new translation to database. Therefore, if you translate a translation or correct the mistake, tomorrow you can download the new patched version. Or you can rebuild and download for a few minutes the repaired file.').'<br />';
  • trunk/Modules/Export/Page.php

    r841 r843  
    6969      if($this->System->User->Id != null) $Action .= ' <a href="?Action=Clone&amp;ExportId='.$Export['Id'].'" onclick="return confirmAction(\''.T('Realy clone item?').'\');">'.T('Clone').'</a>';
    7070      $Output .= '<tr><td>'.HumanDate($Export['TimeCreate']).'</td>'.
    71           '<td><a href="'.$this->System->Link('/user.php?user='.$Export['User']).'">'.$Export['UserName'].'</a></td>'.
     71          '<td><a href="'.$this->System->Link('/user/?user='.$Export['User']).'">'.$Export['UserName'].'</a></td>'.
    7272          '<td>'.$Export['Title'].'</td>'.
    7373          '<td>'.$Export['OutputType'].'</td>'.
     
    753753        $UserLine = $DbResult->fetch_assoc();
    754754        $Output .= 'Export <strong><a href="?Action=View&amp;Tab=6&amp;ExportId='.$Export['Id'].'">'.$_GET['ExportId'].'</a></strong> překladatele <strong>'.$UserLine['Name'].'</strong> s označením <strong>'.$Export['Title'].'</strong>';
    755         $Output .= ShowTabs(array(T('General'), T('Translators'), 'Překlady', T('Languages'), T('Format'), T('Version'), T('Statistic'), T('Output')));
     755        $Output .= ShowTabs(array(T('General'), T('Translators'), T('Translations'), T('Languages'), T('Format'), T('Version'), T('Statistic'), T('Output')));
    756756        $Output .= '<div id="content">';
    757757        if($_SESSION['Tab'] == TAB_GENERAL) $Output .= $this->ExportViewGeneral();
  • trunk/Modules/FrontPage/FrontPage.php

    r838 r843  
    120120      {
    121121        $Output .= '<tr><td>'.HumanDate($DbRow['ModifyTime']).'</td>'.
    122             '<td><a href="user.php?user='.$DbRow['UserId'].'">'.$DbRow['UserName'].'</a></td>'.
    123             '<td><a href="form.php?group='.$DbRow['Group'].'&amp;ID='.$DbRow['ID'].'">'.$DbRow['ID'].'</a></td>'.
    124             '<td><a href="form.php?group='.$DbRow['Group'].'&amp;ID='.$DbRow['Take'].'">'.$DbRow['Take'].'</a></td>'.
    125             '<td><a href="TranslationList.php?group='.$DbRow['Group'].'&amp;action=filter">'.$DbRow['GroupName'].'</a></td></tr>';
     122            '<td><a href="'.$this->System->Link('/user/?user='.$DbRow['UserId']).'">'.$DbRow['UserName'].'</a></td>'.
     123            '<td><a href="'.$this->System->Link('/form.php?group='.$DbRow['Group'].'&amp;ID='.$DbRow['ID']).'">'.$DbRow['ID'].'</a></td>'.
     124            '<td><a href="'.$this->System->Link('/form.php?group='.$DbRow['Group'].'&amp;ID='.$DbRow['Take']).'">'.$DbRow['Take'].'</a></td>'.
     125            '<td><a href="'.$this->System->Link('/TranslationList.php?group='.$DbRow['Group'].'&amp;action=filter').'">'.$DbRow['GroupName'].'</a></td></tr>';
    126126      }
    127127      $Output .= '</table>';
  • trunk/Modules/Log/Log.php

    r842 r843  
    194194      if($_SESSION['type'] == '') $Output .= '<td>'.$Line['LogName'].'</td>';
    195195      $Output .= '<td><span style="color: '.$Line['LogColor'].'">'.$Line['Text'].'</span></td>'.
    196       '<td><a href="'.$this->System->Link('/user.php?user='.$Line['User']).'">'.$Line['UserName'].'</a></td>'.
     196      '<td><a href="'.$this->System->Link('/user/?user='.$Line['User']).'">'.$Line['UserName'].'</a></td>'.
    197197      '<td>'.$Line['IP'].'</td>'.
    198198      '<td>'.$Line['URL'].'</td></tr>';
  • trunk/Modules/Redirection/Redirection.php

    r838 r843  
    3737      if($this->System->PathItems[0] == 'phpbb3') $Output = $this->Redirect($this->System->Link('/forum/'));
    3838      if($this->System->PathItems[0] == 'statistic.php') $Output = $this->Redirect($this->System->Link('/progress/'));
    39       if($this->System->PathItems[0] == 'register.php') $Output = $this->Redirect($this->System->Link('/registrace.php'));
     39      if($this->System->PathItems[0] == 'register.php') $Output = $this->Redirect($this->System->Link('/registration/'));
    4040      if($this->System->PathItems[0] == 'dictionary.php') $Output = $this->Redirect($this->System->Link('/dictionary/'));
    4141      if($this->System->PathItems[0] == 'download-addon.php') $Output = $this->Redirect($this->System->Link('/download/'));
     
    4646      {
    4747        if(($this->System->PathItems[0] == 'team') and ($this->System->PathItems[1] == 'userlist.php'))
    48           $Output = $this->Redirect($this->System->Link('/userlist.php'));
     48          $Output = $this->Redirect($this->System->Link('/userlist/'));
    4949        if(($this->System->PathItems[0] == 'dictionary') and ($this->System->PathItems[1] == 'user.php'))
    50           $Output = $this->Redirect($this->System->Link('/user.php'));
     50          $Output = $this->Redirect($this->System->Link('/user/'));
    5151        if(($this->System->PathItems[0] == 'forum') and ($this->System->PathItems[1] == 'index.php'))
    5252          $Output = $this->Redirect($this->System->Link('/forum/'));
  • trunk/Modules/Team/Team.php

    r838 r843  
    7777        '<td><a href="?action=team&amp;id='.$Team['Id'].'">'.$Team['Name'].'</a></td>'.
    7878        '<td><a href="http://'.$Team['URL'].'">'.$Team['URL'].'</a></td>'.
    79         '<td><a href="'.$this->System->Link('/user.php?user='.$Team['Leader']).'">'.$Team['LeaderName'].'</a></td>'.
    80         '<td><a href="'.$this->System->Link('/userlist.php?team='.$Team['Id']).'" title="Zobrazit členy týmu">'.$Team['NumberUser'].'</a></td>'.
     79        '<td><a href="'.$this->System->Link('/user/?user='.$Team['Leader']).'">'.$Team['LeaderName'].'</a></td>'.
     80        '<td><a href="'.$this->System->Link('/users/?team='.$Team['Id']).'" title="Zobrazit členy týmu">'.$Team['NumberUser'].'</a></td>'.
    8181        '<td>'.HumanDate($Team['TimeCreate']).'</td>';
    8282      if($this->System->User->Licence(LICENCE_USER))
     
    232232        $Output .='<h3>Překladatelský tým '.$Team['Name'].'</h3><br />'.
    233233          'Webové stránky: <a href="http://'.$Team['URL'].'">'.$Team['URL'].'</a><br/>'.
    234           'Vedoucí: <a href="'.$this->System->Link('/user.php?user='.$Leader['Id']).'">'.$Leader['Name'].'</a><br/>';
     234          'Vedoucí: <a href="'.$this->System->Link('/user/?user='.$Leader['Id']).'">'.$Leader['Name'].'</a><br/>';
    235235        if($Team['Description'] != '')
    236236          $Output .= 'Popis: '.$Team['Description'].'<br />';
  • trunk/Modules/Translation/Form.php

    r836 r843  
    9191
    9292          if(($Line['Language'] <> 0) and ($LineUser['Name'] <> ''))
    93             $Output .= 'Přeložil: <a href="'.$this->System->Link('/user.php?user='.$Line['User']).'"><strong>'.$LineUser['Name'].'</strong></a> dne '.HumanDate($Line['ModifyTime']).'<br />';
     93            $Output .= 'Přeložil: <a href="'.$this->System->Link('/user/?user='.$Line['User']).'"><strong>'.$LineUser['Name'].'</strong></a> dne '.HumanDate($Line['ModifyTime']).'<br />';
    9494          if(($Line['Take'] <> 0) and ($Line['Take'] <> $Line['ID']))
    9595          {
  • trunk/Modules/Translation/LoadNames.php

    r816 r843  
    1515    } else {
    1616      $Text = str_replace(' '.$orig,' <span Title="Přelož jako:&nbsp;'.$tran_replace.
    17         '" class="edit"><a class="edit" target="_NEW2" href="'.$this->System->Link('/dictionary/?search='.$tran).'">'.$orig_replace.'</a></span>',$Text);
     17        '" class="edit"><a class="edit" target="_NEW2" href="'.$this->System->Link('/'.T('dictionary', 'URL').'/?search='.$tran).'">'.$orig_replace.'</a></span>',$Text);
    1818    }
    1919  //   }
  • trunk/Modules/Translation/Translation.php

    r842 r843  
    3030    $this->System->RegisterPage('save.php', 'PageTranslationSave');
    3131    $this->System->RegisterPage('progress', 'PageProgress');
     32    $this->System->RegisterPage('translation-groups', 'PageTranslationGroups');
    3233    $this->System->RegisterPage('TranslationList.php', 'PageTranslationList');
    3334    $this->System->RegisterPage('LoadNames.php', 'PageLoadNames');
     
    4445      'Title' => T('Data source'),
    4546      'Hint' => 'Informace o překladových skupinách',
    46       'Link' => $this->System->Link('/TranslationList.php?action=grouplist'),
     47      'Link' => $this->System->Link('/translation-groups/'),
    4748      'Permission' => LICENCE_ANONYMOUS,
    4849      'Icon' => '',
  • trunk/Modules/Translation/TranslationList.php

    r842 r843  
    2424    $Output = '<form action="?" method="post">'.
    2525        '<table class="BaseTable"><tr>'.
    26         '<th>Zpracování</th>'.
    27         '<th>Skupina</th>'.
    28         '<th>Verze</th>'.
    29         '<th>Jazyk</th>'.
    30         '<th>Překladatel</th>'.
    31         '<th>Slova</th>'.
    32         '<th>Položka</th>'.
     26        '<th>'.T('Processing').'</th>'.
     27        '<th>'.T('Group').'</th>'.
     28        '<th>'.T('Version').'</th>'.
     29        '<th>'.T('Language').'</th>'.
     30        '<th>'.T('Translator').'</th>'.
     31        '<th>'.T('Words').'</th>'.
     32        '<th>'.T('Item').'</th>'.
    3333        '<th></th></tr><tr>';
    3434
     
    3737    $Output .= '<td><select name="state">';
    3838    $StateTypes = array(
    39       CompletionState::All => 'Všechny',
    40       CompletionState::NotTranslated => 'Nepřeložené',
    41       CompletionState::Translated => 'Přeložené',
    42       CompletionState::NotFinished => 'Rozpracované',
    43       CompletionState::Original => 'Anglické',
    44       CompletionState::NotFinishedNotTranslated => 'Rozpracované-Nepřeložené',
    45       CompletionState::Missing1 => 'Chybějící $ ($N,$s..)',
    46       CompletionState::Missing2 => 'Chybějící $-Neopravený'
     39      CompletionState::All => T('All'),
     40      CompletionState::NotTranslated => T('Not translated'),
     41      CompletionState::Translated => T('Translated'),
     42      CompletionState::NotFinished => T('Unfinished'),
     43      CompletionState::Original => T('Original'),
     44      CompletionState::NotFinishedNotTranslated => T('Unfinished - Not translated'),
     45      CompletionState::Missing1 => T('Missing $ ($N,$s..)'),
     46      CompletionState::Missing2 => T('Missing $ - Not fixed'),
    4747    );
    48     foreach ($StateTypes as $index=>$StateType) {
     48    foreach ($StateTypes as $index => $StateType) {
    4949      if($Filter['State'] == $index) $Selected = ' selected="selected"';
    5050      else $Selected = '';
     
    7171    if($Filter['Group'] == 0) $Selected = ' selected="selected"';
    7272    else $Selected = '';
    73     $Output .= '<option value="0"'.$Selected.'>Všechny</option>';
     73    $Output .= '<option value="0"'.$Selected.'>'.T('All').'</option>';
    7474    $DbResult = $this->Database->query('SELECT `Id`,`Name` FROM `Group` ORDER BY `Name`');
    7575    while($Group = $DbResult->fetch_assoc())
     
    9797    if($Filter['Version'] == 0) $Selected = ' selected="selected"';
    9898    else $Selected = '';
    99     $Output .= '<option value="0"'.$Selected.'>Všechny</option>';
     99    $Output .= '<option value="0"'.$Selected.'>'.T('All').'</option>';
    100100    $DbResult = $this->Database->query('SELECT `Id`, `BuildNumber`,`Version` FROM `ClientVersion` WHERE `Imported` = 1 ORDER BY `BuildNumber` DESC');
    101101    while($Version = $DbResult->fetch_assoc())
     
    136136    if($Filter['User'] == 0) $Selected = ' selected="selected"';
    137137    else $Selected = '';
    138     $Output .= '<option value="0"'.$Selected.'>Všichni</option>';
     138    $Output .= '<option value="0"'.$Selected.'>'.T('All').'</option>';
    139139    $DbResult = $this->Database->query('SELECT `Id`, `Name` FROM `User` ORDER BY `Name`');
    140140    while($User = $DbResult->fetch_assoc())
     
    238238    */
    239239
    240     $Output .= '<td><input type="submit" value="Filtrovat"/></td>';
     240    $Output .= '<td><input type="submit" value="'.T('Filter').'"/></td>';
    241241    $Output .= '</tr></table>';
    242242    $Output .= '</form><br/>';
     
    270270    $Output .= $PageList['Output'];
    271271    $TableColumns = array(
    272         array('Name' => 'ID', 'Title' => 'Číslo'),
    273         array('Name' => 'Entry', 'Title' => 'Položka'),
    274         array('Name' => $TranslationTree[$Filter['Group']]['Items'][0]['Column'], 'Title' => 'Název'),
    275         array('Name' => 'VersionStart', 'Title' => 'Verze od'),
    276         array('Name' => 'VersionEnd', 'Title' => 'Verze do'),
    277         array('Name' => 'LanguageName', 'Title' => 'Jazyk'),
    278         array('Name' => 'UserName', 'Title' => 'Překladatel'),
    279         array('Name' => 'ModifyTime', 'Title' => 'Datum'),
     272        array('Name' => 'ID', 'Title' => T('Number')),
     273        array('Name' => 'Entry', 'Title' => T('Item')),
     274        array('Name' => $TranslationTree[$Filter['Group']]['Items'][0]['Column'], 'Title' => T('Name')),
     275        array('Name' => 'VersionStart', 'Title' => T('From version')),
     276        array('Name' => 'VersionEnd', 'Title' => T('To version')),
     277        array('Name' => 'LanguageName', 'Title' => T('Language')),
     278        array('Name' => 'UserName', 'Title' => T('Translator')),
     279        array('Name' => 'ModifyTime', 'Title' => T('Date')),
    280280    );
    281281
     
    295295          GetVersionWOWId($Line['VersionEnd'])).'">'.GetVersionWOW($Line['VersionEnd']).'</a></td>'.
    296296        '<td>'.$Line['LanguageName'].'</td>'.
    297         '<td><a href="user.php?user='.$Line['UserId'].'">'.$Line['UserName'].'</a></td>'.
     297        '<td><a href="'.$this->System->Link('/user/?user='.$Line['UserId']).'">'.$Line['UserName'].'</a></td>'.
    298298        '<td>'.HumanDate($Line['ModifyTime']).'</td>'.
    299299        '</tr>';
     
    310310    $Output = $Filter['Output'];
    311311
    312     $Output .= '<table class="BaseTable"><tr><th>Skupina</th><th>Počet</th></tr>';
     312    $Output .= '<table class="BaseTable"><tr><th>'.T('Group').'</th><th>'.T('Count').'</th></tr>';
    313313    $Total = 0;
    314314    foreach($TranslationTree as $Group)
     
    322322        $Total += $Line[0];
    323323      }
    324       $Output .= '<tr><td><strong>Celkem</strong></td><td><strong>'.$Total.'</strong></td></tr>'.
     324      $Output .= '<tr><td><strong>'.T('Total').'</strong></td><td><strong>'.$Total.'</strong></td></tr>'.
    325325          '</table>';
    326326      return($Output);
    327   }
    328 
    329   function ShowGroupTypeList()
    330   {
    331     $DbResult = $this->Database->query('SELECT COUNT(*) FROM `Group`');
    332     $DbRow = $DbResult->fetch_row();
    333     $PageList = GetPageList($DbRow[0]);
    334     $Output = '<h3>'.T('List of translation groups').'</h3>'.
    335         $PageList['Output'];
    336 
    337     $Output .= '<table class="BaseTable">';
    338     $TableColumns = array(
    339         array('Name' => 'Name', 'Title' => T('Name')),
    340         array('Name' => 'SourceType', 'Title' => T('Source type')),
    341         array('Name' => '', 'Title' => T('Sources')),
    342         array('Name' => 'LastImport', 'Title' => T('Date of last import')),
    343         array('Name' => 'LastVersion', 'Title' => T('Version of last import')),
    344     );
    345     if($this->System->User->Licence(LICENCE_ADMIN))
    346       $TableColumns[] = array('Name' => '', 'Title' => T('Actions'));
    347 
    348     $Order = GetOrderTableHeader($TableColumns, 'Name', 0);
    349     $Output .= $Order['Output'];
    350 
    351     $DbResult = $this->Database->query('SELECT * FROM `Group`'.$Order['SQL'].$PageList['SQLLimit']);
    352     while($Group = $DbResult->fetch_assoc())
    353     {
    354       $Output .= '<tr><td><a href="?group='.$Group['Id'].'&amp;action=filter">'.$Group['Name'].'</a></td>'.
    355       '<td>'.$Group['SourceType'].'</td><td>';
    356       if($Group['MangosTable'] != '') $Output .= $Group['MangosTable'].'.sql ';
    357       if($Group['DBCFileName'] != '') $Output .= $Group['DBCFileName'].'.dbc ';
    358       if($Group['LuaFileName'] != '') $Output .= $Group['LuaFileName'].'.lua ';
    359       $Output .= '</td>';
    360       if($this->System->User->Licence(LICENCE_ADMIN))
    361         $Output .= '<td><a title="Změny po posledním importu u vybrané překladové skupiny" href="'.$this->System->Link('/log/?group='.
    362           $Group['Id'].'&amp;type=11').'">'.HumanDate($Group['LastImport']).'</a></td>';
    363         else $Output .= '<td>'.HumanDate($Group['LastImport']).'</td>';
    364       $Output .= '<td><a href="'.$this->System->Link('/client-version/?action=item&amp;id='.
    365         GetVersionWOWId($Group['LastVersion'])).'">'.GetVersionWOW($Group['LastVersion']).'</a></td>';
    366       if($this->System->User->Licence(LICENCE_ADMIN))
    367         $Output .= '<td><a href="?action=groupdelete&amp;id='.$Group['Id'].'">'.T('Remove').'</a></td>';
    368       $Output .= '</tr>';
    369 
    370     }
    371     $Output .= '</table>'.
    372         '<br /><a title="'.T('Changelog of changes after import').'" href="'.$this->System->Link('/log/?type=11').'">'.T('Changelog of text modification during import').'</a><br/>';
    373     if($this->System->User->Licence(LICENCE_ADMIN)) $Output .= '<a href="?action=groupadd">'.T('Add translation group').'</a>';
    374     return($Output);
    375327  }
    376328
     
    417369      $Output .= '</table>';
    418370    }
     371    return($Output);
     372  }
     373
     374  function Show()
     375  {
     376    $this->Title = T('Translation groups');
     377    $Action = GetParameter('action', '');
     378    if($Action == 'filter') $Output = $this->ShowMenu();
     379    else
     380    {
     381      $Filter = $this->ShowFilter();
     382      if($Filter['Group'] > 0) $Output = $this->ShowTranslationList($Filter);
     383      else $Output = $this->ShowGroupList($Filter);
     384    }
     385    return($Output);
     386  }
     387}
     388
     389class PageTranslationGroups extends Page
     390{
     391  function ShowList()
     392  {
     393    $DbResult = $this->Database->query('SELECT COUNT(*) FROM `Group`');
     394    $DbRow = $DbResult->fetch_row();
     395    $PageList = GetPageList($DbRow[0]);
     396    $Output = '<h3>'.T('List of translation groups').'</h3>'.
     397    $PageList['Output'];
     398
     399    $Output .= '<table class="BaseTable">';
     400    $TableColumns = array(
     401      array('Name' => 'Name', 'Title' => T('Name')),
     402      array('Name' => 'SourceType', 'Title' => T('Source type')),
     403      array('Name' => '', 'Title' => T('Sources')),
     404      array('Name' => 'LastImport', 'Title' => T('Date of last import')),
     405      array('Name' => 'LastVersion', 'Title' => T('Version of last import')),
     406   );
     407   if($this->System->User->Licence(LICENCE_ADMIN))
     408   $TableColumns[] = array('Name' => '', 'Title' => T('Actions'));
     409
     410   $Order = GetOrderTableHeader($TableColumns, 'Name', 0);
     411   $Output .= $Order['Output'];
     412
     413   $DbResult = $this->Database->query('SELECT * FROM `Group`'.$Order['SQL'].$PageList['SQLLimit']);
     414   while($Group = $DbResult->fetch_assoc())
     415   {
     416     $Output .= '<tr><td><a href="?group='.$Group['Id'].'&amp;action=filter">'.$Group['Name'].'</a></td>'.
     417       '<td>'.$Group['SourceType'].'</td><td>';
     418     if($Group['MangosTable'] != '') $Output .= $Group['MangosTable'].'.sql ';
     419     if($Group['DBCFileName'] != '') $Output .= $Group['DBCFileName'].'.dbc ';
     420     if($Group['LuaFileName'] != '') $Output .= $Group['LuaFileName'].'.lua ';
     421     $Output .= '</td>';
     422     if($this->System->User->Licence(LICENCE_ADMIN))
     423       $Output .= '<td><a title="Změny po posledním importu u vybrané překladové skupiny" href="'.$this->System->Link('/log/?group='.
     424     $Group['Id'].'&amp;type=11').'">'.HumanDate($Group['LastImport']).'</a></td>';
     425       else $Output .= '<td>'.HumanDate($Group['LastImport']).'</td>';
     426     $Output .= '<td><a href="'.$this->System->Link('/client-version/?action=item&amp;id='.
     427       GetVersionWOWId($Group['LastVersion'])).'">'.GetVersionWOW($Group['LastVersion']).'</a></td>';
     428     if($this->System->User->Licence(LICENCE_ADMIN))
     429       $Output .= '<td><a href="?action=groupdelete&amp;id='.$Group['Id'].'">'.T('Remove').'</a></td>';
     430     $Output .= '</tr>';
     431    }
     432    $Output .= '</table>'.
     433      '<br /><a title="'.T('Changelog of changes after import').'" href="'.$this->System->Link('/log/?type=11').'">'.T('Changelog of text modification during import').'</a><br/>';
     434    if($this->System->User->Licence(LICENCE_ADMIN)) $Output .= '<a href="?action=groupadd">'.T('Add translation group').'</a>';
    419435    return($Output);
    420436  }
     
    478494    $Output = ShowMessage('Překladová skupina vytvořena', MESSAGE_INFORMATION);
    479495      } else $Output = ShowMessage('Překladová skupina '.$TableName.' již existuje', MESSAGE_CRITICAL);
    480       $Output .= $this->ShowGroupTypeList();
     496      $Output .= $this->ShowList();
    481497    } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL);
    482498    return($Output);
     
    497513      } else $Output = ShowMessage('Překladová skupina nenalezena', MESSAGE_CRITICAL);
    498514    } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL);
    499     $Output .= $this->ShowGroupTypeList();
     515    $Output .= $this->ShowList();
    500516    return($Output);
    501517  }
     
    506522    $Action = GetParameter('action', '');
    507523    if($Action == 'filter') $Output = $this->ShowMenu();
    508     else if($Action == 'grouplist') $Output = $this->ShowGroupTypeList();
    509524    else if($Action == 'groupadd') $Output = $this->ShowGroupAdd();
    510525    else if($Action == 'groupdelete') $Output = $this->ShowGroupDelete();
    511526    else if($Action == 'groupaddfinish') $Output = $this->ShowGroupAddFinish();
    512     else
    513     {
    514       $Filter = $this->ShowFilter();
    515       if($Filter['Group'] > 0) $Output = $this->ShowTranslationList($Filter);
    516       else $Output = $this->ShowGroupList($Filter);
    517     }
     527    else $Output = $this->ShowList();
    518528    return($Output);
    519529  }
  • trunk/Modules/User/Profile.php

    r837 r843  
    159159        T('Level:').' <strong>'.$XP['Level'].'</strong> '.T('experience:').' '.ProgressBar(150, round($XP['XP'] / $XP['MaxXP'] * 100, 2), $XP['XP'].' / '.$XP['MaxXP']).'<br/>';
    160160      if($UserLine['TeamName'] != '')
    161         $Output .= T('Member of team:').' <a href="team/?action=team&amp;id='.$UserLine['Team'].'"><strong>'.$UserLine['TeamName'].'</strong></a><br />';
     161        $Output .= T('Member of team:').' <a href="'.$this->System->Link('/team/?action=team&amp;id='.$UserLine['Team']).'"><strong>'.$UserLine['TeamName'].'</strong></a><br />';
    162162
    163163      // User tags
     
    222222          'Prohlížeč: <strong>'.$UserLine['UserAgent'].'</strong><br />'.
    223223          'Email: <strong>'.$UserLine['Email'].'</strong><br />';
    224       $Output .= '<br/><form action="user.php" method="post"><div>'.
     224      $Output .= '<br/><form action="'.$this->System->Link('/user/').'" method="post"><div>'.
    225225        'Napsat E-mail:'.
    226226        '<input type="text" name="email" value="'.$UserLine['Email'].'" /><br/>'.
  • trunk/Modules/User/Registration.php

    r837 r843  
    1919    <fieldset><legend>'.T('New user registration').'</legend>
    2020    <table>
    21     <tr><td colspan="2">'.T('Please read carefully <a href="info.php">translation guidelines</a> and follow them. Translate with diacritics!').'<br/><br/></td></tr>
     21    <tr><td colspan="2">'.T('Please read carefully <a href="'.$this->System->Link('/info/').'">translation guidelines</a> and follow them. Translate with diacritics!').'<br/><br/></td></tr>
    2222    <tr>
    2323    <th class="Left">'.T('Are you human?').'</th>';
  • trunk/Modules/User/User.php

    r838 r843  
    2222  {
    2323    $this->System->User = new User($this->System);
    24     $this->System->RegisterPage('userlist.php', 'PageUserList');
    25     $this->System->RegisterPage('Options.php', 'PageUserOptions');
    26     $this->System->RegisterPage('registrace.php', 'PageUserRegistration');
    27     $this->System->RegisterPage('user.php', 'PageUserProfile');
     24    $this->System->RegisterPage('users', 'PageUserList');
     25    $this->System->RegisterPage('options', 'PageUserOptions');
     26    $this->System->RegisterPage('registration', 'PageUserRegistration');
     27    $this->System->RegisterPage('user', 'PageUserProfile');
    2828    $this->System->RegisterPage('login', 'PageUserLogin');
    2929    $this->System->RegisterMenuItem(array(
    3030      'Title' => T('Translators'),
    3131      'Hint' => 'Seznam registrovaných uživatelů',
    32       'Link' => $this->System->Link('/userlist.php'),
     32      'Link' => $this->System->Link('/users/'),
    3333      'Permission' => LICENCE_ANONYMOUS,
    3434      'Icon' => '',
     
    3636    if(array_key_exists('Search', $this->System->ModuleManager->Modules))
    3737      $this->System->ModuleManager->Modules['Search']->RegisterSearch('user',
    38       T('Translators'), array('Name'), '`User`', $this->System->Link('/userlist.php?search='));
     38      T('Translators'), array('Name'), '`User`', $this->System->Link('/users/?search='));
    3939  }
    4040
     
    4343    $Output = T('Online translators').':<br />';
    4444    $DbResult = $this->System->Database->query('SELECT * FROM ('.
    45 'SELECT `User`.`Name`, `User`.`ID` FROM `UserOnline` '.
    46         'JOIN `User` ON `User`.`ID` = `UserOnline`.`User` '.
    47         'WHERE (`ActivityTime` >= NOW() - 300) '.
    48         'ORDER BY `ActivityTime` DESC ) AS `T` GROUP BY `Name`');
     45      'SELECT `User`.`Name`, `User`.`ID` FROM `UserOnline` '.
     46      'JOIN `User` ON `User`.`ID` = `UserOnline`.`User` '.
     47      'WHERE (`ActivityTime` >= NOW() - 300) '.
     48      'ORDER BY `ActivityTime` DESC ) AS `T` GROUP BY `Name`');
    4949    while($DbUser = $DbResult->fetch_assoc())
    5050    {
    51       $Name = '<a href="'.$this->System->Link('/user.php?user='.$DbUser['ID']).'">'.$DbUser['Name'].'</a>';
     51      $Name = '<a href="'.$this->System->Link('/user/?user='.$DbUser['ID']).'">'.$DbUser['Name'].'</a>';
    5252      $Output .= $Name.'<br />';
    5353    }
     
    124124      // Prepare cookies for permanent login
    125125      $StayLoggedSalt = $this->GetPasswordSalt();
    126       $this->Database->update('UserOnline', 'SessionId="'.$SID.'"', array(
     126      $this->Database->update('UserOnline', '`SessionId`="'.$SID.'"', array(
    127127        'User' => $User['ID'], 'StayLogged' => $StayLogged, 'StayLoggedHash' => $StayLoggedSalt));
    128128      if($StayLogged)
    129129      {
    130         setcookie('LoginUserId', $User['ID'], time()+365*24*60*60);
    131         setcookie('LoginHash', sha1($User['ID'].$StayLoggedSalt), time()+365*24*60*60);
     130        setcookie('LoginUserId', $User['ID'], time() + 365 * 24 * 60 * 60);
     131        setcookie('LoginHash', sha1($User['ID'].$StayLoggedSalt), time() + 365 * 24 * 60 * 60);
    132132      } else {
    133133        setcookie('LoginUserId', '', time() - 3600);
     
    150150    if($this->Role != LICENCE_ANONYMOUS)
    151151    {
    152       $this->Database->update('UserOnline', 'SessionId="'.$SID.'"', array('User' => null));
     152      $this->Database->update('UserOnline', '`SessionId`="'.$SID.'"', array('User' => null));
    153153      $this->Database->query('UPDATE `UserTrace` SET '.
    154154        '`LastLogout` = NOW() WHERE `User` = '.$this->Id);
  • trunk/Modules/User/UserList.php

    r826 r843  
    6161    {
    6262      $XP = GetLevelMinMax($Line['XP']);
    63       $Output .= '<tr><td><a href="user.php?user='.$Line['ID'].'">'.$Line['Name'].'</a></td>'.
    64         '<td style="text-align: center;"><a href="TranslationList.php?user='.$Line['ID'].'&amp;group=0&amp;state=2" title="Zobrazit Všechny jeho přeložené texty">'.$Line['TranslatedCount'].'</a></td>'.
     63      $Output .= '<tr><td><a href="'.$this->System->Link('/user/?user='.$Line['ID']).'">'.$Line['Name'].'</a></td>'.
     64        '<td style="text-align: center;"><a href="'.$this->System->Link('/TranslationList.php?user='.$Line['ID'].'&amp;group=0&amp;state=2').'" title="Zobrazit Všechny jeho přeložené texty">'.$Line['TranslatedCount'].'</a></td>'.
    6565        '<td>'.$XP['Level'].'</td>'.
    6666        '<td>'.ProgressBar(150, round($XP['XP'] / $XP['MaxXP'] * 100, 2), $XP['XP'].' / '.$XP['MaxXP']).'</td>'.
  • trunk/Modules/Wiki/Wiki.php

    r838 r843  
    164164          $Output .= '<tr>'.
    165165            '<td>'.HumanDateTime($PageContent['Time']).'</td>'.
    166             '<td><a href="'.$this->System->Link('/user.php?user='.$PageContent['User']).'">'.$PageContent['UserName'].'</a></td>'.
     166            '<td><a href="'.$this->System->Link('/user/?user='.$PageContent['User']).'">'.$PageContent['UserName'].'</a></td>'.
    167167            '<td><a href="?id='.$PageContent['Id'].'&amp;ver='.$PageContent['Id'].'">Zobrazit</a></td>';
    168168          $Output .= '</tr>';
  • trunk/admin/install.php

    r840 r843  
    171171  $System = new Core();
    172172  $System->Init();
    173   $Locale = new LocaleManager($System);
    174   $Locale->Dir = dirname(__FILE__).'/../locale';
    175   $Locale->LoadLocale('en');
    176173  $UpdateManager = new UpdateManager();
    177174  $UpdateManager->Database = $System->Database;
  • trunk/includes/Locale.php

    r841 r843  
    1818  }
    1919
    20   function Translate($Text)
    21   {
    22     if(array_key_exists($Text, $this->Data) and ($this->Data[$Text] != ''))
    23       return($this->Data[$Text]);
     20  function Translate($Text, $Group = '')
     21  {
     22    if(array_key_exists($Text, $this->Data[$Group]) and ($this->Data[$Group][$Text] != ''))
     23      return($this->Data[$Group][$Text]);
    2424      else return($Text);
     25  }
     26
     27  function TranslateReverse($Text, $Group = '')
     28  {
     29    $Key = array_search($Text, $this->Data[$Group]);
     30    if(($Key === FALSE) or ($this->Data[$Group][$Key] == '')) return($Text);
     31      else return($Key);
    2532  }
    2633}
     
    232239}
    233240
    234 // Short named global function
    235 function T($Text)
     241// Short named global translation function
     242function T($Text, $Group = '')
    236243{
    237244  global $GlobalLocaleManager;
    238245
    239   if(isset($GlobalLocaleManager)) return($GlobalLocaleManager->CurrentLocale->Texts->Translate($Text));
     246  if(isset($GlobalLocaleManager)) return($GlobalLocaleManager->CurrentLocale->Texts->Translate($Text, $Group));
    240247    else return($Text);
    241248}
  • trunk/includes/Version.php

    r842 r843  
    66// and system will need database update.
    77
    8 $Revision = 842; // Subversion revision
     8$Revision = 843; // Subversion revision
    99$DatabaseRevision = 811; // Database structure revision
    10 $ReleaseTime = '2016-01-12';
     10$ReleaseTime = '2016-01-14';
  • trunk/includes/system.php

    r842 r843  
    99  var $OnPageNotFound;
    1010  var $Pages;
     11  /* @var LocaleManager */
     12  var $LocaleManager;
    1113
    1214  function __construct()
     
    2325  function Init()
    2426  {
    25     global $GlobalLocaleManager;
     27    global $GlobalLocaleManager, $Config;
     28
     29    $this->Config = $Config;
     30    date_default_timezone_set($this->Config['Web']['Timezone']);
    2631
    2732    $this->Database->Connect($this->Config['Database']['Host'],
     
    5560      }
    5661    }
    57     $this->LocaleManager->LoadLocale($this->LocaleManager->LangCode);
     62    if(array_key_exists($this->LocaleManager->LangCode, $this->LocaleManager->Available))
     63      $this->LocaleManager->LoadLocale($this->LocaleManager->LangCode);
    5864
    5965    $this->Menu = array
     
    9399  function Run()
    94100  {
    95     global $ScriptStartTime, $TranslationTree, $StopAfterUpdateManager, $Config,
     101    global $ScriptStartTime, $TranslationTree, $StopAfterUpdateManager,
    96102      $UpdateManager, $DatabaseRevision;
    97103
    98     $this->Config = $Config;
    99104    $ScriptStartTime = GetMicrotime();
    100 
    101105    if(GetRemoteAddress() != '') session_start();
    102106
    103107    if(!isset($this->Config)) die('Systém není nainstalován. Pokračujte v instalaci <a href="admin/install.php">zde</a>.');
    104     date_default_timezone_set($this->Config['Web']['Timezone']);
    105108
    106109    $this->Init();
     
    181184  }
    182185
     186  function TranslateURL($URL, $Locale)
     187  {
     188    // Try translate URL directory parts from current locale to target locale
     189    $Remaining = $URL;
     190    $RemainingParts = explode('?', $Remaining);
     191    $Directory = $RemainingParts[0];
     192    if(count($RemainingParts) > 1)
     193    {
     194      $Params = $RemainingParts[1];
     195    } else {
     196      $Params = '';
     197    }
     198    $TargetLocaleManager = new LocaleManager($this);
     199    $TargetLocaleManager->Dir = $this->LocaleManager->Dir;
     200    $TargetLocaleManager->Available = $this->LocaleManager->Available;
     201    $TargetLocaleManager->LoadLocale($Locale);
     202
     203    $DirectoryParts = explode('/', $Directory);
     204    foreach($DirectoryParts as $Index => $Item)
     205    {
     206      $NewText = $TargetLocaleManager->CurrentLocale->Texts->Translate($Item, 'URL');
     207      $DirectoryParts[$Index] = $NewText;
     208    }
     209    $Directory = implode('/', $DirectoryParts);
     210    $Remaining = $Directory;
     211    if($Params != '') $Remaining .= '?'.$Params;
     212
     213    return($Remaining);
     214  }
     215
     216  function TranslateReverseURL($URL, $Locale)
     217  {
     218    // Try translate URL directory parts from current locale to target locale
     219    $Remaining = $URL;
     220    $RemainingParts = explode('?', $Remaining);
     221    $Directory = $RemainingParts[0];
     222    if(count($RemainingParts) > 1)
     223    {
     224      $Params = $RemainingParts[1];
     225    } else {
     226      $Params = '';
     227    }
     228    $TargetLocaleManager = new LocaleManager($this);
     229    $TargetLocaleManager->Dir = $this->LocaleManager->Dir;
     230    $TargetLocaleManager->Available = $this->LocaleManager->Available;
     231    $TargetLocaleManager->LoadLocale($Locale);
     232
     233    $DirectoryParts = explode('/', $Directory);
     234    foreach($DirectoryParts as $Index => $Item)
     235    {
     236      $NewText = $TargetLocaleManager->CurrentLocale->Texts->TranslateReverse($Item, 'URL');
     237      $DirectoryParts[$Index] = $NewText;
     238    }
     239    $Directory = implode('/', $DirectoryParts);
     240    $Remaining = $Directory;
     241    if($Params != '') $Remaining .= '?'.$Params;
     242
     243    return($Remaining);
     244  }
     245
    183246  function LinkLocale($Target, $Locale = '')
    184247  {
    185248    if($Locale == '') $Locale = $this->LocaleManager->LangCode;
     249
     250    $Target = $this->TranslateURL($Target, $Locale);
     251
    186252    if($Locale == $this->LocaleManager->DefaultLangCode)
    187253      return($this->Config['Web']['BaseURL'].$Target);
     
    216282    if(count($PathItems) == 0) $PathItems = array('');
    217283    $PathItem = $PathItems[0];
     284    $PathItem = $this->LocaleManager->CurrentLocale->Texts->TranslateReverse($PathItem, 'URL');
     285
    218286    if(array_key_exists($PathItem, $Pages))
    219287    {
     
    286354      if($Locale['Code'] == $this->System->LocaleManager->CurrentLocale->Texts->Code) $Selected = ' selected="selected"';
    287355        else $Selected = '';
     356      $Remaining = $this->System->TranslateReverseURL($Remaining, $this->System->LocaleManager->LangCode);
     357
    288358      $URL = $this->System->LinkLocale($Remaining, $Locale['Code']);
    289359      $Output .= '<option title="" value="'.$URL.'"'.$Selected.' onchange="this.form.submit()">'.$Locale['Title'].'</option>';
     
    306376      //$Output .= ''<span class="MenuItem">Moje překlady: <a href="">Dokončené</a> <a href="">Rozpracované</a> <a href="">Exporty</a> Tým: <a href="">'.$Team['name'].'</a></span>';
    307377      $Output .= $this->System->User->Name.' <a href="'.$this->System->Link('/?action=logout').'">'.T('Logout').'</a>'.
    308           ' <a href="'.$this->System->Link('/user.php?user='.$this->System->User->Id).'">'.T('My page').'</a>'.
    309           ' <a href="'.$this->System->Link('/Options.php').'">'.T('Options').'</a>'.
     378          ' <a href="'.$this->System->Link('/user/?user='.$this->System->User->Id).'">'.T('My page').'</a>'.
     379          ' <a href="'.$this->System->Link('/options/').'">'.T('Options').'</a>'.
    310380          ' <a title="Vámi přeložené texty" href="'.$this->System->Link('/TranslationList.php?user='.
    311381          $this->System->User->Id.'&amp;group=0&amp;state=2&amp;text=&amp;entry=').'">'.T('Translated').'</a>'.
     
    317387    {
    318388      $Output .= '<a href="'.$this->System->Link('/login/').'">'.T('Login').'</a>&nbsp;'.
    319           '<a href="'.$this->System->Link('/registrace.php').'">'.T('Registration').'</a>';
     389        '<a href="'.$this->System->Link('/registration/').'">'.T('Registration').'</a>';
    320390    }
    321391    $Output .= $this->ShowLocaleSelector();
  • trunk/locale/cs.php

    r838 r843  
    88    $this->Title = 'Česky';
    99    $this->Data = array(
     10      '' => array(
    1011      'Access denied' => 'Nemáte oprávnění',
    1112      'Show welcome' => 'Odkrýt úvod',
     
    160161      'Online check port' => 'Zkontroloat port online',
    161162      'There are servers listed which are in fact offering translated game. '.
    162     'There is resoluted if translation is offered either on client side, on server side or both. '.
    163     'Term "Czech server" doesn\'t mean that server is operated by Czech people but that it is possible to play in Czech.' =>
    164     'Zde jsou uvedeny servery, které opravdu nabízí přeloženou hru. Rozlišuje se, jestli překlad je nabízen na straně klienta, serveru nebo obou.'.
    165 'Pojem "Český server" neznamená, že server je provozovaný čechy, ale že je možné hrát v češtině',
     163        'There is resoluted if translation is offered either on client side, on server side or both. '.
     164        'Term "Czech server" doesn\'t mean that server is operated by Czech people but that it is possible to play in Czech.' =>
     165        'Zde jsou uvedeny servery, které opravdu nabízí přeloženou hru. Rozlišuje se, jestli '.
     166        'překlad je nabízen na straně klienta, serveru nebo obou.'.
     167        'Pojem "Český server" neznamená, že server je provozovaný čechy, ale že je možné hrát v češtině',
    166168      'Last translations' => 'Poslední překlady',
    167169      'View' => 'Zobrazit',
     
    345347      'Language:' => 'Jazyk:',
    346348      'Statistics of translation completion of language %s for version %s' => 'Statistika dokončení překladů jazyka %s pro verzi %s',
     349      'Translations' => 'Překlady',
     350      'Processing' => 'Zpracování',
     351      'Words' => 'Slova',
     352      'Not translated' => 'Nepřeložené',
     353      'Unfinished - Not translated' => 'Rozpracované-Nepřeložené',
     354      'Missing $ ($N,$s..)' => 'Chybějící $ ($N,$s..)',
     355      'Missing $ - Not fixed' => 'Chybějící $ - Neopravený',
     356      'Number' => 'Číslo',
     357      'From version' => 'Verze od',
     358      'To version' => 'Verze do',
     359      'Count' => 'Počet',
     360      ),
     361      'URL' => array(
     362        'download' => 'stahovani',
     363        'team' => 'tym',
     364        'client-version' => 'verze-klienta',
     365        'login' => 'prihlaseni',
     366        'registration' => 'registrace',
     367        'options' => 'volby',
     368        'profile' => 'profil',
     369        'user' => 'uzivatel',
     370        'users' => 'uzivatele',
     371        'dictionary' => 'slovnik',
     372        'progress' => 'prubeh',
     373        'admin' => 'sprava',
     374        'files' => 'soubory',
     375        'server' => 'server',
     376        'export' => 'export',
     377        'team' => 'tym',
     378        'translation-groups' => 'prekladove-skupiny',
     379        'news' => 'novinky',
     380        'shoutbox' => 'kecatko',
     381      ),
    347382    );
    348383  }
  • trunk/locale/en.php

    r816 r843  
    88    $this->Title = 'English';
    99    $this->Data = array(
     10      '' => array(
    1011      'Access denied' => '',
    1112      'Home' => '',
     
    166167      'Edit' => '',
    167168      'List' => '',
     169      ),
     170      'URL' => array(
     171      )
    168172    );
    169173  }
Note: See TracChangeset for help on using the changeset viewer.