Show
Ignore:
Timestamp:
01/21/08 17:20:22 (12 months ago)
Author:
kasper
Message:

Added plog_tr functions in the entire gallery (not just the admin), so that everything is now translatable. For themes, only the default theme is translatable.
Translated the entire gallery to danish.
Added code to allow videos, showing a thumb-nail for a video instead of returning an error.
Ajax editing of international characters in caption, now shows the correct characters.
Tested code that jumps down to id tags for previous and next buttons, code not active, I am not sure whether or not everyone want this behaviour.
Tested a new installation based on the code.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/plog-functions.php

    r490 r491  
    1010                        $row = get_collection_by_id($id); 
    1111                         
    12                         $breadcrumbs = ' <a accesskey="/" href="'.$config["baseurl"].'">Collections</a> &raquo; <b>' . SmartStripSlashes($row["name"]) . '</b>'; 
    13                         if ($GLOBALS['plogger_mode'] == "slideshow") $breadcrumbs .= ' &raquo; Slideshow'; 
     12                        $breadcrumbs = ' <a accesskey="/" href="'.$config["baseurl"].'">' . plog_tr('Collections') . '</a> &raquo; <b>' . SmartStripSlashes($row["name"]) . '</b>'; 
     13                        if ($GLOBALS['plogger_mode'] == "slideshow") $breadcrumbs .= ' &raquo; ' . plog_tr('Slideshow'); 
    1414                         
    1515                        break; 
     
    2727                        if ($GLOBALS['plogger_mode'] == "slideshow") { 
    2828                                 
    29                                 $breadcrumbs = ' <a href="'.$config["baseurl"].'">Collections</a> &raquo; ' . $collection_link . ' &raquo; ' . '<a href="'.$album_link.'">'.$album_name.'</a> &raquo; ' . ' <b>Slideshow</b>'; 
     29                                $breadcrumbs = ' <a href="'.$config["baseurl"].'">' . plog_tr('Collections') . '</a> &raquo; ' . $collection_link . ' &raquo; ' . '<a href="'.$album_link.'">'.$album_name.'</a> &raquo; ' . ' <b>Slideshow</b>'; 
    3030                        } else { 
    3131                                 
    32                                 $breadcrumbs = ' <a href="'.$config["baseurl"].'">Collections</a> &raquo; ' . $collection_link . ' &raquo; ' . '<b>'.$album_name.'</b>'; 
     32                                $breadcrumbs = ' <a href="'.$config["baseurl"].'">' . plog_tr('Collections') . '</a> &raquo; ' . $collection_link . ' &raquo; ' . '<b>'.$album_name.'</b>'; 
    3333                        } 
    3434                         
     
    4444                        $row = get_collection_by_id($row["parent_id"]); 
    4545                         
    46                         $collection_link = ' <a href="'.$config["baseurl"].'">Collections</a> ' . ' &raquo; ' . '<a href="' . generate_url("collection",$row["id"]) . '">' . SmartStripSlashes($row["name"]) . '</a>'; 
     46                        $collection_link = ' <a href="'.$config["baseurl"].'">' . plog_tr('Collections') . '</a> ' . ' &raquo; ' . '<a href="' . generate_url("collection",$row["id"]) . '">' . SmartStripSlashes($row["name"]) . '</a>'; 
    4747                         
    4848                        $breadcrumbs = $collection_link . ' &raquo; ' . $album_link . ' &raquo; ' . '<span id="image_name"><b>' . $picture_name.'</b></span>'; 
    4949                         
    50                         if ($GLOBALS['plogger_mode'] == "slideshow") $breadcrumbs .= ' &raquo; Slideshow'; 
     50                        if ($GLOBALS['plogger_mode'] == "slideshow") $breadcrumbs .= ' &raquo; ' . plog_tr('Slideshow'); 
    5151                         
    5252                        break; 
    5353                case 'search': 
    54                         $breadcrumbs = 'You searched for <b>'.htmlspecialchars($_GET["searchterms"]).'</b>.'; 
     54                        $breadcrumbs = plog_tr('You searched for') . ' <b>'.htmlspecialchars($_GET["searchterms"]).'</b>.'; 
    5555                        break; 
    5656                default: 
    57                         $breadcrumbs = ' <b>Collections</b>'; 
     57                        $breadcrumbs = ' <b>' . plog_tr('Collections') . '</b>'; 
    5858                        break; 
    5959        } 
     
    6868                         
    6969                        $breadcrumbs = SmartStripSlashes($row["name"]); 
    70                         if ($GLOBALS['plogger_mode'] == "slideshow") $breadcrumbs .= ' &raquo; Slideshow'; 
     70                        if ($GLOBALS['plogger_mode'] == "slideshow") $breadcrumbs .= ' &raquo; ' . plog_tr('Slideshow'); 
    7171                         
    7272                        break; 
     
    7979                         
    8080                        if ($GLOBALS['plogger_mode'] == "slideshow") { 
    81                                 $breadcrumbs = SmartStripSlashes($row["name"]) . ' &raquo; ' . $album_name.' &raquo; ' . ' Slideshow'; 
     81                                $breadcrumbs = SmartStripSlashes($row["name"]) . ' &raquo; ' . $album_name.' &raquo; ' . ' ' . plog_tr('Slideshow'); 
    8282                        } else { 
    8383                                $breadcrumbs = SmartStripSlashes($row["name"]) . ' &raquo; ' . $album_name; 
     
    115115         
    116116        $output .=  '<form id="jump_menu" name="jump_menu" action="#" method="get"><div>'; 
    117         $output .=  '<select name="jump_menu" onchange="document.location.href = this.options[this.selectedIndex].value;"><option value="#">Jump to...</option>'; 
     117        $output .=  '<select name="jump_menu" onchange="document.location.href = this.options[this.selectedIndex].value;"><option value="#">' . plog_tr('Jump to') . '...</option>'; 
    118118         
    119119        // 1. create a list of all albums with at least one photo 
     
    187187                        $table_data .= '> 
    188188                                        <tr> 
    189                                                 <td><strong>Dimensions</strong></td> 
     189                                                <td><strong>' . plog_tr('Dimensions') .'</strong></td> 
    190190                                                <td>'.$width .' x ' .$height.'</td> 
    191191                                        </tr> 
    192192                                        <tr> 
    193                                                 <td><strong>File size</strong></td> 
     193                                                <td><strong>' . plog_tr('File size') . '</strong></td> 
    194194                                                <td>'.$size.' kbytes</td> 
    195195                                        </tr> 
    196196                                        <tr> 
    197                                                 <td><strong>Taken on</strong></td> 
     197                                                <td><strong>' . plog_tr('Taken on') . '</strong></td> 
    198198                                                <td>'.$row["EXIF_date_taken"].'</td> 
    199199                                        </tr> 
    200200                                        <tr> 
    201                                                 <td><strong>Camera model</strong></td> 
     201                                                <td><strong>' . plog_tr('Camera model') . '</strong></td> 
    202202                                                <td>'.$row["EXIF_camera"].'</td> 
    203203                                        </tr> 
    204204                                        <tr> 
    205                                                 <td><strong>Shutter speed</strong></td> 
     205                                                <td><strong>' . plog_tr('Shutter speed') . '</strong></td> 
    206206                                                <td>'.$row["EXIF_shutterspeed"].'</td> 
    207207                                        </tr> 
    208208                                        <tr> 
    209                                                 <td><strong>Focal length</strong></td> 
     209                                                <td><strong>' . plog_tr('Focal length') . '</strong></td> 
    210210                                                <td>'.$row["EXIF_focallength"].'</td> 
    211211                                        </tr> 
    212212                                        <tr> 
    213                                                 <td><strong>Aperture</strong></td> 
     213                                                <td><strong>' . plog_tr('Aperture') . '</strong></td> 
    214214                                                <td>'.$row["EXIF_aperture"].'</td> 
    215215                                        </tr> 
    216216                                </table></div>'; 
    217217                } else { 
    218                         $table_data .= '><tr><td><strong>Dimensions</strong></td><td>'.$width .' x ' .$height.'</td></tr><tr><td><strong>File size</strong></td><td>'.$size.' kbytes</td></tr><tr><td><strong>Taken on</strong></td><td>'.$row["EXIF_date_taken"].'</td></tr><tr><td><strong>Camera model</strong></td><td>'.$row["EXIF_camera"].'</td></tr><tr><td><strong>Shutter speed</strong></td><td>'.$row["EXIF_shutterspeed"].'</td></tr><tr><td><strong>Focal length</strong></td><td>'.$row["EXIF_focallength"].'</td></tr><tr><td><strong>Aperture</strong></td><td>'.$row["EXIF_aperture"].'</td></tr></table></div>'; 
     218                        $table_data .= '><tr><td><strong>' . plog_tr('Dimensions') . '</strong></td><td>'.$width .' x ' .$height.'</td></tr><tr><td><strong>' . plog_tr('File size') . '</strong></td><td>'.$size.' ' . plog_tr('kbytes') . '</td></tr><tr><td><strong>' . plog_tr('Taken on') . '</strong></td><td>'.$row["EXIF_date_taken"].'</td></tr><tr><td><strong>' . plog_tr('Camera model') . '</strong></td><td>'.$row["EXIF_camera"].'</td></tr><tr><td><strong>' . plog_tr('Shutter speed') . '</strong></td><td>'.$row["EXIF_shutterspeed"].'</td></tr><tr><td><strong>' . plog_tr('Focal length') . '</strong></td><td>'.$row["EXIF_focallength"].'</td></tr><tr><td><strong>' . plog_tr('Aperture') . '</strong></td><td>'.$row["EXIF_aperture"].'</td></tr></table></div>'; 
    219219                } 
    220220        } 
     
    255255         
    256256        $fields = array( 
    257                 'date' => 'Date Submitted', 
    258                 'date_taken' => 'Date Taken', 
    259                 'caption' => 'Caption', 
    260                 'filename' => 'Filename', 
    261                 'number_of_comments' => 'Number of Comments', 
     257                'date' => plog_tr('Date Submitted'), 
     258                'date_taken' => plog_tr('Date Taken'), 
     259                'caption' => plog_tr('Caption'), 
     260                'filename' => plog_tr('Filename'), 
     261                'number_of_comments' => plog_tr('Number of Comments'), 
    262262        ); 
    263263         
     
    271271                $output .= ' 
    272272                        <form action="#" method="get"> 
    273                                 <span><label for="change_sortby">Sort by:</label> 
     273                                <span><label for="change_sortby">' . plog_tr('Sort by') . ':</label> 
    274274                                <select id="change_sortby" name="change_sortby"  
    275275                                onchange="document.location.href = this.options[this.selectedIndex].value;"> 
     
    301301         
    302302        $orders = array( 
    303                 'asc' => 'Ascending', 
    304                 'desc' => 'Descending', 
     303                'asc' => plog_tr('Ascending'), 
     304                'desc' => plog_tr('Descending'), 
    305305        ); 
    306306         
     
    337337                        <input type="hidden" name="level" value="search" /> 
    338338                        <input type="text" name="searchterms" /> 
    339                         <input class="submit" type="submit" value="Search" /> 
     339                        <input class="submit" type="submit" value="' . plog_tr('Search') .'" /> 
    340340                        </div> 
    341341                </form>'; 
     
    466466        if (!$imgdata) { 
    467467                // unknown image format, bail out 
    468                 return false; 
     468                return 'graphics/thumb-video.gif'; 
     469                // return false; 
    469470        } 
    470471         
     
    11021103         
    11031104        if (empty($config["allow_comments"])) { 
    1104                 return array("errors" => "Comments disabled"); 
     1105                return array("errors" => plog_tr('Comments disabled')); 
    11051106        } 
    11061107         
    11071108        if (empty($author) || empty($email)) { 
    1108                 return array("errors" => "Your comment did not post!  Please fill the required fields."); 
     1109                return array("errors" => plog_tr("Your comment did not post!  Please fill the required fields.")); 
    11091110        } 
    11101111         
     
    11261127         
    11271128        if (empty($picdata)) { 
    1128                 return array("errors" => "Could not post comment - no such picture"); 
     1129                return array("errors" => plog_tr("Could not post comment - no such picture")); 
    11291130        } 
    11301131         
    11311132        if (empty($picdata["allow_comments"])) { 
    1132                 return array("errors" => "Comments disabled"); 
     1133                return array("errors" => plog_tr("Comments disabled")); 
    11331134        } 
    11341135         
    11351136        if ($config["comments_moderate"] == 1) { 
    11361137                $approved = 0; 
    1137                 $notify_msg = " (awaiting your approval)"; 
     1138                $notify_msg = " " . plog_tr('(awaiting your approval)'); 
    11381139        } else { 
    11391140                $approved = 1; 
     
    12101211 
    12111212function is_allowed_extension($ext) { 
    1212         return in_array(strtolower($ext),array("jpg","gif","png","bmp")); 
     1213        // return in_array(strtolower($ext),array("jpg","gif","png","bmp")); 
     1214        return in_array(strtolower($ext),array("jpg","gif","png","bmp","mp4","wmv")); 
    12131215} 
    12141216 
     
    16491651         
    16501652        if ($GLOBALS['plogger_level'] != "picture" && $GLOBALS['plogger_mode'] != "slideshow" && $config["allow_dl"]) { 
    1651                         return '<input id="download_selected_button" class="submit" type="submit" name="download_selected" value="Download Selected" />'; 
     1653                        return '<input id="download_selected_button" class="submit" type="submit" name="download_selected" value="' . plog_tr('Download Selected') . '" />'; 
    16521654        } 
    16531655} 
     
    16761678         
    16771679        if ($GLOBALS['plogger_level'] == "picture" && $config["allow_print"]) { 
    1678                 return '<a class="print" href="' . $config["gallery_url"] . 'plog-print.php?id='.$id.'">Print Image</a>'; 
     1680                return '<a class="print" href="' . $config["gallery_url"] . 'plog-print.php?id='.$id.'">' . plog_tr('Print Image') . '</a>'; 
    16791681        } 
    16801682} 
    16811683 
    16821684function plogger_link_back () { 
    1683         return  '<div id="link-back"><a href="http://www.plogger.org/">Powered by Plogger!</a></div>'; 
     1685        return  '<div id="link-back"><a href="http://www.plogger.org/">' . plog_tr('Powered by Plogger!') . '</a></div>'; 
    16841686} 
    16851687 
     
    17141716                // change the tooltip message to reflect the nature of the RSS aggregate link. 
    17151717                if ($GLOBALS['plogger_level'] != "")  
    1716                                 $rss_tooltip = "RSS 2.0 subscribe to this " .$GLOBALS["plogger_level"]; 
     1718                                $rss_tooltip = plog_tr('RSS 2.0 subscribe to this') . $GLOBALS["plogger_level"]; 
    17171719                else 
    1718                                 $rss_tooltip = "RSS 2.0 subscribe to all images"; 
     1720                                $rss_tooltip = plog_tr('RSS 2.0 subscribe to all images'); 
    17191721         
    17201722         
    17211723                $rss_link = plogger_rss_link(); 
    17221724         
    1723                 $rss_tag = '<a href="'.$rss_link.'"><img id="rss-image" src="' . $config["gallery_url"] . 'graphics/rss.gif" title="'.                                  $rss_tooltip.'" alt="RSS 2.0 Feed"/></a>'; 
     1725                $rss_tag = '<a href="'.$rss_link.'"><img id="rss-image" src="' . $config["gallery_url"] . 'graphics/rss.gif" title="'.                                  $rss_tooltip.'" alt="' . plog_tr('RSS 2.0 Feed') . '"/></a>'; 
    17241726                 
    17251727                return $rss_tag; 
     
    17361738                if ($GLOBALS['plogger_level'] == "album") { 
    17371739                        $ss_url = generate_url('album',$GLOBALS['plogger_id'],array('mode' => 'slideshow')); 
    1738                         $ss_tag = "<a href=\"$ss_url\">View as Slideshow</a>"; 
     1740                        $ss_tag = "<a href=\"$ss_url\">" . plog_tr('View as Slideshow') . "</a>"; 
    17391741                } 
    17401742 
     
    17421744                        $ss_url = $config['baseurl'] . '?level=search&amp;searchterms=' . htmlspecialchars($_GET['searchterms']); 
    17431745                        $ss_url .= "&amp;mode=slideshow"; 
    1744                         $ss_tag = "<a href=\"$ss_url\">View as Slideshow</a>"; 
     1746                        $ss_tag = "<a href=\"$ss_url\">" . plog_tr('View as Slideshow') . "</a>"; 
    17451747                } 
    17461748                 
     
    19231925         
    19241926        $thumbpath = $config['basedir'] . 'thumbs/'.$prefix.$base_filename; 
    1925         $image_info = getimagesize($thumbpath); 
     1927 
     1928 
     1929        if (!is_readable($thumbpath)) { 
     1930                $image_info = getimagesize($config['basedir'] . 'graphics/thumb-video.gif'); 
     1931        } 
     1932        else 
     1933        { $image_info = getimagesize($thumbpath);} 
     1934         
     1935        // $image_info = getimagesize($thumbpath); 
    19261936         
    19271937        return $image_info; 
     
    19641974function plogger_get_source_picture_url() { 
    19651975        global $config; 
    1966         return (!empty($config['allow_fullpic'])) ? $config["gallery_url"].'images/'.SmartStripSlashes($GLOBALS["current_picture"]["path"]) : "#"; 
     1976        return (!empty($config['allow_fullpic'])) ? $config["baseurl"].'images/'.SmartStripSlashes($GLOBALS["current_picture"]["path"]) : "#"; 
    19671977} 
    19681978 
     
    21862196function plogger_get_detail_link() { 
    21872197                if (!$_SESSION["plogger_details"]){ 
    2188                         return '<a accesskey="d" href="javascript:void(0);" onclick="show_details();">Show details</a>'; 
     2198                        return '<a accesskey="d" href="javascript:void(0);" onclick="show_details();">' . plog_tr('Show details') . '</a>'; 
    21892199                } 
    21902200                else{ 
    2191                         return '<a accesskey="d" href="javascript:void(0);" onclick="hide_details();">Hide details</a>'; 
     2201                        return '<a accesskey="d" href="javascript:void(0);" onclick="hide_details();">' . plog_tr('Hide details') . '</a>'; 
    21922202                } 
    21932203} 
     
    22052215 
    22062216        if ($next_url) 
    2207                 $next_link = '<a accesskey="." href="'.$next_url.'">Next &raquo;</a>'; 
     2217                $next_link = '<a id="next-button" accesskey="." href="'.$next_url.'">' . plog_tr('Next') . ' &raquo;</a>'; 
     2218                // Jumpdown: $next_link = '<a id="next-button" accesskey="." href="'.$next_url.'#next-button">' . plog_tr('Next') . ' &raquo;</a>'; 
    22082219        else 
    22092220                $next_link = ''; 
     
    22162227         
    22172228        if ($prev_url)  
    2218                 $prev_link = '<a accesskey="," href="'.$prev_url.'">&laquo; Previous</a>'; 
     2229                $prev_link = '<a id="prev-button" accesskey="," href="'.$prev_url.'">&laquo; ' . plog_tr('Previous') . '</a>'; 
     2230                // Jumpdown: $prev_link = '<a id="prev-button" accesskey="," href="'.$prev_url.'#prev-button">&laquo; ' . plog_tr('Previous') . '</a>'; 
    22192231        else 
    22202232                $prev_link = '';