Changeset 134

Show
Ignore:
Timestamp:
08/30/07 00:15:40 (17 months ago)
Author:
chris
Message:

Updated javascript to take advantage of localisations.

Location:
trunk
Files:
4 modified
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/js/hellaworld.php

    r131 r134  
     1<?php    
     2 
    13        // $Id$ 
     4        include '../config.php'; 
     5 
     6        if (!function_exists('_')) { 
     7                function _($string) { 
     8                        return $string; 
     9                } 
     10        } else { 
     11                putenv('LC_ALL=' . $config['language'] . '.UTF-8'); 
     12                setlocale(LC_ALL, $config['language'] . '.UTF-8'); 
     13                bindtextdomain('messages', '../locale'); 
     14                textdomain('messages'); 
     15        } 
     16 
     17?> 
    218 
    319        var refresh = false; 
     
    4157                                        }, 
    4258                                        error : function() { 
    43                                                 alert('Apologies, there was an error while making the request'); 
     59                                                alert('<?php echo _('Apologies, there was an error while making the request'); ?>'); 
    4460                                        } 
    4561                                }); 
     
    5874 
    5975        function updateData(json) { 
    60                 var info = "<h2>Currently Downloading</h2>"; 
     76                var info = "<h2><?php echo _('Currently Downloading'); ?></h2>"; 
    6177                if (json.downloading != null) { 
    6278                        info += "<div>" + json.downloading + "</div>"; 
    63                         info += '<div class="queuestats"><img alt="progress bar" src="progress.php?percentage=' + json.completed + '"/> ' + json.completed + '% complete</div>'; 
    64                         info += '<div class="queuestats">' + json.remaining + 'MB of ' + json.size + 'MB remaining</div>'; 
     79                        info += '<div class="queuestats"><img alt="progress bar" src="progress.php?percentage=' + json.completed + '"/> <?php printf(_('%s%% complete'), "' + json.completed + '"); ?></div>'; 
     80                        info += '<div class="queuestats"><?php printf(_('%sMB of %sMB remaining'), "' + json.remaining + '", "' + json.size + '"); ?></div>'; 
    6581                        info += '<div class="queuestats" style="margin-bottom: 5px;">'; 
    6682                        if (json.paused) { 
    67                                 info += 'PAUSED'; 
     83                                info += '<?php echo _('PAUSED'); ?>'; 
    6884                        } else { 
    69                                 info += 'ETA ' + json.eta + ' at ' + json.transferRate + 'KB/s'; 
     85                                info += '<?php printf(_('ETA %s at %sKB/s'), "' + json.eta + '", "' + json.transferRate + '"); ?>'; 
    7086                        } 
    7187                        info += '</div>' 
    7288                } else { 
    73                         info += '<div style="margin-bottom: 5px;">Nothing</div>'; 
    74                 } 
    75                 info += '<h2>Currently Processing</h2>'; 
     89                        info += '<div style="margin-bottom: 5px;"><?php echo _('Nothing'); ?></div>'; 
     90                } 
     91                info += '<h2><?php echo _('Currently Processing'); ?></h2>'; 
    7692                if (json.processing != null) { 
    7793                        info += '<div>' + json.processing + '</div>'; 
    7894                } else { 
    79                         info += '<div>Nothing</div>'; 
     95                        info += '<div><?php echo _('Nothing'); ?></div>'; 
    8096                } 
    8197                $('#info').html(info); 
     
    86102                                queue += '<div class="orderform"><input type="text" name="order[]" onchange="stopRefresher();" value="' + json.queue[i].index + '" /></div>'; 
    87103                                queue += '<div class="queuetitle">' + json.queue[i].nzbName + '</div>'; 
    88                                 queue += '<ul class="queuecontrols"><li class="handle">Drag me</li><li class="control"><a href="index.php?info=' + json.queue[i].index + '&KeepThis=true&TB_iframe=true&height=200&width=500" class="thickbox"><img src="images/information.png" alt="Info" /></a></li><li class="control"><a title="Cancel" href="' + json.path + '?action=1&amp;id=' + json.queue[i].id + '"><img src="images/delete.png" alt="Cancel" /></a></li><li class="control"><a title="Up" href="' + json.path + '?action=2&amp;id=' + json.queue[i].id + '"><img src="images/up.png" alt="Up" /></a></li><li class="control"><a title="Down" href="' + json.path + '?action=3&amp;id=' + json.queue[i].id + '"><img src="images/down.png" alt="Down" /></a></li><li class="control"><a title="Top" href="' + json.path + '?action=4&amp;id=' + json.queue[i].id + '"><img src="images/top.png" alt="Top" /></a></li><li class="control"><a title="Bottom" href="' + json.path + '?action=5&amp;id=' + json.queue[i].id + '"><img src="images/bottom.png" alt="Bottom" /></a></li><li class="control"><a title="Force" href="' + json.path + '?action=6&amp;id=' + json.queue[i].id + '"><img src="images/force.png" alt="Force" /></a></li></ul>'; 
    89                                 queue += '<div class="queuestats">' + json.queue[i].totalmb + 'MB'; 
     104                                queue += '<ul class="queuecontrols"><li class="handle"><?php echo _('Drag me'); ?></li><li class="control"><a href="index.php?info=' + json.queue[i].index + '&KeepThis=true&TB_iframe=true&height=200&width=500" class="thickbox"><img src="images/information.png" alt="Info" /></a></li><li class="control"><a title="Cancel" href="' + json.path + '?action=1&amp;id=' + json.queue[i].id + '"><img src="images/delete.png" alt="Cancel" /></a></li><li class="control"><a title="Up" href="' + json.path + '?action=2&amp;id=' + json.queue[i].id + '"><img src="images/up.png" alt="Up" /></a></li><li class="control"><a title="Down" href="' + json.path + '?action=3&amp;id=' + json.queue[i].id + '"><img src="images/down.png" alt="Down" /></a></li><li class="control"><a title="Top" href="' + json.path + '?action=4&amp;id=' + json.queue[i].id + '"><img src="images/top.png" alt="Top" /></a></li><li class="control"><a title="Bottom" href="' + json.path + '?action=5&amp;id=' + json.queue[i].id + '"><img src="images/bottom.png" alt="Bottom" /></a></li><li class="control"><a title="Force" href="' + json.path + '?action=6&amp;id=' + json.queue[i].id + '"><img src="images/force.png" alt="Force" /></a></li></ul>'; 
     105                                queue += '<div class="queuestats"><?php printf(_('%sMB'), "' + json.queue[i].totalmb + '"); ?>'; 
    90106                                if (json.transferRate > 0) { 
    91                                         queue += ' ETA: ' + json.queue[i].eta + '</div>'; 
     107                                        queue += '<?php printf(_(' ETA: %s'), "' + json.queue[i].eta + '"); ?></div>'; 
    92108                                } else { 
    93109                                        queue += '</div>'; 
     
    103119                                finished += '<li class="queuebox ' + json.finished[i].type + '">'; 
    104120                                finished += '<div class="queuetitle">' + json.finished[i].archiveName + '</div>'; 
    105                                 finished += '<ul class="queuecontrols"><li class="control"><a href="index.php?removefinished=' + json.finished[i].index + '">Remove</a></li></ul>'; 
    106                                 finished += '<div class="queuestats">Finished on: ' + json.finished[i].finishedTime + ' Processing Time: ' + json.finished[i].elapsedTime; 
     121                                finished += '<ul class="queuecontrols"><li class="control"><a href="index.php?removefinished=' + json.finished[i].index + '"><?php echo _('Remove'); ?></a></li></ul>'; 
     122                                finished += '<div class="queuestats"><?php printf(_('Finished on: %s Processing Time: %s'), "' + json.finished[i].finishedTime + '", "' + json.finished[i].elapsedTime"); ?>; 
    107123                                if (json.finished[i].parMessage != '') { 
    108                                         finished += ' Par message: ' + json.finished[i].parMessage; 
     124                                        finished += '<?php printf(_(' Par message: %s'), "' + json.finished[i].parMessage"); ?>; 
    109125                                } 
    110126                                finished += '</div></li>'; 
     
    139155                var sorttype = obj.sorttype.options[obj.sorttype.selectedIndex].value; 
    140156                if (sorttype > 1) { 
    141                         return confirm('This will reorder the entire queue, continue?'); 
     157                        return confirm('<?php echo _('This will reorder the entire queue, continue?'); ?>'); 
    142158                } else { 
    143159                        return true; 
  • trunk/locale/en_GB.UTF-8/LC_MESSAGES/messages.po

    r133 r134  
    207207#, php-format 
    208208# The preceeding space is required. 
    209 msgid " Par message: " 
     209msgid " Par message: %s" 
    210210msgstr "" 
    211211 
  • trunk/locale/en_US.UTF-8/LC_MESSAGES/messages.po

    r133 r134  
    207207#, php-format 
    208208# The preceeding space is required. 
    209 msgid " Par message: " 
     209msgid " Par message: %s" 
    210210msgstr "" 
    211211 
  • trunk/locale/sv_SE.UTF-8/LC_MESSAGES/messages.po

    r133 r134  
    208208#, php-format 
    209209# The preceeding space is required. 
    210 msgid " Par message: " 
     210msgid " Par message: %s" 
    211211msgstr " Par Meddelande: %s" 
    212212 
  • trunk/templates/default.php

    r133 r134  
    5454                <script src="js/interface.js" type="text/javascript"></script> 
    5555                <script src="js/tabs.js" type="text/javascript"></script> 
    56                 <script src="js/hellaworld.js" type="text/javascript"></script> 
     56                <script src="js/hellaworld.php" type="text/javascript"></script> 
    5757        </head> 
    5858        <body onload="init();">