Changeset 40733

Show
Ignore:
Timestamp:
04/15/08 11:34:26 (3 months ago)
Author:
dd32
Message:

Internationalisation

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • add-from-server/trunk/add-from-server.php

    r39143 r40733  
    1515            if( function_exists('deactivate_plugins') ) 
    1616                  deactivate_plugins(__FILE__); 
    17             wp_die('<h1>Add From Server</h1> Sorry, This plugin requires WordPress 2.5+'); 
     17            wp_die(__('<h1>Add From Server</h1> Sorry, This plugin requires WordPress 2.5+', 'add-from-server')); 
    1818      } 
    1919      if( ! get_option('frmsvr_last_folder') ) 
     
    2626} 
    2727 
     28add_action('init', 'frmsvr_init'); 
     29function frmsvr_init(){ 
     30      var_dump(PLUGINDIR . '/' . dirname(plugin_basename(__FILE__))); 
     31    load_plugin_textdomain('add-from-server', PLUGINDIR . '/' . dirname(plugin_basename(__FILE__))); 
     32} 
     33 
    2834add_filter('media_upload_tabs', 'frmsvr_tabs'); 
    2935function frmsvr_tabs($tabs){ 
    3036      if( current_user_can( 'unfiltered_upload' ) ) 
    31             $tabs['server'] = __('Add From Server'); 
     37            $tabs['server'] = __('Add From Server', 'add-from-server'); 
    3238      return $tabs; 
    3339} 
     
    8995      $return = "<form action='$folderurl$base' method='POST'><table>"; 
    9096      $return .= "<tr> 
    91                               <th>Import</th> 
    92                               <th>Filename</th> 
     97                              <th>" . __('Import', 'add-from-server') . "</th> 
     98                              <th>" . __('Filename', 'add-from-server') . "</th> 
    9399                        </tr>"; 
    94100      $parent = realpath($base . '/..'); 
     
    96102      $return .= "<tr> 
    97103                              <td>&nbsp;</td> 
    98                               <td><strong><a href='$folderurl$parent'>Parent Folder</a></strong></td> 
     104                              <td><strong><a href='$folderurl$parent'>" . __('Parent Folder', 'add-from-server') . "</a></strong></td> 
    99105                        </tr>"; 
    100106      foreach($files as $file){ 
     
    122128            $ret = pu_checkbox(false); 
    123129            if( $ret ) 
    124                   $ret .= '(<em>Note: Will not take effect if selected file is within an upload folder at present</em>)<br />'
     130                  $ret .= sprintf('(<em>%s</em>)<br />', __('Note: Will not take effect if selected file is within an upload folder at present', 'add-from-server'))
    125131            $return .= $ret; 
    126132      } 
    127133 
    128134      $return .= ' 
    129                   <input type="submit" name="submit" value="Import selected files" /> 
     135                  <input type="submit" name="submit" value=" ' . __('Import selected files', 'add-from-server') . '" /> 
    130136                  </form>'; 
    131137       
     
    141147            if( $id ){ 
    142148                  echo "<script type='text/javascript'>jQuery('#attachments-count').text(1 * jQuery('#attachments-count').text() + 1);</script>"; 
    143                   echo "<div class='updated'><p><em>$file</em> has been added to Media library</p></div>"
     149                  echo '<div class="updated"><p>' . sprintf(__('<em>%s</em> has been added to Media library', 'add-from-server'), $file) . '</p></div>'
    144150            } 
    145151      } 
     
    175181             
    176182            global $wpdb; 
    177             $results = $wpdb->get_col("SELECT ID FROM `{$wpdb->posts}` WHERE `guid` = '$url' AND `post_type` = 'attachment'"); 
     183            $results = $wpdb->get_col( $wpdb->prepare("SELECT ID FROM `{$wpdb->posts}` WHERE `guid` = '%s' AND `post_type` = 'attachment'", $url) ); 
    178184            if( count($results) > 0 ) 
    179185                  return $results[0]; //Kill function off at this point.. It exists in the media library allready. 
     
    184190            $new_file = $uploads['path'] . '/' . $filename; 
    185191            if ( false === @ copy( $file, $new_file ) ) 
    186                   wp_die( printf( __('The uploaded file could not be copied to %s.' ), $uploads['path'] )); 
     192                  return $upload_error_handler( $file, sprintf( __('The uploaded file could not be moved to %s.' ), $uploads['path'] ) ); 
    187193       
    188194            // Set correct file permissions 
     
    238244       
    239245?> 
    240 <h3><?php _e('Add From Server'); ?></h3> 
    241  
    242 <p><?php printf(__('Once you have selected files to be imported, Head over to the <a href="%s">Media Library tab</a> to add them to your post.'), 'media-upload.php?type=image&tab=library&post_id=' . $post_id ); ?></p> 
    243  
    244 <p><strong><?php _e('Current Directory'); ?>: </strong><span id="cwd"><?php echo $cwd; ?></span></p> 
     246<h3><?php _e('Add From Server', 'add-from-server'); ?></h3> 
     247 
     248<p><?php printf(__('Once you have selected files to be imported, Head over to the <a href="%s">Media Library tab</a> to add them to your post.', 'add-from-server'), 'media-upload.php?type=image&tab=library&post_id=' . $post_id ); ?></p> 
     249 
     250<p><strong><?php _e('Current Directory', 'add-from-server'); ?>: </strong><span id="cwd"><?php echo $cwd; ?></span></p> 
    245251<div id="filesystem-list"> 
    246252<?php frmsvr_list_files('display') ?>