Ticket #3997: more-rpc-errors-i18n.diff
| File more-rpc-errors-i18n.diff, 6.7 kB (added by nbachiyski, 2 years ago) |
|---|
-
xmlrpc.php
old new 970 970 switch($post_type) { 971 971 case "post": 972 972 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"))); 975 974 } 976 975 break; 977 976 case "page": 978 977 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"))); 981 979 } 982 980 break; 983 981 default: … … 1156 1154 switch($post_type) { 1157 1155 case "post": 1158 1156 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."))); 1161 1158 } 1162 1159 break; 1163 1160 case "page": 1164 1161 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."))); 1167 1163 } 1168 1164 break; 1169 1165 default: … … 1467 1463 1468 1464 $upload = wp_upload_bits($name, $type, $bits, $overwrite); 1469 1465 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']); 1471 1467 logIO('O', '(MW) ' . $errorString); 1472 1468 return new IXR_Error(500, $errorString); 1473 1469 } … … 1778 1774 } 1779 1775 } else { 1780 1776 // 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.')); 1782 1778 } 1783 1779 $post_ID = (int) $post_ID; 1784 1780 … … 1788 1784 $post = get_post($post_ID); 1789 1785 1790 1786 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.')); 1792 1788 1793 1789 if ( $post_ID == url_to_postid($pagelinkedfrom) ) 1794 1790 return new IXR_Error(0, __('The source URL and the target URL cannot both point to the same resource.')); 1795 1791 1796 1792 // Check if pings are on 1797 1793 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.')); 1799 1795 1800 1796 // Let's check that the remote site didn't already pingback this entry 1801 1797 $result = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = '$post_ID' AND comment_author_url = '$pagelinkedfrom'"); … … 1877 1873 $comment_ID = wp_new_comment($commentdata); 1878 1874 do_action('pingback_post', $comment_ID); 1879 1875 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); 1881 1877 } 1882 1878 1883 1879 … … 1895 1891 $post_ID = url_to_postid($url); 1896 1892 if (!$post_ID) { 1897 1893 // 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.')); 1899 1895 } 1900 1896 1901 1897 $actual_post = wp_get_single_post($post_ID, ARRAY_A); -
wp-app.php
old new 415 415 $cap = ($publish) ? 'publish_posts' : 'edit_posts'; 416 416 417 417 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.')); 419 419 420 420 $blog_ID = (int ) $blog_id; 421 421 $post_status = ($publish) ? 'publish' : 'draft'; … … 433 433 $postID = wp_insert_post($post_data); 434 434 435 435 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.')); 437 437 } 438 438 439 439 $output = $this->get_entry($postID); … … 472 472 $this->escape($GLOBALS['entry']); 473 473 474 474 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.')); 476 476 477 477 $publish = (isset($parsed->draft) && trim($parsed->draft) == 'yes') ? false : true; 478 478 … … 492 492 $result = wp_update_post($postdata); 493 493 494 494 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.')); 496 496 } 497 497 498 498 log_app('function',"put_post($postID)"); … … 506 506 $this->set_current_entry($postID); 507 507 508 508 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.')); 510 510 } 511 511 512 512 if ($entry['post_type'] == 'attachment') { … … 515 515 $result = wp_delete_post($postID); 516 516 517 517 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.')); 519 519 } 520 520 521 521 log_app('function',"delete_post($postID)"); … … 543 543 $type = $this->get_accepted_content_type(); 544 544 545 545 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.')); 547 547 548 548 $fp = fopen("php://input", "rb"); 549 549 $bits = NULL;
