WordPress.org

Make WordPress Core

Ticket #3997: more-rpc-errors-i18n.diff

File more-rpc-errors-i18n.diff, 6.7 KB (added by nbachiyski, 8 years ago)

More they come...

  • xmlrpc.php

     
    970970                        switch($post_type) { 
    971971                                case "post": 
    972972                                        if(!current_user_can("edit_others_posts")) { 
    973                                                 return(new IXR_Error(401, "You are not allowed to " . 
    974                                                         "post as this user")); 
     973                                                return(new IXR_Error(401, __("You are not allowed to post as this user"))); 
    975974                                        } 
    976975                                        break; 
    977976                                case "page": 
    978977                                        if(!current_user_can("edit_others_pages")) { 
    979                                                 return(new IXR_Error(401, "You are not allowed to " . 
    980                                                         "create pages as this user")); 
     978                                                return(new IXR_Error(401, __("You are not allowed to create pages as this user"))); 
    981979                                        } 
    982980                                        break; 
    983981                                default: 
     
    11561154                        switch($post_type) { 
    11571155                                case "post": 
    11581156                                        if(!current_user_can("edit_others_posts")) { 
    1159                                                 return(new IXR_Error(401, "You are not allowed to " . 
    1160                                                         "change the post author as this user.")); 
     1157                                                return(new IXR_Error(401, __("You are not allowed to change the post author as this user."))); 
    11611158                                        } 
    11621159                                        break; 
    11631160                                case "page": 
    11641161                                        if(!current_user_can("edit_others_pages")) { 
    1165                                                 return(new IXR_Error(401, "You are not allowed to " . 
    1166                                                         "change the page author as this user.")); 
     1162                                                return(new IXR_Error(401, __("You are not allowed to change the page author as this user."))); 
    11671163                                        } 
    11681164                                        break; 
    11691165                                default: 
     
    14671463 
    14681464                $upload = wp_upload_bits($name, $type, $bits, $overwrite); 
    14691465                if ( ! empty($upload['error']) ) { 
    1470                         $errorString = 'Could not write file ' . $name . ' (' . $upload['error'] . ')'; 
     1466                        $errorString = sprintf(__('Could not write file %1$s (%2$s)'), $name, $upload['error']); 
    14711467                        logIO('O', '(MW) ' . $errorString); 
    14721468                        return new IXR_Error(500, $errorString); 
    14731469                } 
     
    17781774                        } 
    17791775                } else { 
    17801776                        // TODO: Attempt to extract a post ID from the given URL 
    1781                         return new IXR_Error(33, 'The specified target URL cannot be used as a target. It either doesn\'t exist, or it is not a pingback-enabled resource.'); 
     1777                        return new IXR_Error(33, __('The specified target URL cannot be used as a target. It either doesn\'t exist, or it is not a pingback-enabled resource.')); 
    17821778                } 
    17831779                $post_ID = (int) $post_ID; 
    17841780 
     
    17881784                $post = get_post($post_ID); 
    17891785 
    17901786                if ( !$post ) // Post_ID not found 
    1791                         return new IXR_Error(33, 'The specified target URL cannot be used as a target. It either doesn\'t exist, or it is not a pingback-enabled resource.'); 
     1787                        return new IXR_Error(33, __('The specified target URL cannot be used as a target. It either doesn\'t exist, or it is not a pingback-enabled resource.')); 
    17921788 
    17931789                if ( $post_ID == url_to_postid($pagelinkedfrom) ) 
    17941790                        return new IXR_Error(0, __('The source URL and the target URL cannot both point to the same resource.')); 
    17951791 
    17961792                // Check if pings are on 
    17971793                if ( 'closed' == $post->ping_status ) 
    1798                         return new IXR_Error(33, 'The specified target URL cannot be used as a target. It either doesn\'t exist, or it is not a pingback-enabled resource.'); 
     1794                        return new IXR_Error(33, __('The specified target URL cannot be used as a target. It either doesn\'t exist, or it is not a pingback-enabled resource.')); 
    17991795 
    18001796                // Let's check that the remote site didn't already pingback this entry 
    18011797                $result = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = '$post_ID' AND comment_author_url = '$pagelinkedfrom'"); 
     
    18771873                $comment_ID = wp_new_comment($commentdata); 
    18781874                do_action('pingback_post', $comment_ID); 
    18791875 
    1880                 return "Pingback from $pagelinkedfrom to $pagelinkedto registered. Keep the web talking! :-)"; 
     1876                return sprintf(__('Pingback from %2$s to %2$s registered. Keep the web talking! :-)'), $pagelinkedfrom, $pagelinkedto); 
    18811877        } 
    18821878 
    18831879 
     
    18951891                $post_ID = url_to_postid($url); 
    18961892                if (!$post_ID) { 
    18971893                        // We aren't sure that the resource is available and/or pingback enabled 
    1898                         return new IXR_Error(33, 'The specified target URL cannot be used as a target. It either doesn\'t exist, or it is not a pingback-enabled resource.'); 
     1894                        return new IXR_Error(33, __('The specified target URL cannot be used as a target. It either doesn\'t exist, or it is not a pingback-enabled resource.')); 
    18991895                } 
    19001896 
    19011897                $actual_post = wp_get_single_post($post_ID, ARRAY_A); 
  • wp-app.php

     
    415415                $cap = ($publish) ? 'publish_posts' : 'edit_posts'; 
    416416 
    417417                if(!current_user_can($cap)) 
    418                         $this->auth_required('Sorry, you do not have the right to edit/publish new posts.'); 
     418                        $this->auth_required(__('Sorry, you do not have the right to edit/publish new posts.')); 
    419419 
    420420                $blog_ID = (int ) $blog_id; 
    421421                $post_status = ($publish) ? 'publish' : 'draft'; 
     
    433433                $postID = wp_insert_post($post_data); 
    434434 
    435435                if (!$postID) { 
    436                         $this->internal_error('Sorry, your entry could not be posted. Something wrong happened.'); 
     436                        $this->internal_error(__('Sorry, your entry could not be posted. Something wrong happened.')); 
    437437                } 
    438438 
    439439                $output = $this->get_entry($postID); 
     
    472472                $this->escape($GLOBALS['entry']); 
    473473 
    474474                if(!current_user_can('edit_post', $entry['ID'])) 
    475                         $this->auth_required('Sorry, you do not have the right to edit this post.'); 
     475                        $this->auth_required(__('Sorry, you do not have the right to edit this post.')); 
    476476 
    477477                $publish = (isset($parsed->draft) && trim($parsed->draft) == 'yes') ? false : true; 
    478478 
     
    492492                $result = wp_update_post($postdata); 
    493493 
    494494                if (!$result) { 
    495                         $this->internal_error('For some strange yet very annoying reason, this post could not be edited.'); 
     495                        $this->internal_error(__('For some strange yet very annoying reason, this post could not be edited.')); 
    496496                } 
    497497 
    498498                log_app('function',"put_post($postID)"); 
     
    506506                $this->set_current_entry($postID); 
    507507 
    508508                if(!current_user_can('edit_post', $postID)) { 
    509                         $this->auth_required('Sorry, you do not have the right to delete this post.'); 
     509                        $this->auth_required(__('Sorry, you do not have the right to delete this post.')); 
    510510                } 
    511511 
    512512                if ($entry['post_type'] == 'attachment') { 
     
    515515                        $result = wp_delete_post($postID); 
    516516 
    517517                        if (!$result) { 
    518                                 $this->internal_error('For some strange yet very annoying reason, this post could not be deleted.'); 
     518                                $this->internal_error(__('For some strange yet very annoying reason, this post could not be deleted.')); 
    519519                        } 
    520520 
    521521                        log_app('function',"delete_post($postID)"); 
     
    543543                $type = $this->get_accepted_content_type(); 
    544544 
    545545                if(!current_user_can('upload_files')) 
    546                         $this->auth_required('You do not have permission to upload files.'); 
     546                        $this->auth_required(__('You do not have permission to upload files.')); 
    547547 
    548548                $fp = fopen("php://input", "rb"); 
    549549                $bits = NULL;