Make WordPress Core

Ticket #41305: 41305.optimize-rest-api

File 41305.optimize-rest-api, 169.5 KB (added by schlessera, 9 years ago)

Optimizes all REST API translation to be lazily evaluated.

Line 
1diff --git src/wp-includes/rest-api.php src/wp-includes/rest-api.php
2index fd6dc3e5f9..a06d94f7bd 100644
3--- src/wp-includes/rest-api.php
4+++ src/wp-includes/rest-api.php
5@@ -39,10 +39,10 @@ function register_rest_route( $namespace, $route, $args = array(), $override = f
6 * and namespace indexes. If you really need to register a
7 * non-namespaced route, call `WP_REST_Server::register_route` directly.
8 */
9- _doing_it_wrong( 'register_rest_route', __( 'Routes must be namespaced with plugin or theme name and version.' ), '4.4.0' );
10+ _doing_it_wrong( 'register_rest_route', _l( 'Routes must be namespaced with plugin or theme name and version.' ), '4.4.0' );
11 return false;
12 } else if ( empty( $route ) ) {
13- _doing_it_wrong( 'register_rest_route', __( 'Route must be specified.' ), '4.4.0' );
14+ _doing_it_wrong( 'register_rest_route', _l( 'Route must be specified.' ), '4.4.0' );
15 return false;
16 }
17
18@@ -494,10 +494,10 @@ function rest_handle_deprecated_function( $function, $replacement, $version ) {
19 }
20 if ( ! empty( $replacement ) ) {
21 /* translators: 1: function name, 2: WordPress version number, 3: new function name */
22- $string = sprintf( __( '%1$s (since %2$s; use %3$s instead)' ), $function, $version, $replacement );
23+ $string = sprintf( _l( '%1$s (since %2$s; use %3$s instead)' ), $function, $version, $replacement );
24 } else {
25 /* translators: 1: function name, 2: WordPress version number */
26- $string = sprintf( __( '%1$s (since %2$s; no alternative available)' ), $function, $version );
27+ $string = sprintf( _l( '%1$s (since %2$s; no alternative available)' ), $function, $version );
28 }
29
30 header( sprintf( 'X-WP-DeprecatedFunction: %s', $string ) );
31@@ -518,10 +518,10 @@ function rest_handle_deprecated_argument( $function, $message, $version ) {
32 }
33 if ( ! empty( $message ) ) {
34 /* translators: 1: function name, 2: WordPress version number, 3: error message */
35- $string = sprintf( __( '%1$s (since %2$s; %3$s)' ), $function, $version, $message );
36+ $string = sprintf( _l( '%1$s (since %2$s; %3$s)' ), $function, $version, $message );
37 } else {
38 /* translators: 1: function name, 2: WordPress version number */
39- $string = sprintf( __( '%1$s (since %2$s; no alternative available)' ), $function, $version );
40+ $string = sprintf( _l( '%1$s (since %2$s; no alternative available)' ), $function, $version );
41 }
42
43 header( sprintf( 'X-WP-DeprecatedParam: %s', $string ) );
44@@ -741,7 +741,7 @@ function rest_cookie_check_errors( $result ) {
45 $result = wp_verify_nonce( $nonce, 'wp_rest' );
46
47 if ( ! $result ) {
48- return new WP_Error( 'rest_cookie_invalid_nonce', __( 'Cookie nonce is invalid' ), array( 'status' => 403 ) );
49+ return new WP_Error( 'rest_cookie_invalid_nonce', _l( 'Cookie nonce is invalid' ), array( 'status' => 403 ) );
50 }
51
52 // Send a refreshed nonce in header.
53@@ -1046,7 +1046,7 @@ function rest_validate_value_from_schema( $value, $args, $param = '' ) {
54 }
55 if ( ! wp_is_numeric_array( $value ) ) {
56 /* translators: 1: parameter, 2: type name */
57- return new WP_Error( 'rest_invalid_param', sprintf( __( '%1$s is not of type %2$s.' ), $param, 'array' ) );
58+ return new WP_Error( 'rest_invalid_param', sprintf( _l( '%1$s is not of type %2$s.' ), $param, 'array' ) );
59 }
60 foreach ( $value as $index => $v ) {
61 $is_valid = rest_validate_value_from_schema( $v, $args['items'], $param . '[' . $index . ']' );
62@@ -1058,47 +1058,47 @@ function rest_validate_value_from_schema( $value, $args, $param = '' ) {
63 if ( ! empty( $args['enum'] ) ) {
64 if ( ! in_array( $value, $args['enum'], true ) ) {
65 /* translators: 1: parameter, 2: list of valid values */
66- return new WP_Error( 'rest_invalid_param', sprintf( __( '%1$s is not one of %2$s.' ), $param, implode( ', ', $args['enum'] ) ) );
67+ return new WP_Error( 'rest_invalid_param', sprintf( _l( '%1$s is not one of %2$s.' ), $param, implode( ', ', $args['enum'] ) ) );
68 }
69 }
70
71 if ( in_array( $args['type'], array( 'integer', 'number' ) ) && ! is_numeric( $value ) ) {
72 /* translators: 1: parameter, 2: type name */
73- return new WP_Error( 'rest_invalid_param', sprintf( __( '%1$s is not of type %2$s.' ), $param, $args['type'] ) );
74+ return new WP_Error( 'rest_invalid_param', sprintf( _l( '%1$s is not of type %2$s.' ), $param, $args['type'] ) );
75 }
76
77 if ( 'integer' === $args['type'] && round( floatval( $value ) ) !== floatval( $value ) ) {
78 /* translators: 1: parameter, 2: type name */
79- return new WP_Error( 'rest_invalid_param', sprintf( __( '%1$s is not of type %2$s.' ), $param, 'integer' ) );
80+ return new WP_Error( 'rest_invalid_param', sprintf( _l( '%1$s is not of type %2$s.' ), $param, 'integer' ) );
81 }
82
83 if ( 'boolean' === $args['type'] && ! rest_is_boolean( $value ) ) {
84 /* translators: 1: parameter, 2: type name */
85- return new WP_Error( 'rest_invalid_param', sprintf( __( '%1$s is not of type %2$s.' ), $value, 'boolean' ) );
86+ return new WP_Error( 'rest_invalid_param', sprintf( _l( '%1$s is not of type %2$s.' ), $value, 'boolean' ) );
87 }
88
89 if ( 'string' === $args['type'] && ! is_string( $value ) ) {
90 /* translators: 1: parameter, 2: type name */
91- return new WP_Error( 'rest_invalid_param', sprintf( __( '%1$s is not of type %2$s.' ), $param, 'string' ) );
92+ return new WP_Error( 'rest_invalid_param', sprintf( _l( '%1$s is not of type %2$s.' ), $param, 'string' ) );
93 }
94
95 if ( isset( $args['format'] ) ) {
96 switch ( $args['format'] ) {
97 case 'date-time' :
98 if ( ! rest_parse_date( $value ) ) {
99- return new WP_Error( 'rest_invalid_date', __( 'Invalid date.' ) );
100+ return new WP_Error( 'rest_invalid_date', _l( 'Invalid date.' ) );
101 }
102 break;
103
104 case 'email' :
105 if ( ! is_email( $value ) ) {
106- return new WP_Error( 'rest_invalid_email', __( 'Invalid email address.' ) );
107+ return new WP_Error( 'rest_invalid_email', _l( 'Invalid email address.' ) );
108 }
109 break;
110 case 'ip' :
111 if ( ! rest_is_ip_address( $value ) ) {
112 /* translators: %s: IP address */
113- return new WP_Error( 'rest_invalid_param', sprintf( __( '%s is not a valid IP address.' ), $value ) );
114+ return new WP_Error( 'rest_invalid_param', sprintf( _l( '%s is not a valid IP address.' ), $value ) );
115 }
116 break;
117 }
118@@ -1108,39 +1108,39 @@ function rest_validate_value_from_schema( $value, $args, $param = '' ) {
119 if ( isset( $args['minimum'] ) && ! isset( $args['maximum'] ) ) {
120 if ( ! empty( $args['exclusiveMinimum'] ) && $value <= $args['minimum'] ) {
121 /* translators: 1: parameter, 2: minimum number */
122- return new WP_Error( 'rest_invalid_param', sprintf( __( '%1$s must be greater than %2$d' ), $param, $args['minimum'] ) );
123+ return new WP_Error( 'rest_invalid_param', sprintf( _l( '%1$s must be greater than %2$d' ), $param, $args['minimum'] ) );
124 } elseif ( empty( $args['exclusiveMinimum'] ) && $value < $args['minimum'] ) {
125 /* translators: 1: parameter, 2: minimum number */
126- return new WP_Error( 'rest_invalid_param', sprintf( __( '%1$s must be greater than or equal to %2$d' ), $param, $args['minimum'] ) );
127+ return new WP_Error( 'rest_invalid_param', sprintf( _l( '%1$s must be greater than or equal to %2$d' ), $param, $args['minimum'] ) );
128 }
129 } elseif ( isset( $args['maximum'] ) && ! isset( $args['minimum'] ) ) {
130 if ( ! empty( $args['exclusiveMaximum'] ) && $value >= $args['maximum'] ) {
131 /* translators: 1: parameter, 2: maximum number */
132- return new WP_Error( 'rest_invalid_param', sprintf( __( '%1$s must be less than %2$d' ), $param, $args['maximum'] ) );
133+ return new WP_Error( 'rest_invalid_param', sprintf( _l( '%1$s must be less than %2$d' ), $param, $args['maximum'] ) );
134 } elseif ( empty( $args['exclusiveMaximum'] ) && $value > $args['maximum'] ) {
135 /* translators: 1: parameter, 2: maximum number */
136- return new WP_Error( 'rest_invalid_param', sprintf( __( '%1$s must be less than or equal to %2$d' ), $param, $args['maximum'] ) );
137+ return new WP_Error( 'rest_invalid_param', sprintf( _l( '%1$s must be less than or equal to %2$d' ), $param, $args['maximum'] ) );
138 }
139 } elseif ( isset( $args['maximum'] ) && isset( $args['minimum'] ) ) {
140 if ( ! empty( $args['exclusiveMinimum'] ) && ! empty( $args['exclusiveMaximum'] ) ) {
141 if ( $value >= $args['maximum'] || $value <= $args['minimum'] ) {
142 /* translators: 1: parameter, 2: minimum number, 3: maximum number */
143- return new WP_Error( 'rest_invalid_param', sprintf( __( '%1$s must be between %2$d (exclusive) and %3$d (exclusive)' ), $param, $args['minimum'], $args['maximum'] ) );
144+ return new WP_Error( 'rest_invalid_param', sprintf( _l( '%1$s must be between %2$d (exclusive) and %3$d (exclusive)' ), $param, $args['minimum'], $args['maximum'] ) );
145 }
146 } elseif ( empty( $args['exclusiveMinimum'] ) && ! empty( $args['exclusiveMaximum'] ) ) {
147 if ( $value >= $args['maximum'] || $value < $args['minimum'] ) {
148 /* translators: 1: parameter, 2: minimum number, 3: maximum number */
149- return new WP_Error( 'rest_invalid_param', sprintf( __( '%1$s must be between %2$d (inclusive) and %3$d (exclusive)' ), $param, $args['minimum'], $args['maximum'] ) );
150+ return new WP_Error( 'rest_invalid_param', sprintf( _l( '%1$s must be between %2$d (inclusive) and %3$d (exclusive)' ), $param, $args['minimum'], $args['maximum'] ) );
151 }
152 } elseif ( ! empty( $args['exclusiveMinimum'] ) && empty( $args['exclusiveMaximum'] ) ) {
153 if ( $value > $args['maximum'] || $value <= $args['minimum'] ) {
154 /* translators: 1: parameter, 2: minimum number, 3: maximum number */
155- return new WP_Error( 'rest_invalid_param', sprintf( __( '%1$s must be between %2$d (exclusive) and %3$d (inclusive)' ), $param, $args['minimum'], $args['maximum'] ) );
156+ return new WP_Error( 'rest_invalid_param', sprintf( _l( '%1$s must be between %2$d (exclusive) and %3$d (inclusive)' ), $param, $args['minimum'], $args['maximum'] ) );
157 }
158 } elseif ( empty( $args['exclusiveMinimum'] ) && empty( $args['exclusiveMaximum'] ) ) {
159 if ( $value > $args['maximum'] || $value < $args['minimum'] ) {
160 /* translators: 1: parameter, 2: minimum number, 3: maximum number */
161- return new WP_Error( 'rest_invalid_param', sprintf( __( '%1$s must be between %2$d (inclusive) and %3$d (inclusive)' ), $param, $args['minimum'], $args['maximum'] ) );
162+ return new WP_Error( 'rest_invalid_param', sprintf( _l( '%1$s must be between %2$d (inclusive) and %3$d (inclusive)' ), $param, $args['minimum'], $args['maximum'] ) );
163 }
164 }
165 }
166diff --git src/wp-includes/rest-api/class-wp-rest-request.php src/wp-includes/rest-api/class-wp-rest-request.php
167index e41c014557..83a7c2458c 100644
168--- src/wp-includes/rest-api/class-wp-rest-request.php
169+++ src/wp-includes/rest-api/class-wp-rest-request.php
170@@ -692,7 +692,7 @@ class WP_REST_Request implements ArrayAccess {
171 $error_data['json_error_message'] = json_last_error_msg();
172 }
173
174- return new WP_Error( 'rest_invalid_json', __( 'Invalid JSON body passed.' ), $error_data );
175+ return new WP_Error( 'rest_invalid_json', _l( 'Invalid JSON body passed.' ), $error_data );
176 }
177
178 $this->params['JSON'] = $params;
179@@ -846,7 +846,7 @@ class WP_REST_Request implements ArrayAccess {
180 }
181
182 if ( $invalid_params ) {
183- return new WP_Error( 'rest_invalid_param', sprintf( __( 'Invalid parameter(s): %s' ), implode( ', ', array_keys( $invalid_params ) ) ), array( 'status' => 400, 'params' => $invalid_params ) );
184+ return new WP_Error( 'rest_invalid_param', sprintf( _l( 'Invalid parameter(s): %s' ), implode( ', ', array_keys( $invalid_params ) ) ), array( 'status' => 400, 'params' => $invalid_params ) );
185 }
186
187 return true;
188@@ -885,7 +885,7 @@ class WP_REST_Request implements ArrayAccess {
189 }
190
191 if ( ! empty( $required ) ) {
192- return new WP_Error( 'rest_missing_callback_param', sprintf( __( 'Missing parameter(s): %s' ), implode( ', ', $required ) ), array( 'status' => 400, 'params' => $required ) );
193+ return new WP_Error( 'rest_missing_callback_param', sprintf( _l( 'Missing parameter(s): %s' ), implode( ', ', $required ) ), array( 'status' => 400, 'params' => $required ) );
194 }
195
196 /*
197@@ -903,7 +903,7 @@ class WP_REST_Request implements ArrayAccess {
198 $valid_check = call_user_func( $arg['validate_callback'], $param, $this, $key );
199
200 if ( false === $valid_check ) {
201- $invalid_params[ $key ] = __( 'Invalid parameter.' );
202+ $invalid_params[ $key ] = _l( 'Invalid parameter.' );
203 }
204
205 if ( is_wp_error( $valid_check ) ) {
206@@ -913,7 +913,7 @@ class WP_REST_Request implements ArrayAccess {
207 }
208
209 if ( $invalid_params ) {
210- return new WP_Error( 'rest_invalid_param', sprintf( __( 'Invalid parameter(s): %s' ), implode( ', ', array_keys( $invalid_params ) ) ), array( 'status' => 400, 'params' => $invalid_params ) );
211+ return new WP_Error( 'rest_invalid_param', sprintf( _l( 'Invalid parameter(s): %s' ), implode( ', ', array_keys( $invalid_params ) ) ), array( 'status' => 400, 'params' => $invalid_params ) );
212 }
213
214 return true;
215diff --git src/wp-includes/rest-api/class-wp-rest-server.php src/wp-includes/rest-api/class-wp-rest-server.php
216index 2ec8ccde23..2c1427d22b 100644
217--- src/wp-includes/rest-api/class-wp-rest-server.php
218+++ src/wp-includes/rest-api/class-wp-rest-server.php
219@@ -269,7 +269,7 @@ class WP_REST_Server {
220 * @param bool $rest_enabled Whether the REST API is enabled. Default true.
221 */
222 apply_filters_deprecated( 'rest_enabled', array( true ), '4.7.0', 'rest_authentication_errors',
223- __( 'The REST API can no longer be completely disabled, the rest_authentication_errors filter can be used to restrict access to the API, instead.' )
224+ _l( 'The REST API can no longer be completely disabled, the rest_authentication_errors filter can be used to restrict access to the API, instead.' )
225 );
226
227 /**
228@@ -285,13 +285,13 @@ class WP_REST_Server {
229
230 if ( isset( $_GET['_jsonp'] ) ) {
231 if ( ! $jsonp_enabled ) {
232- echo $this->json_error( 'rest_callback_disabled', __( 'JSONP support is disabled on this site.' ), 400 );
233+ echo $this->json_error( 'rest_callback_disabled', _l( 'JSONP support is disabled on this site.' ), 400 );
234 return false;
235 }
236
237 $jsonp_callback = $_GET['_jsonp'];
238 if ( ! wp_check_jsonp_callback( $jsonp_callback ) ) {
239- echo $this->json_error( 'rest_callback_invalid', __( 'Invalid JSONP callback function.' ), 400 );
240+ echo $this->json_error( 'rest_callback_invalid', _l( 'Invalid JSONP callback function.' ), 400 );
241 return false;
242 }
243 }
244@@ -862,7 +862,7 @@ class WP_REST_Server {
245 }
246
247 if ( ! is_callable( $callback ) ) {
248- $response = new WP_Error( 'rest_invalid_handler', __( 'The handler for the route is invalid' ), array( 'status' => 500 ) );
249+ $response = new WP_Error( 'rest_invalid_handler', _l( 'The handler for the route is invalid' ), array( 'status' => 500 ) );
250 }
251
252 if ( ! is_wp_error( $response ) ) {
253@@ -919,7 +919,7 @@ class WP_REST_Server {
254 if ( is_wp_error( $permission ) ) {
255 $response = $permission;
256 } elseif ( false === $permission || null === $permission ) {
257- $response = new WP_Error( 'rest_forbidden', __( 'Sorry, you are not allowed to do that.' ), array( 'status' => 403 ) );
258+ $response = new WP_Error( 'rest_forbidden', _l( 'Sorry, you are not allowed to do that.' ), array( 'status' => 403 ) );
259 }
260 }
261 }
262@@ -983,7 +983,7 @@ class WP_REST_Server {
263 }
264 }
265
266- return $this->error_to_response( new WP_Error( 'rest_no_route', __( 'No route was found matching the URL and request method' ), array( 'status' => 404 ) ) );
267+ return $this->error_to_response( new WP_Error( 'rest_no_route', _l( 'No route was found matching the URL and request method' ), array( 'status' => 404 ) ) );
268 }
269
270 /**
271@@ -1073,7 +1073,7 @@ class WP_REST_Server {
272 $namespace = $request['namespace'];
273
274 if ( ! isset( $this->namespaces[ $namespace ] ) ) {
275- return new WP_Error( 'rest_invalid_namespace', __( 'The specified namespace could not be found.' ), array( 'status' => 404 ) );
276+ return new WP_Error( 'rest_invalid_namespace', _l( 'The specified namespace could not be found.' ), array( 'status' => 404 ) );
277 }
278
279 $routes = $this->namespaces[ $namespace ];
280diff --git src/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php src/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php
281index 43d057e167..d00bff397b 100644
282--- src/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php
283+++ src/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php
284@@ -72,7 +72,7 @@ class WP_REST_Attachments_Controller extends WP_REST_Posts_Controller {
285 }
286
287 if ( ! current_user_can( 'upload_files' ) ) {
288- return new WP_Error( 'rest_cannot_create', __( 'Sorry, you are not allowed to upload media on this site.' ), array( 'status' => 400 ) );
289+ return new WP_Error( 'rest_cannot_create', _l( 'Sorry, you are not allowed to upload media on this site.' ), array( 'status' => 400 ) );
290 }
291
292 // Attaching media to a post requires ability to edit said post.
293@@ -81,7 +81,7 @@ class WP_REST_Attachments_Controller extends WP_REST_Posts_Controller {
294 $post_parent_type = get_post_type_object( $parent->post_type );
295
296 if ( ! current_user_can( $post_parent_type->cap->edit_post, $request['post'] ) ) {
297- return new WP_Error( 'rest_cannot_edit', __( 'Sorry, you are not allowed to upload media to this post.' ), array( 'status' => rest_authorization_required_code() ) );
298+ return new WP_Error( 'rest_cannot_edit', _l( 'Sorry, you are not allowed to upload media to this post.' ), array( 'status' => rest_authorization_required_code() ) );
299 }
300 }
301
302@@ -100,7 +100,7 @@ class WP_REST_Attachments_Controller extends WP_REST_Posts_Controller {
303 public function create_item( $request ) {
304
305 if ( ! empty( $request['post'] ) && in_array( get_post_type( $request['post'] ), array( 'revision', 'attachment' ), true ) ) {
306- return new WP_Error( 'rest_invalid_param', __( 'Invalid parent type.' ), array( 'status' => 400 ) );
307+ return new WP_Error( 'rest_invalid_param', _l( 'Invalid parent type.' ), array( 'status' => 400 ) );
308 }
309
310 // Get the file via $_FILES or raw data.
311@@ -207,7 +207,7 @@ class WP_REST_Attachments_Controller extends WP_REST_Posts_Controller {
312 */
313 public function update_item( $request ) {
314 if ( ! empty( $request['post'] ) && in_array( get_post_type( $request['post'] ), array( 'revision', 'attachment' ), true ) ) {
315- return new WP_Error( 'rest_invalid_param', __( 'Invalid parent type.' ), array( 'status' => 400 ) );
316+ return new WP_Error( 'rest_invalid_param', _l( 'Invalid parent type.' ), array( 'status' => 400 ) );
317 }
318
319 $response = parent::update_item( $request );
320@@ -384,7 +384,7 @@ class WP_REST_Attachments_Controller extends WP_REST_Posts_Controller {
321 $schema = parent::get_item_schema();
322
323 $schema['properties']['alt_text'] = array(
324- 'description' => __( 'Alternative text to display when attachment is not displayed.' ),
325+ 'description' => _l( 'Alternative text to display when attachment is not displayed.' ),
326 'type' => 'string',
327 'context' => array( 'view', 'edit', 'embed' ),
328 'arg_options' => array(
329@@ -393,7 +393,7 @@ class WP_REST_Attachments_Controller extends WP_REST_Posts_Controller {
330 );
331
332 $schema['properties']['caption'] = array(
333- 'description' => __( 'The attachment caption.' ),
334+ 'description' => _l( 'The attachment caption.' ),
335 'type' => 'object',
336 'context' => array( 'view', 'edit', 'embed' ),
337 'arg_options' => array(
338@@ -401,12 +401,12 @@ class WP_REST_Attachments_Controller extends WP_REST_Posts_Controller {
339 ),
340 'properties' => array(
341 'raw' => array(
342- 'description' => __( 'Caption for the attachment, as it exists in the database.' ),
343+ 'description' => _l( 'Caption for the attachment, as it exists in the database.' ),
344 'type' => 'string',
345 'context' => array( 'edit' ),
346 ),
347 'rendered' => array(
348- 'description' => __( 'HTML caption for the attachment, transformed for display.' ),
349+ 'description' => _l( 'HTML caption for the attachment, transformed for display.' ),
350 'type' => 'string',
351 'context' => array( 'view', 'edit', 'embed' ),
352 'readonly' => true,
353@@ -415,7 +415,7 @@ class WP_REST_Attachments_Controller extends WP_REST_Posts_Controller {
354 );
355
356 $schema['properties']['description'] = array(
357- 'description' => __( 'The attachment description.' ),
358+ 'description' => _l( 'The attachment description.' ),
359 'type' => 'object',
360 'context' => array( 'view', 'edit' ),
361 'arg_options' => array(
362@@ -423,12 +423,12 @@ class WP_REST_Attachments_Controller extends WP_REST_Posts_Controller {
363 ),
364 'properties' => array(
365 'raw' => array(
366- 'description' => __( 'Description for the object, as it exists in the database.' ),
367+ 'description' => _l( 'Description for the object, as it exists in the database.' ),
368 'type' => 'string',
369 'context' => array( 'edit' ),
370 ),
371 'rendered' => array(
372- 'description' => __( 'HTML description for the object, transformed for display.' ),
373+ 'description' => _l( 'HTML description for the object, transformed for display.' ),
374 'type' => 'string',
375 'context' => array( 'view', 'edit' ),
376 'readonly' => true,
377@@ -437,7 +437,7 @@ class WP_REST_Attachments_Controller extends WP_REST_Posts_Controller {
378 );
379
380 $schema['properties']['media_type'] = array(
381- 'description' => __( 'Attachment type.' ),
382+ 'description' => _l( 'Attachment type.' ),
383 'type' => 'string',
384 'enum' => array( 'image', 'file' ),
385 'context' => array( 'view', 'edit', 'embed' ),
386@@ -445,27 +445,27 @@ class WP_REST_Attachments_Controller extends WP_REST_Posts_Controller {
387 );
388
389 $schema['properties']['mime_type'] = array(
390- 'description' => __( 'The attachment MIME type.' ),
391+ 'description' => _l( 'The attachment MIME type.' ),
392 'type' => 'string',
393 'context' => array( 'view', 'edit', 'embed' ),
394 'readonly' => true,
395 );
396
397 $schema['properties']['media_details'] = array(
398- 'description' => __( 'Details about the media file, specific to its type.' ),
399+ 'description' => _l( 'Details about the media file, specific to its type.' ),
400 'type' => 'object',
401 'context' => array( 'view', 'edit', 'embed' ),
402 'readonly' => true,
403 );
404
405 $schema['properties']['post'] = array(
406- 'description' => __( 'The ID for the associated post of the attachment.' ),
407+ 'description' => _l( 'The ID for the associated post of the attachment.' ),
408 'type' => 'integer',
409 'context' => array( 'view', 'edit' ),
410 );
411
412 $schema['properties']['source_url'] = array(
413- 'description' => __( 'URL to the original attachment file.' ),
414+ 'description' => _l( 'URL to the original attachment file.' ),
415 'type' => 'string',
416 'format' => 'uri',
417 'context' => array( 'view', 'edit', 'embed' ),
418@@ -489,21 +489,21 @@ class WP_REST_Attachments_Controller extends WP_REST_Posts_Controller {
419 */
420 protected function upload_from_data( $data, $headers ) {
421 if ( empty( $data ) ) {
422- return new WP_Error( 'rest_upload_no_data', __( 'No data supplied.' ), array( 'status' => 400 ) );
423+ return new WP_Error( 'rest_upload_no_data', _l( 'No data supplied.' ), array( 'status' => 400 ) );
424 }
425
426 if ( empty( $headers['content_type'] ) ) {
427- return new WP_Error( 'rest_upload_no_content_type', __( 'No Content-Type supplied.' ), array( 'status' => 400 ) );
428+ return new WP_Error( 'rest_upload_no_content_type', _l( 'No Content-Type supplied.' ), array( 'status' => 400 ) );
429 }
430
431 if ( empty( $headers['content_disposition'] ) ) {
432- return new WP_Error( 'rest_upload_no_content_disposition', __( 'No Content-Disposition supplied.' ), array( 'status' => 400 ) );
433+ return new WP_Error( 'rest_upload_no_content_disposition', _l( 'No Content-Disposition supplied.' ), array( 'status' => 400 ) );
434 }
435
436 $filename = self::get_filename_from_disposition( $headers['content_disposition'] );
437
438 if ( empty( $filename ) ) {
439- return new WP_Error( 'rest_upload_invalid_disposition', __( 'Invalid Content-Disposition supplied. Content-Disposition needs to be formatted as `attachment; filename="image.png"` or similar.' ), array( 'status' => 400 ) );
440+ return new WP_Error( 'rest_upload_invalid_disposition', _l( 'Invalid Content-Disposition supplied. Content-Disposition needs to be formatted as `attachment; filename="image.png"` or similar.' ), array( 'status' => 400 ) );
441 }
442
443 if ( ! empty( $headers['content_md5'] ) ) {
444@@ -512,7 +512,7 @@ class WP_REST_Attachments_Controller extends WP_REST_Posts_Controller {
445 $actual = md5( $data );
446
447 if ( $expected !== $actual ) {
448- return new WP_Error( 'rest_upload_hash_mismatch', __( 'Content hash did not match expected.' ), array( 'status' => 412 ) );
449+ return new WP_Error( 'rest_upload_hash_mismatch', _l( 'Content hash did not match expected.' ), array( 'status' => 412 ) );
450 }
451 }
452
453@@ -528,7 +528,7 @@ class WP_REST_Attachments_Controller extends WP_REST_Posts_Controller {
454 $fp = fopen( $tmpfname, 'w+' );
455
456 if ( ! $fp ) {
457- return new WP_Error( 'rest_upload_file_error', __( 'Could not open file handle.' ), array( 'status' => 500 ) );
458+ return new WP_Error( 'rest_upload_file_error', _l( 'Could not open file handle.' ), array( 'status' => 500 ) );
459 }
460
461 fwrite( $fp, $data );
462@@ -644,14 +644,14 @@ class WP_REST_Attachments_Controller extends WP_REST_Posts_Controller {
463
464 $params['media_type'] = array(
465 'default' => null,
466- 'description' => __( 'Limit result set to attachments of a particular media type.' ),
467+ 'description' => _l( 'Limit result set to attachments of a particular media type.' ),
468 'type' => 'string',
469 'enum' => array_keys( $media_types ),
470 );
471
472 $params['mime_type'] = array(
473 'default' => null,
474- 'description' => __( 'Limit result set to attachments of a particular MIME type.' ),
475+ 'description' => _l( 'Limit result set to attachments of a particular MIME type.' ),
476 'type' => 'string',
477 );
478
479@@ -689,7 +689,7 @@ class WP_REST_Attachments_Controller extends WP_REST_Posts_Controller {
480 */
481 protected function upload_from_file( $files, $headers ) {
482 if ( empty( $files ) ) {
483- return new WP_Error( 'rest_upload_no_data', __( 'No data supplied.' ), array( 'status' => 400 ) );
484+ return new WP_Error( 'rest_upload_no_data', _l( 'No data supplied.' ), array( 'status' => 400 ) );
485 }
486
487 // Verify hash, if given.
488@@ -699,7 +699,7 @@ class WP_REST_Attachments_Controller extends WP_REST_Posts_Controller {
489 $actual = md5_file( $files['file']['tmp_name'] );
490
491 if ( $expected !== $actual ) {
492- return new WP_Error( 'rest_upload_hash_mismatch', __( 'Content hash did not match expected.' ), array( 'status' => 412 ) );
493+ return new WP_Error( 'rest_upload_hash_mismatch', _l( 'Content hash did not match expected.' ), array( 'status' => 412 ) );
494 }
495 }
496
497diff --git src/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php src/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php
498index 4ed2026dcb..2a2fe5515d 100644
499--- src/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php
500+++ src/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php
501@@ -65,7 +65,7 @@ class WP_REST_Comments_Controller extends WP_REST_Controller {
502 register_rest_route( $this->namespace, '/' . $this->rest_base . '/(?P<id>[\d]+)', array(
503 'args' => array(
504 'id' => array(
505- 'description' => __( 'Unique identifier for the object.' ),
506+ 'description' => _l( 'Unique identifier for the object.' ),
507 'type' => 'integer',
508 ),
509 ),
510@@ -76,7 +76,7 @@ class WP_REST_Comments_Controller extends WP_REST_Controller {
511 'args' => array(
512 'context' => $this->get_context_param( array( 'default' => 'view' ) ),
513 'password' => array(
514- 'description' => __( 'The password for the parent post of the comment (if the post is password protected).' ),
515+ 'description' => _l( 'The password for the parent post of the comment (if the post is password protected).' ),
516 'type' => 'string',
517 ),
518 ),
519@@ -95,10 +95,10 @@ class WP_REST_Comments_Controller extends WP_REST_Controller {
520 'force' => array(
521 'type' => 'boolean',
522 'default' => false,
523- 'description' => __( 'Whether to bypass trash and force deletion.' ),
524+ 'description' => _l( 'Whether to bypass trash and force deletion.' ),
525 ),
526 'password' => array(
527- 'description' => __( 'The password for the parent post of the comment (if the post is password protected).' ),
528+ 'description' => _l( 'The password for the parent post of the comment (if the post is password protected).' ),
529 'type' => 'string',
530 ),
531 ),
532@@ -123,15 +123,15 @@ class WP_REST_Comments_Controller extends WP_REST_Controller {
533 $post = get_post( $post_id );
534
535 if ( ! empty( $post_id ) && $post && ! $this->check_read_post_permission( $post, $request ) ) {
536- return new WP_Error( 'rest_cannot_read_post', __( 'Sorry, you are not allowed to read the post for this comment.' ), array( 'status' => rest_authorization_required_code() ) );
537+ return new WP_Error( 'rest_cannot_read_post', _l( 'Sorry, you are not allowed to read the post for this comment.' ), array( 'status' => rest_authorization_required_code() ) );
538 } elseif ( 0 === $post_id && ! current_user_can( 'moderate_comments' ) ) {
539- return new WP_Error( 'rest_cannot_read', __( 'Sorry, you are not allowed to read comments without a post.' ), array( 'status' => rest_authorization_required_code() ) );
540+ return new WP_Error( 'rest_cannot_read', _l( 'Sorry, you are not allowed to read comments without a post.' ), array( 'status' => rest_authorization_required_code() ) );
541 }
542 }
543 }
544
545 if ( ! empty( $request['context'] ) && 'edit' === $request['context'] && ! current_user_can( 'moderate_comments' ) ) {
546- return new WP_Error( 'rest_forbidden_context', __( 'Sorry, you are not allowed to edit comments.' ), array( 'status' => rest_authorization_required_code() ) );
547+ return new WP_Error( 'rest_forbidden_context', _l( 'Sorry, you are not allowed to edit comments.' ), array( 'status' => rest_authorization_required_code() ) );
548 }
549
550 if ( ! current_user_can( 'edit_posts' ) ) {
551@@ -153,7 +153,7 @@ class WP_REST_Comments_Controller extends WP_REST_Controller {
552 }
553
554 if ( ! empty( $forbidden_params ) ) {
555- return new WP_Error( 'rest_forbidden_param', sprintf( __( 'Query parameter not permitted: %s' ), implode( ', ', $forbidden_params ) ), array( 'status' => rest_authorization_required_code() ) );
556+ return new WP_Error( 'rest_forbidden_param', sprintf( _l( 'Query parameter not permitted: %s' ), implode( ', ', $forbidden_params ) ), array( 'status' => rest_authorization_required_code() ) );
557 }
558 }
559
560@@ -314,7 +314,7 @@ class WP_REST_Comments_Controller extends WP_REST_Controller {
561 * @return WP_Comment|WP_Error Comment object if ID is valid, WP_Error otherwise.
562 */
563 protected function get_comment( $id ) {
564- $error = new WP_Error( 'rest_comment_invalid_id', __( 'Invalid comment ID.' ), array( 'status' => 404 ) );
565+ $error = new WP_Error( 'rest_comment_invalid_id', _l( 'Invalid comment ID.' ), array( 'status' => 404 ) );
566 if ( (int) $id <= 0 ) {
567 return $error;
568 }
569@@ -328,7 +328,7 @@ class WP_REST_Comments_Controller extends WP_REST_Controller {
570 if ( ! empty( $comment->comment_post_ID ) ) {
571 $post = get_post( (int) $comment->comment_post_ID );
572 if ( empty( $post ) ) {
573- return new WP_Error( 'rest_post_invalid_id', __( 'Invalid post ID.' ), array( 'status' => 404 ) );
574+ return new WP_Error( 'rest_post_invalid_id', _l( 'Invalid post ID.' ), array( 'status' => 404 ) );
575 }
576 }
577
578@@ -351,17 +351,17 @@ class WP_REST_Comments_Controller extends WP_REST_Controller {
579 }
580
581 if ( ! empty( $request['context'] ) && 'edit' === $request['context'] && ! current_user_can( 'moderate_comments' ) ) {
582- return new WP_Error( 'rest_forbidden_context', __( 'Sorry, you are not allowed to edit comments.' ), array( 'status' => rest_authorization_required_code() ) );
583+ return new WP_Error( 'rest_forbidden_context', _l( 'Sorry, you are not allowed to edit comments.' ), array( 'status' => rest_authorization_required_code() ) );
584 }
585
586 $post = get_post( $comment->comment_post_ID );
587
588 if ( ! $this->check_read_permission( $comment, $request ) ) {
589- return new WP_Error( 'rest_cannot_read', __( 'Sorry, you are not allowed to read this comment.' ), array( 'status' => rest_authorization_required_code() ) );
590+ return new WP_Error( 'rest_cannot_read', _l( 'Sorry, you are not allowed to read this comment.' ), array( 'status' => rest_authorization_required_code() ) );
591 }
592
593 if ( $post && ! $this->check_read_post_permission( $post, $request ) ) {
594- return new WP_Error( 'rest_cannot_read_post', __( 'Sorry, you are not allowed to read the post for this comment.' ), array( 'status' => rest_authorization_required_code() ) );
595+ return new WP_Error( 'rest_cannot_read_post', _l( 'Sorry, you are not allowed to read the post for this comment.' ), array( 'status' => rest_authorization_required_code() ) );
596 }
597
598 return true;
599@@ -400,7 +400,7 @@ class WP_REST_Comments_Controller extends WP_REST_Controller {
600 public function create_item_permissions_check( $request ) {
601 if ( ! is_user_logged_in() ) {
602 if ( get_option( 'comment_registration' ) ) {
603- return new WP_Error( 'rest_comment_login_required', __( 'Sorry, you must be logged in to comment.' ), array( 'status' => 401 ) );
604+ return new WP_Error( 'rest_comment_login_required', _l( 'Sorry, you must be logged in to comment.' ), array( 'status' => 401 ) );
605 }
606
607 /**
608@@ -417,7 +417,7 @@ class WP_REST_Comments_Controller extends WP_REST_Controller {
609 */
610 $allow_anonymous = apply_filters( 'rest_allow_anonymous_comments', false, $request );
611 if ( ! $allow_anonymous ) {
612- return new WP_Error( 'rest_comment_login_required', __( 'Sorry, you must be logged in to comment.' ), array( 'status' => 401 ) );
613+ return new WP_Error( 'rest_comment_login_required', _l( 'Sorry, you must be logged in to comment.' ), array( 'status' => 401 ) );
614 }
615 }
616
617@@ -425,7 +425,7 @@ class WP_REST_Comments_Controller extends WP_REST_Controller {
618 if ( isset( $request['author'] ) && get_current_user_id() !== $request['author'] && ! current_user_can( 'moderate_comments' ) ) {
619 return new WP_Error( 'rest_comment_invalid_author',
620 /* translators: %s: request parameter */
621- sprintf( __( "Sorry, you are not allowed to edit '%s' for comments." ), 'author' ),
622+ sprintf( _l( "Sorry, you are not allowed to edit '%s' for comments." ), 'author' ),
623 array( 'status' => rest_authorization_required_code() )
624 );
625 }
626@@ -434,7 +434,7 @@ class WP_REST_Comments_Controller extends WP_REST_Controller {
627 if ( empty( $_SERVER['REMOTE_ADDR'] ) || $request['author_ip'] !== $_SERVER['REMOTE_ADDR'] ) {
628 return new WP_Error( 'rest_comment_invalid_author_ip',
629 /* translators: %s: request parameter */
630- sprintf( __( "Sorry, you are not allowed to edit '%s' for comments." ), 'author_ip' ),
631+ sprintf( _l( "Sorry, you are not allowed to edit '%s' for comments." ), 'author_ip' ),
632 array( 'status' => rest_authorization_required_code() )
633 );
634 }
635@@ -443,34 +443,34 @@ class WP_REST_Comments_Controller extends WP_REST_Controller {
636 if ( isset( $request['status'] ) && ! current_user_can( 'moderate_comments' ) ) {
637 return new WP_Error( 'rest_comment_invalid_status',
638 /* translators: %s: request parameter */
639- sprintf( __( "Sorry, you are not allowed to edit '%s' for comments." ), 'status' ),
640+ sprintf( _l( "Sorry, you are not allowed to edit '%s' for comments." ), 'status' ),
641 array( 'status' => rest_authorization_required_code() )
642 );
643 }
644
645 if ( empty( $request['post'] ) ) {
646- return new WP_Error( 'rest_comment_invalid_post_id', __( 'Sorry, you are not allowed to create this comment without a post.' ), array( 'status' => 403 ) );
647+ return new WP_Error( 'rest_comment_invalid_post_id', _l( 'Sorry, you are not allowed to create this comment without a post.' ), array( 'status' => 403 ) );
648 }
649
650 $post = get_post( (int) $request['post'] );
651 if ( ! $post ) {
652- return new WP_Error( 'rest_comment_invalid_post_id', __( 'Sorry, you are not allowed to create this comment without a post.' ), array( 'status' => 403 ) );
653+ return new WP_Error( 'rest_comment_invalid_post_id', _l( 'Sorry, you are not allowed to create this comment without a post.' ), array( 'status' => 403 ) );
654 }
655
656 if ( 'draft' === $post->post_status ) {
657- return new WP_Error( 'rest_comment_draft_post', __( 'Sorry, you are not allowed to create a comment on this post.' ), array( 'status' => 403 ) );
658+ return new WP_Error( 'rest_comment_draft_post', _l( 'Sorry, you are not allowed to create a comment on this post.' ), array( 'status' => 403 ) );
659 }
660
661 if ( 'trash' === $post->post_status ) {
662- return new WP_Error( 'rest_comment_trash_post', __( 'Sorry, you are not allowed to create a comment on this post.' ), array( 'status' => 403 ) );
663+ return new WP_Error( 'rest_comment_trash_post', _l( 'Sorry, you are not allowed to create a comment on this post.' ), array( 'status' => 403 ) );
664 }
665
666 if ( ! $this->check_read_post_permission( $post, $request ) ) {
667- return new WP_Error( 'rest_cannot_read_post', __( 'Sorry, you are not allowed to read the post for this comment.' ), array( 'status' => rest_authorization_required_code() ) );
668+ return new WP_Error( 'rest_cannot_read_post', _l( 'Sorry, you are not allowed to read the post for this comment.' ), array( 'status' => rest_authorization_required_code() ) );
669 }
670
671 if ( ! comments_open( $post->ID ) ) {
672- return new WP_Error( 'rest_comment_closed', __( 'Sorry, comments are closed for this item.' ), array( 'status' => 403 ) );
673+ return new WP_Error( 'rest_comment_closed', _l( 'Sorry, comments are closed for this item.' ), array( 'status' => 403 ) );
674 }
675
676 return true;
677@@ -487,12 +487,12 @@ class WP_REST_Comments_Controller extends WP_REST_Controller {
678 */
679 public function create_item( $request ) {
680 if ( ! empty( $request['id'] ) ) {
681- return new WP_Error( 'rest_comment_exists', __( 'Cannot create existing comment.' ), array( 'status' => 400 ) );
682+ return new WP_Error( 'rest_comment_exists', _l( 'Cannot create existing comment.' ), array( 'status' => 400 ) );
683 }
684
685 // Do not allow comments to be created with a non-default type.
686 if ( ! empty( $request['type'] ) && 'comment' !== $request['type'] ) {
687- return new WP_Error( 'rest_invalid_comment_type', __( 'Cannot create a comment with that type.' ), array( 'status' => 400 ) );
688+ return new WP_Error( 'rest_invalid_comment_type', _l( 'Cannot create a comment with that type.' ), array( 'status' => 400 ) );
689 }
690
691 $prepared_comment = $this->prepare_item_for_database( $request );
692@@ -507,7 +507,7 @@ class WP_REST_Comments_Controller extends WP_REST_Controller {
693 * comment_content. See wp_handle_comment_submission().
694 */
695 if ( empty( $prepared_comment['comment_content'] ) ) {
696- return new WP_Error( 'rest_comment_content_invalid', __( 'Invalid comment content.' ), array( 'status' => 400 ) );
697+ return new WP_Error( 'rest_comment_content_invalid', _l( 'Invalid comment content.' ), array( 'status' => 400 ) );
698 }
699
700 // Setting remaining values before wp_insert_comment so we can use wp_allow_comment().
701@@ -533,7 +533,7 @@ class WP_REST_Comments_Controller extends WP_REST_Controller {
702 // Honor the discussion setting that requires a name and email address of the comment author.
703 if ( get_option( 'require_name_email' ) ) {
704 if ( empty( $prepared_comment['comment_author'] ) || empty( $prepared_comment['comment_author_email'] ) ) {
705- return new WP_Error( 'rest_comment_author_data_required', __( 'Creating a comment requires valid author name and email values.' ), array( 'status' => 400 ) );
706+ return new WP_Error( 'rest_comment_author_data_required', _l( 'Creating a comment requires valid author name and email values.' ), array( 'status' => 400 ) );
707 }
708 }
709
710@@ -552,7 +552,7 @@ class WP_REST_Comments_Controller extends WP_REST_Controller {
711 $check_comment_lengths = wp_check_comment_data_max_lengths( $prepared_comment );
712 if ( is_wp_error( $check_comment_lengths ) ) {
713 $error_code = $check_comment_lengths->get_error_code();
714- return new WP_Error( $error_code, __( 'Comment field exceeds maximum length allowed.' ), array( 'status' => 400 ) );
715+ return new WP_Error( $error_code, _l( 'Comment field exceeds maximum length allowed.' ), array( 'status' => 400 ) );
716 }
717
718 $prepared_comment['comment_approved'] = wp_allow_comment( $prepared_comment, true );
719@@ -593,7 +593,7 @@ class WP_REST_Comments_Controller extends WP_REST_Controller {
720 $comment_id = wp_insert_comment( wp_filter_comment( wp_slash( (array) $prepared_comment ) ) );
721
722 if ( ! $comment_id ) {
723- return new WP_Error( 'rest_comment_failed_create', __( 'Creating comment failed.' ), array( 'status' => 500 ) );
724+ return new WP_Error( 'rest_comment_failed_create', _l( 'Creating comment failed.' ), array( 'status' => 500 ) );
725 }
726
727 if ( isset( $request['status'] ) ) {
728@@ -660,7 +660,7 @@ class WP_REST_Comments_Controller extends WP_REST_Controller {
729 }
730
731 if ( ! $this->check_edit_permission( $comment ) ) {
732- return new WP_Error( 'rest_cannot_edit', __( 'Sorry, you are not allowed to edit this comment.' ), array( 'status' => rest_authorization_required_code() ) );
733+ return new WP_Error( 'rest_cannot_edit', _l( 'Sorry, you are not allowed to edit this comment.' ), array( 'status' => rest_authorization_required_code() ) );
734 }
735
736 return true;
737@@ -684,7 +684,7 @@ class WP_REST_Comments_Controller extends WP_REST_Controller {
738 $id = $comment->comment_ID;
739
740 if ( isset( $request['type'] ) && get_comment_type( $id ) !== $request['type'] ) {
741- return new WP_Error( 'rest_comment_invalid_type', __( 'Sorry, you are not allowed to change the comment type.' ), array( 'status' => 404 ) );
742+ return new WP_Error( 'rest_comment_invalid_type', _l( 'Sorry, you are not allowed to change the comment type.' ), array( 'status' => 404 ) );
743 }
744
745 $prepared_args = $this->prepare_item_for_database( $request );
746@@ -696,7 +696,7 @@ class WP_REST_Comments_Controller extends WP_REST_Controller {
747 if ( ! empty( $prepared_args['comment_post_ID'] ) ) {
748 $post = get_post( $prepared_args['comment_post_ID'] );
749 if ( empty( $post ) ) {
750- return new WP_Error( 'rest_comment_invalid_post_id', __( 'Invalid post ID.' ), array( 'status' => 403 ) );
751+ return new WP_Error( 'rest_comment_invalid_post_id', _l( 'Invalid post ID.' ), array( 'status' => 403 ) );
752 }
753 }
754
755@@ -705,7 +705,7 @@ class WP_REST_Comments_Controller extends WP_REST_Controller {
756 $change = $this->handle_status_param( $request['status'], $id );
757
758 if ( ! $change ) {
759- return new WP_Error( 'rest_comment_failed_edit', __( 'Updating comment status failed.' ), array( 'status' => 500 ) );
760+ return new WP_Error( 'rest_comment_failed_edit', _l( 'Updating comment status failed.' ), array( 'status' => 500 ) );
761 }
762 } elseif ( ! empty( $prepared_args ) ) {
763 if ( is_wp_error( $prepared_args ) ) {
764@@ -713,7 +713,7 @@ class WP_REST_Comments_Controller extends WP_REST_Controller {
765 }
766
767 if ( isset( $prepared_args['comment_content'] ) && empty( $prepared_args['comment_content'] ) ) {
768- return new WP_Error( 'rest_comment_content_invalid', __( 'Invalid comment content.' ), array( 'status' => 400 ) );
769+ return new WP_Error( 'rest_comment_content_invalid', _l( 'Invalid comment content.' ), array( 'status' => 400 ) );
770 }
771
772 $prepared_args['comment_ID'] = $id;
773@@ -721,13 +721,13 @@ class WP_REST_Comments_Controller extends WP_REST_Controller {
774 $check_comment_lengths = wp_check_comment_data_max_lengths( $prepared_args );
775 if ( is_wp_error( $check_comment_lengths ) ) {
776 $error_code = $check_comment_lengths->get_error_code();
777- return new WP_Error( $error_code, __( 'Comment field exceeds maximum length allowed.' ), array( 'status' => 400 ) );
778+ return new WP_Error( $error_code, _l( 'Comment field exceeds maximum length allowed.' ), array( 'status' => 400 ) );
779 }
780
781 $updated = wp_update_comment( wp_slash( (array) $prepared_args ) );
782
783 if ( false === $updated ) {
784- return new WP_Error( 'rest_comment_failed_edit', __( 'Updating comment failed.' ), array( 'status' => 500 ) );
785+ return new WP_Error( 'rest_comment_failed_edit', _l( 'Updating comment failed.' ), array( 'status' => 500 ) );
786 }
787
788 if ( isset( $request['status'] ) ) {
789@@ -779,7 +779,7 @@ class WP_REST_Comments_Controller extends WP_REST_Controller {
790 }
791
792 if ( ! $this->check_edit_permission( $comment ) ) {
793- return new WP_Error( 'rest_cannot_delete', __( 'Sorry, you are not allowed to delete this comment.' ), array( 'status' => rest_authorization_required_code() ) );
794+ return new WP_Error( 'rest_cannot_delete', _l( 'Sorry, you are not allowed to delete this comment.' ), array( 'status' => rest_authorization_required_code() ) );
795 }
796 return true;
797 }
798@@ -823,11 +823,11 @@ class WP_REST_Comments_Controller extends WP_REST_Controller {
799 } else {
800 // If this type doesn't support trashing, error out.
801 if ( ! $supports_trash ) {
802- return new WP_Error( 'rest_trash_not_supported', __( 'The comment does not support trashing. Set force=true to delete.' ), array( 'status' => 501 ) );
803+ return new WP_Error( 'rest_trash_not_supported', _l( 'The comment does not support trashing. Set force=true to delete.' ), array( 'status' => 501 ) );
804 }
805
806 if ( 'trash' === $comment->comment_approved ) {
807- return new WP_Error( 'rest_already_trashed', __( 'The comment has already been trashed.' ), array( 'status' => 410 ) );
808+ return new WP_Error( 'rest_already_trashed', _l( 'The comment has already been trashed.' ), array( 'status' => 410 ) );
809 }
810
811 $result = wp_trash_comment( $comment->comment_ID );
812@@ -836,7 +836,7 @@ class WP_REST_Comments_Controller extends WP_REST_Controller {
813 }
814
815 if ( ! $result ) {
816- return new WP_Error( 'rest_cannot_delete', __( 'The comment cannot be deleted.' ), array( 'status' => 500 ) );
817+ return new WP_Error( 'rest_cannot_delete', _l( 'The comment cannot be deleted.' ), array( 'status' => 500 ) );
818 }
819
820 /**
821@@ -1092,7 +1092,7 @@ class WP_REST_Comments_Controller extends WP_REST_Controller {
822 $prepared_comment['comment_author_email'] = $user->user_email;
823 $prepared_comment['comment_author_url'] = $user->user_url;
824 } else {
825- return new WP_Error( 'rest_comment_author_invalid', __( 'Invalid comment author ID.' ), array( 'status' => 400 ) );
826+ return new WP_Error( 'rest_comment_author_invalid', _l( 'Invalid comment author ID.' ), array( 'status' => 400 ) );
827 }
828 }
829
830@@ -1164,18 +1164,18 @@ class WP_REST_Comments_Controller extends WP_REST_Controller {
831 'type' => 'object',
832 'properties' => array(
833 'id' => array(
834- 'description' => __( 'Unique identifier for the object.' ),
835+ 'description' => _l( 'Unique identifier for the object.' ),
836 'type' => 'integer',
837 'context' => array( 'view', 'edit', 'embed' ),
838 'readonly' => true,
839 ),
840 'author' => array(
841- 'description' => __( 'The ID of the user object, if author was a user.' ),
842+ 'description' => _l( 'The ID of the user object, if author was a user.' ),
843 'type' => 'integer',
844 'context' => array( 'view', 'edit', 'embed' ),
845 ),
846 'author_email' => array(
847- 'description' => __( 'Email address for the object author.' ),
848+ 'description' => _l( 'Email address for the object author.' ),
849 'type' => 'string',
850 'format' => 'email',
851 'context' => array( 'edit' ),
852@@ -1185,13 +1185,13 @@ class WP_REST_Comments_Controller extends WP_REST_Controller {
853 ),
854 ),
855 'author_ip' => array(
856- 'description' => __( 'IP address for the object author.' ),
857+ 'description' => _l( 'IP address for the object author.' ),
858 'type' => 'string',
859 'format' => 'ip',
860 'context' => array( 'edit' ),
861 ),
862 'author_name' => array(
863- 'description' => __( 'Display name for the object author.' ),
864+ 'description' => _l( 'Display name for the object author.' ),
865 'type' => 'string',
866 'context' => array( 'view', 'edit', 'embed' ),
867 'arg_options' => array(
868@@ -1199,13 +1199,13 @@ class WP_REST_Comments_Controller extends WP_REST_Controller {
869 ),
870 ),
871 'author_url' => array(
872- 'description' => __( 'URL for the object author.' ),
873+ 'description' => _l( 'URL for the object author.' ),
874 'type' => 'string',
875 'format' => 'uri',
876 'context' => array( 'view', 'edit', 'embed' ),
877 ),
878 'author_user_agent' => array(
879- 'description' => __( 'User agent for the object author.' ),
880+ 'description' => _l( 'User agent for the object author.' ),
881 'type' => 'string',
882 'context' => array( 'edit' ),
883 'arg_options' => array(
884@@ -1213,7 +1213,7 @@ class WP_REST_Comments_Controller extends WP_REST_Controller {
885 ),
886 ),
887 'content' => array(
888- 'description' => __( 'The content for the object.' ),
889+ 'description' => _l( 'The content for the object.' ),
890 'type' => 'object',
891 'context' => array( 'view', 'edit', 'embed' ),
892 'arg_options' => array(
893@@ -1221,12 +1221,12 @@ class WP_REST_Comments_Controller extends WP_REST_Controller {
894 ),
895 'properties' => array(
896 'raw' => array(
897- 'description' => __( 'Content for the object, as it exists in the database.' ),
898+ 'description' => _l( 'Content for the object, as it exists in the database.' ),
899 'type' => 'string',
900 'context' => array( 'edit' ),
901 ),
902 'rendered' => array(
903- 'description' => __( 'HTML content for the object, transformed for display.' ),
904+ 'description' => _l( 'HTML content for the object, transformed for display.' ),
905 'type' => 'string',
906 'context' => array( 'view', 'edit', 'embed' ),
907 'readonly' => true,
908@@ -1234,38 +1234,38 @@ class WP_REST_Comments_Controller extends WP_REST_Controller {
909 ),
910 ),
911 'date' => array(
912- 'description' => __( "The date the object was published, in the site's timezone." ),
913+ 'description' => _l( "The date the object was published, in the site's timezone." ),
914 'type' => 'string',
915 'format' => 'date-time',
916 'context' => array( 'view', 'edit', 'embed' ),
917 ),
918 'date_gmt' => array(
919- 'description' => __( 'The date the object was published, as GMT.' ),
920+ 'description' => _l( 'The date the object was published, as GMT.' ),
921 'type' => 'string',
922 'format' => 'date-time',
923 'context' => array( 'view', 'edit' ),
924 ),
925 'link' => array(
926- 'description' => __( 'URL to the object.' ),
927+ 'description' => _l( 'URL to the object.' ),
928 'type' => 'string',
929 'format' => 'uri',
930 'context' => array( 'view', 'edit', 'embed' ),
931 'readonly' => true,
932 ),
933 'parent' => array(
934- 'description' => __( 'The ID for the parent of the object.' ),
935+ 'description' => _l( 'The ID for the parent of the object.' ),
936 'type' => 'integer',
937 'context' => array( 'view', 'edit', 'embed' ),
938 'default' => 0,
939 ),
940 'post' => array(
941- 'description' => __( 'The ID of the associated post object.' ),
942+ 'description' => _l( 'The ID of the associated post object.' ),
943 'type' => 'integer',
944 'context' => array( 'view', 'edit' ),
945 'default' => 0,
946 ),
947 'status' => array(
948- 'description' => __( 'State of the object.' ),
949+ 'description' => _l( 'State of the object.' ),
950 'type' => 'string',
951 'context' => array( 'view', 'edit' ),
952 'arg_options' => array(
953@@ -1273,7 +1273,7 @@ class WP_REST_Comments_Controller extends WP_REST_Controller {
954 ),
955 ),
956 'type' => array(
957- 'description' => __( 'Type of Comment for the object.' ),
958+ 'description' => _l( 'Type of Comment for the object.' ),
959 'type' => 'string',
960 'context' => array( 'view', 'edit', 'embed' ),
961 'readonly' => true,
962@@ -1288,7 +1288,7 @@ class WP_REST_Comments_Controller extends WP_REST_Controller {
963 foreach ( $avatar_sizes as $size ) {
964 $avatar_properties[ $size ] = array(
965 /* translators: %d: avatar image size in pixels */
966- 'description' => sprintf( __( 'Avatar URL with image size of %d pixels.' ), $size ),
967+ 'description' => sprintf( _l( 'Avatar URL with image size of %d pixels.' ), $size ),
968 'type' => 'string',
969 'format' => 'uri',
970 'context' => array( 'embed', 'view', 'edit' ),
971@@ -1296,7 +1296,7 @@ class WP_REST_Comments_Controller extends WP_REST_Controller {
972 }
973
974 $schema['properties']['author_avatar_urls'] = array(
975- 'description' => __( 'Avatar URLs for the object author.' ),
976+ 'description' => _l( 'Avatar URLs for the object author.' ),
977 'type' => 'object',
978 'context' => array( 'view', 'edit', 'embed' ),
979 'readonly' => true,
980@@ -1323,13 +1323,13 @@ class WP_REST_Comments_Controller extends WP_REST_Controller {
981 $query_params['context']['default'] = 'view';
982
983 $query_params['after'] = array(
984- 'description' => __( 'Limit response to comments published after a given ISO8601 compliant date.' ),
985+ 'description' => _l( 'Limit response to comments published after a given ISO8601 compliant date.' ),
986 'type' => 'string',
987 'format' => 'date-time',
988 );
989
990 $query_params['author'] = array(
991- 'description' => __( 'Limit result set to comments assigned to specific user IDs. Requires authorization.' ),
992+ 'description' => _l( 'Limit result set to comments assigned to specific user IDs. Requires authorization.' ),
993 'type' => 'array',
994 'items' => array(
995 'type' => 'integer',
996@@ -1337,7 +1337,7 @@ class WP_REST_Comments_Controller extends WP_REST_Controller {
997 );
998
999 $query_params['author_exclude'] = array(
1000- 'description' => __( 'Ensure result set excludes comments assigned to specific user IDs. Requires authorization.' ),
1001+ 'description' => _l( 'Ensure result set excludes comments assigned to specific user IDs. Requires authorization.' ),
1002 'type' => 'array',
1003 'items' => array(
1004 'type' => 'integer',
1005@@ -1346,19 +1346,19 @@ class WP_REST_Comments_Controller extends WP_REST_Controller {
1006
1007 $query_params['author_email'] = array(
1008 'default' => null,
1009- 'description' => __( 'Limit result set to that from a specific author email. Requires authorization.' ),
1010+ 'description' => _l( 'Limit result set to that from a specific author email. Requires authorization.' ),
1011 'format' => 'email',
1012 'type' => 'string',
1013 );
1014
1015 $query_params['before'] = array(
1016- 'description' => __( 'Limit response to comments published before a given ISO8601 compliant date.' ),
1017+ 'description' => _l( 'Limit response to comments published before a given ISO8601 compliant date.' ),
1018 'type' => 'string',
1019 'format' => 'date-time',
1020 );
1021
1022 $query_params['exclude'] = array(
1023- 'description' => __( 'Ensure result set excludes specific IDs.' ),
1024+ 'description' => _l( 'Ensure result set excludes specific IDs.' ),
1025 'type' => 'array',
1026 'items' => array(
1027 'type' => 'integer',
1028@@ -1367,7 +1367,7 @@ class WP_REST_Comments_Controller extends WP_REST_Controller {
1029 );
1030
1031 $query_params['include'] = array(
1032- 'description' => __( 'Limit result set to specific IDs.' ),
1033+ 'description' => _l( 'Limit result set to specific IDs.' ),
1034 'type' => 'array',
1035 'items' => array(
1036 'type' => 'integer',
1037@@ -1376,12 +1376,12 @@ class WP_REST_Comments_Controller extends WP_REST_Controller {
1038 );
1039
1040 $query_params['offset'] = array(
1041- 'description' => __( 'Offset the result set by a specific number of items.' ),
1042+ 'description' => _l( 'Offset the result set by a specific number of items.' ),
1043 'type' => 'integer',
1044 );
1045
1046 $query_params['order'] = array(
1047- 'description' => __( 'Order sort attribute ascending or descending.' ),
1048+ 'description' => _l( 'Order sort attribute ascending or descending.' ),
1049 'type' => 'string',
1050 'default' => 'desc',
1051 'enum' => array(
1052@@ -1391,7 +1391,7 @@ class WP_REST_Comments_Controller extends WP_REST_Controller {
1053 );
1054
1055 $query_params['orderby'] = array(
1056- 'description' => __( 'Sort collection by object attribute.' ),
1057+ 'description' => _l( 'Sort collection by object attribute.' ),
1058 'type' => 'string',
1059 'default' => 'date_gmt',
1060 'enum' => array(
1061@@ -1407,7 +1407,7 @@ class WP_REST_Comments_Controller extends WP_REST_Controller {
1062
1063 $query_params['parent'] = array(
1064 'default' => array(),
1065- 'description' => __( 'Limit result set to comments of specific parent IDs.' ),
1066+ 'description' => _l( 'Limit result set to comments of specific parent IDs.' ),
1067 'type' => 'array',
1068 'items' => array(
1069 'type' => 'integer',
1070@@ -1416,7 +1416,7 @@ class WP_REST_Comments_Controller extends WP_REST_Controller {
1071
1072 $query_params['parent_exclude'] = array(
1073 'default' => array(),
1074- 'description' => __( 'Ensure result set excludes specific parent IDs.' ),
1075+ 'description' => _l( 'Ensure result set excludes specific parent IDs.' ),
1076 'type' => 'array',
1077 'items' => array(
1078 'type' => 'integer',
1079@@ -1425,7 +1425,7 @@ class WP_REST_Comments_Controller extends WP_REST_Controller {
1080
1081 $query_params['post'] = array(
1082 'default' => array(),
1083- 'description' => __( 'Limit result set to comments assigned to specific post IDs.' ),
1084+ 'description' => _l( 'Limit result set to comments assigned to specific post IDs.' ),
1085 'type' => 'array',
1086 'items' => array(
1087 'type' => 'integer',
1088@@ -1434,7 +1434,7 @@ class WP_REST_Comments_Controller extends WP_REST_Controller {
1089
1090 $query_params['status'] = array(
1091 'default' => 'approve',
1092- 'description' => __( 'Limit result set to comments assigned a specific status. Requires authorization.' ),
1093+ 'description' => _l( 'Limit result set to comments assigned a specific status. Requires authorization.' ),
1094 'sanitize_callback' => 'sanitize_key',
1095 'type' => 'string',
1096 'validate_callback' => 'rest_validate_request_arg',
1097@@ -1442,14 +1442,14 @@ class WP_REST_Comments_Controller extends WP_REST_Controller {
1098
1099 $query_params['type'] = array(
1100 'default' => 'comment',
1101- 'description' => __( 'Limit result set to comments assigned a specific type. Requires authorization.' ),
1102+ 'description' => _l( 'Limit result set to comments assigned a specific type. Requires authorization.' ),
1103 'sanitize_callback' => 'sanitize_key',
1104 'type' => 'string',
1105 'validate_callback' => 'rest_validate_request_arg',
1106 );
1107
1108 $query_params['password'] = array(
1109- 'description' => __( 'The password for the post if it is password protected.' ),
1110+ 'description' => _l( 'The password for the post if it is password protected.' ),
1111 'type' => 'string',
1112 );
1113
1114diff --git src/wp-includes/rest-api/endpoints/class-wp-rest-controller.php src/wp-includes/rest-api/endpoints/class-wp-rest-controller.php
1115index b6c8ac42ac..8c2afbe1a4 100644
1116--- src/wp-includes/rest-api/endpoints/class-wp-rest-controller.php
1117+++ src/wp-includes/rest-api/endpoints/class-wp-rest-controller.php
1118@@ -39,7 +39,7 @@ abstract class WP_REST_Controller {
1119 * @access public
1120 */
1121 public function register_routes() {
1122- _doing_it_wrong( 'WP_REST_Controller::register_routes', __( 'The register_routes() method must be overridden' ), '4.7' );
1123+ _doing_it_wrong( 'WP_REST_Controller::register_routes', _l( 'The register_routes() method must be overridden' ), '4.7' );
1124 }
1125
1126 /**
1127@@ -52,7 +52,7 @@ abstract class WP_REST_Controller {
1128 * @return WP_Error|bool True if the request has read access, WP_Error object otherwise.
1129 */
1130 public function get_items_permissions_check( $request ) {
1131- return new WP_Error( 'invalid-method', sprintf( __( "Method '%s' not implemented. Must be overridden in subclass." ), __METHOD__ ), array( 'status' => 405 ) );
1132+ return new WP_Error( 'invalid-method', sprintf( _l( "Method '%s' not implemented. Must be overridden in subclass." ), __METHOD__ ), array( 'status' => 405 ) );
1133 }
1134
1135 /**
1136@@ -65,7 +65,7 @@ abstract class WP_REST_Controller {
1137 * @return WP_Error|WP_REST_Response Response object on success, or WP_Error object on failure.
1138 */
1139 public function get_items( $request ) {
1140- return new WP_Error( 'invalid-method', sprintf( __( "Method '%s' not implemented. Must be overridden in subclass." ), __METHOD__ ), array( 'status' => 405 ) );
1141+ return new WP_Error( 'invalid-method', sprintf( _l( "Method '%s' not implemented. Must be overridden in subclass." ), __METHOD__ ), array( 'status' => 405 ) );
1142 }
1143
1144 /**
1145@@ -78,7 +78,7 @@ abstract class WP_REST_Controller {
1146 * @return WP_Error|bool True if the request has read access for the item, WP_Error object otherwise.
1147 */
1148 public function get_item_permissions_check( $request ) {
1149- return new WP_Error( 'invalid-method', sprintf( __( "Method '%s' not implemented. Must be overridden in subclass." ), __METHOD__ ), array( 'status' => 405 ) );
1150+ return new WP_Error( 'invalid-method', sprintf( _l( "Method '%s' not implemented. Must be overridden in subclass." ), __METHOD__ ), array( 'status' => 405 ) );
1151 }
1152
1153 /**
1154@@ -91,7 +91,7 @@ abstract class WP_REST_Controller {
1155 * @return WP_Error|WP_REST_Response Response object on success, or WP_Error object on failure.
1156 */
1157 public function get_item( $request ) {
1158- return new WP_Error( 'invalid-method', sprintf( __( "Method '%s' not implemented. Must be overridden in subclass." ), __METHOD__ ), array( 'status' => 405 ) );
1159+ return new WP_Error( 'invalid-method', sprintf( _l( "Method '%s' not implemented. Must be overridden in subclass." ), __METHOD__ ), array( 'status' => 405 ) );
1160 }
1161
1162 /**
1163@@ -104,7 +104,7 @@ abstract class WP_REST_Controller {
1164 * @return WP_Error|bool True if the request has access to create items, WP_Error object otherwise.
1165 */
1166 public function create_item_permissions_check( $request ) {
1167- return new WP_Error( 'invalid-method', sprintf( __( "Method '%s' not implemented. Must be overridden in subclass." ), __METHOD__ ), array( 'status' => 405 ) );
1168+ return new WP_Error( 'invalid-method', sprintf( _l( "Method '%s' not implemented. Must be overridden in subclass." ), __METHOD__ ), array( 'status' => 405 ) );
1169 }
1170
1171 /**
1172@@ -117,7 +117,7 @@ abstract class WP_REST_Controller {
1173 * @return WP_Error|WP_REST_Response Response object on success, or WP_Error object on failure.
1174 */
1175 public function create_item( $request ) {
1176- return new WP_Error( 'invalid-method', sprintf( __( "Method '%s' not implemented. Must be overridden in subclass." ), __METHOD__ ), array( 'status' => 405 ) );
1177+ return new WP_Error( 'invalid-method', sprintf( _l( "Method '%s' not implemented. Must be overridden in subclass." ), __METHOD__ ), array( 'status' => 405 ) );
1178 }
1179
1180 /**
1181@@ -130,7 +130,7 @@ abstract class WP_REST_Controller {
1182 * @return WP_Error|bool True if the request has access to update the item, WP_Error object otherwise.
1183 */
1184 public function update_item_permissions_check( $request ) {
1185- return new WP_Error( 'invalid-method', sprintf( __( "Method '%s' not implemented. Must be overridden in subclass." ), __METHOD__ ), array( 'status' => 405 ) );
1186+ return new WP_Error( 'invalid-method', sprintf( _l( "Method '%s' not implemented. Must be overridden in subclass." ), __METHOD__ ), array( 'status' => 405 ) );
1187 }
1188
1189 /**
1190@@ -143,7 +143,7 @@ abstract class WP_REST_Controller {
1191 * @return WP_Error|WP_REST_Response Response object on success, or WP_Error object on failure.
1192 */
1193 public function update_item( $request ) {
1194- return new WP_Error( 'invalid-method', sprintf( __( "Method '%s' not implemented. Must be overridden in subclass." ), __METHOD__ ), array( 'status' => 405 ) );
1195+ return new WP_Error( 'invalid-method', sprintf( _l( "Method '%s' not implemented. Must be overridden in subclass." ), __METHOD__ ), array( 'status' => 405 ) );
1196 }
1197
1198 /**
1199@@ -156,7 +156,7 @@ abstract class WP_REST_Controller {
1200 * @return WP_Error|bool True if the request has access to delete the item, WP_Error object otherwise.
1201 */
1202 public function delete_item_permissions_check( $request ) {
1203- return new WP_Error( 'invalid-method', sprintf( __( "Method '%s' not implemented. Must be overridden in subclass." ), __METHOD__ ), array( 'status' => 405 ) );
1204+ return new WP_Error( 'invalid-method', sprintf( _l( "Method '%s' not implemented. Must be overridden in subclass." ), __METHOD__ ), array( 'status' => 405 ) );
1205 }
1206
1207 /**
1208@@ -169,7 +169,7 @@ abstract class WP_REST_Controller {
1209 * @return WP_Error|WP_REST_Response Response object on success, or WP_Error object on failure.
1210 */
1211 public function delete_item( $request ) {
1212- return new WP_Error( 'invalid-method', sprintf( __( "Method '%s' not implemented. Must be overridden in subclass." ), __METHOD__ ), array( 'status' => 405 ) );
1213+ return new WP_Error( 'invalid-method', sprintf( _l( "Method '%s' not implemented. Must be overridden in subclass." ), __METHOD__ ), array( 'status' => 405 ) );
1214 }
1215
1216 /**
1217@@ -182,7 +182,7 @@ abstract class WP_REST_Controller {
1218 * @return WP_Error|object The prepared item, or WP_Error object on failure.
1219 */
1220 protected function prepare_item_for_database( $request ) {
1221- return new WP_Error( 'invalid-method', sprintf( __( "Method '%s' not implemented. Must be overridden in subclass." ), __METHOD__ ), array( 'status' => 405 ) );
1222+ return new WP_Error( 'invalid-method', sprintf( _l( "Method '%s' not implemented. Must be overridden in subclass." ), __METHOD__ ), array( 'status' => 405 ) );
1223 }
1224
1225 /**
1226@@ -196,7 +196,7 @@ abstract class WP_REST_Controller {
1227 * @return WP_Error|WP_REST_Response Response object on success, or WP_Error object on failure.
1228 */
1229 public function prepare_item_for_response( $item, $request ) {
1230- return new WP_Error( 'invalid-method', sprintf( __( "Method '%s' not implemented. Must be overridden in subclass." ), __METHOD__ ), array( 'status' => 405 ) );
1231+ return new WP_Error( 'invalid-method', sprintf( _l( "Method '%s' not implemented. Must be overridden in subclass." ), __METHOD__ ), array( 'status' => 405 ) );
1232 }
1233
1234 /**
1235@@ -314,7 +314,7 @@ abstract class WP_REST_Controller {
1236 return array(
1237 'context' => $this->get_context_param(),
1238 'page' => array(
1239- 'description' => __( 'Current page of the collection.' ),
1240+ 'description' => _l( 'Current page of the collection.' ),
1241 'type' => 'integer',
1242 'default' => 1,
1243 'sanitize_callback' => 'absint',
1244@@ -322,7 +322,7 @@ abstract class WP_REST_Controller {
1245 'minimum' => 1,
1246 ),
1247 'per_page' => array(
1248- 'description' => __( 'Maximum number of items to be returned in result set.' ),
1249+ 'description' => _l( 'Maximum number of items to be returned in result set.' ),
1250 'type' => 'integer',
1251 'default' => 10,
1252 'minimum' => 1,
1253@@ -331,7 +331,7 @@ abstract class WP_REST_Controller {
1254 'validate_callback' => 'rest_validate_request_arg',
1255 ),
1256 'search' => array(
1257- 'description' => __( 'Limit results to those matching a string.' ),
1258+ 'description' => _l( 'Limit results to those matching a string.' ),
1259 'type' => 'string',
1260 'sanitize_callback' => 'sanitize_text_field',
1261 'validate_callback' => 'rest_validate_request_arg',
1262@@ -352,7 +352,7 @@ abstract class WP_REST_Controller {
1263 */
1264 public function get_context_param( $args = array() ) {
1265 $param_details = array(
1266- 'description' => __( 'Scope under which the request is made; determines fields present in response.' ),
1267+ 'description' => _l( 'Scope under which the request is made; determines fields present in response.' ),
1268 'type' => 'string',
1269 'sanitize_callback' => 'sanitize_key',
1270 'validate_callback' => 'rest_validate_request_arg',
1271diff --git src/wp-includes/rest-api/endpoints/class-wp-rest-post-statuses-controller.php src/wp-includes/rest-api/endpoints/class-wp-rest-post-statuses-controller.php
1272index 59575d566c..89c5013bff 100644
1273--- src/wp-includes/rest-api/endpoints/class-wp-rest-post-statuses-controller.php
1274+++ src/wp-includes/rest-api/endpoints/class-wp-rest-post-statuses-controller.php
1275@@ -50,7 +50,7 @@ class WP_REST_Post_Statuses_Controller extends WP_REST_Controller {
1276 register_rest_route( $this->namespace, '/' . $this->rest_base . '/(?P<status>[\w-]+)', array(
1277 'args' => array(
1278 'status' => array(
1279- 'description' => __( 'An alphanumeric identifier for the status.' ),
1280+ 'description' => _l( 'An alphanumeric identifier for the status.' ),
1281 'type' => 'string',
1282 ),
1283 ),
1284@@ -84,7 +84,7 @@ class WP_REST_Post_Statuses_Controller extends WP_REST_Controller {
1285 return true;
1286 }
1287 }
1288- return new WP_Error( 'rest_cannot_view', __( 'Sorry, you are not allowed to edit posts in this post type.' ), array( 'status' => rest_authorization_required_code() ) );
1289+ return new WP_Error( 'rest_cannot_view', _l( 'Sorry, you are not allowed to edit posts in this post type.' ), array( 'status' => rest_authorization_required_code() ) );
1290 }
1291
1292 return true;
1293@@ -131,13 +131,13 @@ class WP_REST_Post_Statuses_Controller extends WP_REST_Controller {
1294 $status = get_post_status_object( $request['status'] );
1295
1296 if ( empty( $status ) ) {
1297- return new WP_Error( 'rest_status_invalid', __( 'Invalid status.' ), array( 'status' => 404 ) );
1298+ return new WP_Error( 'rest_status_invalid', _l( 'Invalid status.' ), array( 'status' => 404 ) );
1299 }
1300
1301 $check = $this->check_read_permission( $status );
1302
1303 if ( ! $check ) {
1304- return new WP_Error( 'rest_cannot_read_status', __( 'Cannot view status.' ), array( 'status' => rest_authorization_required_code() ) );
1305+ return new WP_Error( 'rest_cannot_read_status', _l( 'Cannot view status.' ), array( 'status' => rest_authorization_required_code() ) );
1306 }
1307
1308 return true;
1309@@ -183,7 +183,7 @@ class WP_REST_Post_Statuses_Controller extends WP_REST_Controller {
1310 $obj = get_post_status_object( $request['status'] );
1311
1312 if ( empty( $obj ) ) {
1313- return new WP_Error( 'rest_status_invalid', __( 'Invalid status.' ), array( 'status' => 404 ) );
1314+ return new WP_Error( 'rest_status_invalid', _l( 'Invalid status.' ), array( 'status' => 404 ) );
1315 }
1316
1317 $data = $this->prepare_item_for_response( $obj, $request );
1318@@ -254,43 +254,43 @@ class WP_REST_Post_Statuses_Controller extends WP_REST_Controller {
1319 'type' => 'object',
1320 'properties' => array(
1321 'name' => array(
1322- 'description' => __( 'The title for the status.' ),
1323+ 'description' => _l( 'The title for the status.' ),
1324 'type' => 'string',
1325 'context' => array( 'embed', 'view', 'edit' ),
1326 'readonly' => true,
1327 ),
1328 'private' => array(
1329- 'description' => __( 'Whether posts with this status should be private.' ),
1330+ 'description' => _l( 'Whether posts with this status should be private.' ),
1331 'type' => 'boolean',
1332 'context' => array( 'edit' ),
1333 'readonly' => true,
1334 ),
1335 'protected' => array(
1336- 'description' => __( 'Whether posts with this status should be protected.' ),
1337+ 'description' => _l( 'Whether posts with this status should be protected.' ),
1338 'type' => 'boolean',
1339 'context' => array( 'edit' ),
1340 'readonly' => true,
1341 ),
1342 'public' => array(
1343- 'description' => __( 'Whether posts of this status should be shown in the front end of the site.' ),
1344+ 'description' => _l( 'Whether posts of this status should be shown in the front end of the site.' ),
1345 'type' => 'boolean',
1346 'context' => array( 'view', 'edit' ),
1347 'readonly' => true,
1348 ),
1349 'queryable' => array(
1350- 'description' => __( 'Whether posts with this status should be publicly-queryable.' ),
1351+ 'description' => _l( 'Whether posts with this status should be publicly-queryable.' ),
1352 'type' => 'boolean',
1353 'context' => array( 'view', 'edit' ),
1354 'readonly' => true,
1355 ),
1356 'show_in_list' => array(
1357- 'description' => __( 'Whether to include posts in the edit listing for their post type.' ),
1358+ 'description' => _l( 'Whether to include posts in the edit listing for their post type.' ),
1359 'type' => 'boolean',
1360 'context' => array( 'edit' ),
1361 'readonly' => true,
1362 ),
1363 'slug' => array(
1364- 'description' => __( 'An alphanumeric identifier for the status.' ),
1365+ 'description' => _l( 'An alphanumeric identifier for the status.' ),
1366 'type' => 'string',
1367 'context' => array( 'embed', 'view', 'edit' ),
1368 'readonly' => true,
1369diff --git src/wp-includes/rest-api/endpoints/class-wp-rest-post-types-controller.php src/wp-includes/rest-api/endpoints/class-wp-rest-post-types-controller.php
1370index 69d221be75..181108221e 100644
1371--- src/wp-includes/rest-api/endpoints/class-wp-rest-post-types-controller.php
1372+++ src/wp-includes/rest-api/endpoints/class-wp-rest-post-types-controller.php
1373@@ -50,7 +50,7 @@ class WP_REST_Post_Types_Controller extends WP_REST_Controller {
1374 register_rest_route( $this->namespace, '/' . $this->rest_base . '/(?P<type>[\w-]+)', array(
1375 'args' => array(
1376 'type' => array(
1377- 'description' => __( 'An alphanumeric identifier for the post type.' ),
1378+ 'description' => _l( 'An alphanumeric identifier for the post type.' ),
1379 'type' => 'string',
1380 ),
1381 ),
1382@@ -82,7 +82,7 @@ class WP_REST_Post_Types_Controller extends WP_REST_Controller {
1383 }
1384 }
1385
1386- return new WP_Error( 'rest_cannot_view', __( 'Sorry, you are not allowed to edit posts in this post type.' ), array( 'status' => rest_authorization_required_code() ) );
1387+ return new WP_Error( 'rest_cannot_view', _l( 'Sorry, you are not allowed to edit posts in this post type.' ), array( 'status' => rest_authorization_required_code() ) );
1388 }
1389
1390 return true;
1391@@ -125,15 +125,15 @@ class WP_REST_Post_Types_Controller extends WP_REST_Controller {
1392 $obj = get_post_type_object( $request['type'] );
1393
1394 if ( empty( $obj ) ) {
1395- return new WP_Error( 'rest_type_invalid', __( 'Invalid post type.' ), array( 'status' => 404 ) );
1396+ return new WP_Error( 'rest_type_invalid', _l( 'Invalid post type.' ), array( 'status' => 404 ) );
1397 }
1398
1399 if ( empty( $obj->show_in_rest ) ) {
1400- return new WP_Error( 'rest_cannot_read_type', __( 'Cannot view post type.' ), array( 'status' => rest_authorization_required_code() ) );
1401+ return new WP_Error( 'rest_cannot_read_type', _l( 'Cannot view post type.' ), array( 'status' => rest_authorization_required_code() ) );
1402 }
1403
1404 if ( 'edit' === $request['context'] && ! current_user_can( $obj->cap->edit_posts ) ) {
1405- return new WP_Error( 'rest_forbidden_context', __( 'Sorry, you are not allowed to edit posts in this post type.' ), array( 'status' => rest_authorization_required_code() ) );
1406+ return new WP_Error( 'rest_forbidden_context', _l( 'Sorry, you are not allowed to edit posts in this post type.' ), array( 'status' => rest_authorization_required_code() ) );
1407 }
1408
1409 $data = $this->prepare_item_for_response( $obj, $request );
1410@@ -213,49 +213,49 @@ class WP_REST_Post_Types_Controller extends WP_REST_Controller {
1411 'type' => 'object',
1412 'properties' => array(
1413 'capabilities' => array(
1414- 'description' => __( 'All capabilities used by the post type.' ),
1415+ 'description' => _l( 'All capabilities used by the post type.' ),
1416 'type' => 'object',
1417 'context' => array( 'edit' ),
1418 'readonly' => true,
1419 ),
1420 'description' => array(
1421- 'description' => __( 'A human-readable description of the post type.' ),
1422+ 'description' => _l( 'A human-readable description of the post type.' ),
1423 'type' => 'string',
1424 'context' => array( 'view', 'edit' ),
1425 'readonly' => true,
1426 ),
1427 'hierarchical' => array(
1428- 'description' => __( 'Whether or not the post type should have children.' ),
1429+ 'description' => _l( 'Whether or not the post type should have children.' ),
1430 'type' => 'boolean',
1431 'context' => array( 'view', 'edit' ),
1432 'readonly' => true,
1433 ),
1434 'labels' => array(
1435- 'description' => __( 'Human-readable labels for the post type for various contexts.' ),
1436+ 'description' => _l( 'Human-readable labels for the post type for various contexts.' ),
1437 'type' => 'object',
1438 'context' => array( 'edit' ),
1439 'readonly' => true,
1440 ),
1441 'name' => array(
1442- 'description' => __( 'The title for the post type.' ),
1443+ 'description' => _l( 'The title for the post type.' ),
1444 'type' => 'string',
1445 'context' => array( 'view', 'edit', 'embed' ),
1446 'readonly' => true,
1447 ),
1448 'slug' => array(
1449- 'description' => __( 'An alphanumeric identifier for the post type.' ),
1450+ 'description' => _l( 'An alphanumeric identifier for the post type.' ),
1451 'type' => 'string',
1452 'context' => array( 'view', 'edit', 'embed' ),
1453 'readonly' => true,
1454 ),
1455 'supports' => array(
1456- 'description' => __( 'All features, supported by the post type.' ),
1457+ 'description' => _l( 'All features, supported by the post type.' ),
1458 'type' => 'object',
1459 'context' => array( 'edit' ),
1460 'readonly' => true,
1461 ),
1462 'taxonomies' => array(
1463- 'description' => __( 'Taxonomies associated with post type.' ),
1464+ 'description' => _l( 'Taxonomies associated with post type.' ),
1465 'type' => 'array',
1466 'items' => array(
1467 'type' => 'string',
1468@@ -264,7 +264,7 @@ class WP_REST_Post_Types_Controller extends WP_REST_Controller {
1469 'readonly' => true,
1470 ),
1471 'rest_base' => array(
1472- 'description' => __( 'REST base route for the post type.' ),
1473+ 'description' => _l( 'REST base route for the post type.' ),
1474 'type' => 'string',
1475 'context' => array( 'view', 'edit', 'embed' ),
1476 'readonly' => true,
1477diff --git src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php
1478index 39593cbe3e..e1f722556c 100644
1479--- src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php
1480+++ src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php
1481@@ -83,14 +83,14 @@ class WP_REST_Posts_Controller extends WP_REST_Controller {
1482 );
1483 if ( isset( $schema['properties']['password'] ) ) {
1484 $get_item_args['password'] = array(
1485- 'description' => __( 'The password for the post if it is password protected.' ),
1486+ 'description' => _l( 'The password for the post if it is password protected.' ),
1487 'type' => 'string',
1488 );
1489 }
1490 register_rest_route( $this->namespace, '/' . $this->rest_base . '/(?P<id>[\d]+)', array(
1491 'args' => array(
1492 'id' => array(
1493- 'description' => __( 'Unique identifier for the object.' ),
1494+ 'description' => _l( 'Unique identifier for the object.' ),
1495 'type' => 'integer',
1496 ),
1497 ),
1498@@ -114,7 +114,7 @@ class WP_REST_Posts_Controller extends WP_REST_Controller {
1499 'force' => array(
1500 'type' => 'boolean',
1501 'default' => false,
1502- 'description' => __( 'Whether to bypass trash and force deletion.' ),
1503+ 'description' => _l( 'Whether to bypass trash and force deletion.' ),
1504 ),
1505 ),
1506 ),
1507@@ -136,7 +136,7 @@ class WP_REST_Posts_Controller extends WP_REST_Controller {
1508 $post_type = get_post_type_object( $this->post_type );
1509
1510 if ( 'edit' === $request['context'] && ! current_user_can( $post_type->cap->edit_posts ) ) {
1511- return new WP_Error( 'rest_forbidden_context', __( 'Sorry, you are not allowed to edit posts in this post type.' ), array( 'status' => rest_authorization_required_code() ) );
1512+ return new WP_Error( 'rest_forbidden_context', _l( 'Sorry, you are not allowed to edit posts in this post type.' ), array( 'status' => rest_authorization_required_code() ) );
1513 }
1514
1515 return true;
1516@@ -155,12 +155,12 @@ class WP_REST_Posts_Controller extends WP_REST_Controller {
1517
1518 // Ensure a search string is set in case the orderby is set to 'relevance'.
1519 if ( ! empty( $request['orderby'] ) && 'relevance' === $request['orderby'] && empty( $request['search'] ) ) {
1520- return new WP_Error( 'rest_no_search_term_defined', __( 'You need to define a search term to order by relevance.' ), array( 'status' => 400 ) );
1521+ return new WP_Error( 'rest_no_search_term_defined', _l( 'You need to define a search term to order by relevance.' ), array( 'status' => 400 ) );
1522 }
1523
1524 // Ensure an include parameter is set in case the orderby is set to 'include'.
1525 if ( ! empty( $request['orderby'] ) && 'include' === $request['orderby'] && empty( $request['include'] ) ) {
1526- return new WP_Error( 'rest_orderby_include_missing_include', __( 'You need to define an include parameter to order by include.' ), array( 'status' => 400 ) );
1527+ return new WP_Error( 'rest_orderby_include_missing_include', _l( 'You need to define an include parameter to order by include.' ), array( 'status' => 400 ) );
1528 }
1529
1530 // Retrieve the list of registered collection query parameters.
1531@@ -332,7 +332,7 @@ class WP_REST_Posts_Controller extends WP_REST_Controller {
1532 $max_pages = ceil( $total_posts / (int) $posts_query->query_vars['posts_per_page'] );
1533
1534 if ( $page > $max_pages && $total_posts > 0 ) {
1535- return new WP_Error( 'rest_post_invalid_page_number', __( 'The page number requested is larger than the number of pages available.' ), array( 'status' => 400 ) );
1536+ return new WP_Error( 'rest_post_invalid_page_number', _l( 'The page number requested is larger than the number of pages available.' ), array( 'status' => 400 ) );
1537 }
1538
1539 $response = rest_ensure_response( $posts );
1540@@ -372,7 +372,7 @@ class WP_REST_Posts_Controller extends WP_REST_Controller {
1541 * @return WP_Post|WP_Error Post object if ID is valid, WP_Error otherwise.
1542 */
1543 protected function get_post( $id ) {
1544- $error = new WP_Error( 'rest_post_invalid_id', __( 'Invalid post ID.' ), array( 'status' => 404 ) );
1545+ $error = new WP_Error( 'rest_post_invalid_id', _l( 'Invalid post ID.' ), array( 'status' => 404 ) );
1546 if ( (int) $id <= 0 ) {
1547 return $error;
1548 }
1549@@ -401,13 +401,13 @@ class WP_REST_Posts_Controller extends WP_REST_Controller {
1550 }
1551
1552 if ( 'edit' === $request['context'] && $post && ! $this->check_update_permission( $post ) ) {
1553- return new WP_Error( 'rest_forbidden_context', __( 'Sorry, you are not allowed to edit this post.' ), array( 'status' => rest_authorization_required_code() ) );
1554+ return new WP_Error( 'rest_forbidden_context', _l( 'Sorry, you are not allowed to edit this post.' ), array( 'status' => rest_authorization_required_code() ) );
1555 }
1556
1557 if ( $post && ! empty( $request['password'] ) ) {
1558 // Check post password, and return error if invalid.
1559 if ( ! hash_equals( $post->post_password, $request['password'] ) ) {
1560- return new WP_Error( 'rest_post_incorrect_password', __( 'Incorrect post password.' ), array( 'status' => 403 ) );
1561+ return new WP_Error( 'rest_post_incorrect_password', _l( 'Incorrect post password.' ), array( 'status' => 403 ) );
1562 }
1563 }
1564
1565@@ -492,25 +492,25 @@ class WP_REST_Posts_Controller extends WP_REST_Controller {
1566 */
1567 public function create_item_permissions_check( $request ) {
1568 if ( ! empty( $request['id'] ) ) {
1569- return new WP_Error( 'rest_post_exists', __( 'Cannot create existing post.' ), array( 'status' => 400 ) );
1570+ return new WP_Error( 'rest_post_exists', _l( 'Cannot create existing post.' ), array( 'status' => 400 ) );
1571 }
1572
1573 $post_type = get_post_type_object( $this->post_type );
1574
1575 if ( ! empty( $request['author'] ) && get_current_user_id() !== $request['author'] && ! current_user_can( $post_type->cap->edit_others_posts ) ) {
1576- return new WP_Error( 'rest_cannot_edit_others', __( 'Sorry, you are not allowed to create posts as this user.' ), array( 'status' => rest_authorization_required_code() ) );
1577+ return new WP_Error( 'rest_cannot_edit_others', _l( 'Sorry, you are not allowed to create posts as this user.' ), array( 'status' => rest_authorization_required_code() ) );
1578 }
1579
1580 if ( ! empty( $request['sticky'] ) && ! current_user_can( $post_type->cap->edit_others_posts ) ) {
1581- return new WP_Error( 'rest_cannot_assign_sticky', __( 'Sorry, you are not allowed to make posts sticky.' ), array( 'status' => rest_authorization_required_code() ) );
1582+ return new WP_Error( 'rest_cannot_assign_sticky', _l( 'Sorry, you are not allowed to make posts sticky.' ), array( 'status' => rest_authorization_required_code() ) );
1583 }
1584
1585 if ( ! current_user_can( $post_type->cap->create_posts ) ) {
1586- return new WP_Error( 'rest_cannot_create', __( 'Sorry, you are not allowed to create posts as this user.' ), array( 'status' => rest_authorization_required_code() ) );
1587+ return new WP_Error( 'rest_cannot_create', _l( 'Sorry, you are not allowed to create posts as this user.' ), array( 'status' => rest_authorization_required_code() ) );
1588 }
1589
1590 if ( ! $this->check_assign_terms_permission( $request ) ) {
1591- return new WP_Error( 'rest_cannot_assign_term', __( 'Sorry, you are not allowed to assign the provided terms.' ), array( 'status' => rest_authorization_required_code() ) );
1592+ return new WP_Error( 'rest_cannot_assign_term', _l( 'Sorry, you are not allowed to assign the provided terms.' ), array( 'status' => rest_authorization_required_code() ) );
1593 }
1594
1595 return true;
1596@@ -527,7 +527,7 @@ class WP_REST_Posts_Controller extends WP_REST_Controller {
1597 */
1598 public function create_item( $request ) {
1599 if ( ! empty( $request['id'] ) ) {
1600- return new WP_Error( 'rest_post_exists', __( 'Cannot create existing post.' ), array( 'status' => 400 ) );
1601+ return new WP_Error( 'rest_post_exists', _l( 'Cannot create existing post.' ), array( 'status' => 400 ) );
1602 }
1603
1604 $prepared_post = $this->prepare_item_for_database( $request );
1605@@ -638,19 +638,19 @@ class WP_REST_Posts_Controller extends WP_REST_Controller {
1606 $post_type = get_post_type_object( $this->post_type );
1607
1608 if ( $post && ! $this->check_update_permission( $post ) ) {
1609- return new WP_Error( 'rest_cannot_edit', __( 'Sorry, you are not allowed to edit this post.' ), array( 'status' => rest_authorization_required_code() ) );
1610+ return new WP_Error( 'rest_cannot_edit', _l( 'Sorry, you are not allowed to edit this post.' ), array( 'status' => rest_authorization_required_code() ) );
1611 }
1612
1613 if ( ! empty( $request['author'] ) && get_current_user_id() !== $request['author'] && ! current_user_can( $post_type->cap->edit_others_posts ) ) {
1614- return new WP_Error( 'rest_cannot_edit_others', __( 'Sorry, you are not allowed to update posts as this user.' ), array( 'status' => rest_authorization_required_code() ) );
1615+ return new WP_Error( 'rest_cannot_edit_others', _l( 'Sorry, you are not allowed to update posts as this user.' ), array( 'status' => rest_authorization_required_code() ) );
1616 }
1617
1618 if ( ! empty( $request['sticky'] ) && ! current_user_can( $post_type->cap->edit_others_posts ) ) {
1619- return new WP_Error( 'rest_cannot_assign_sticky', __( 'Sorry, you are not allowed to make posts sticky.' ), array( 'status' => rest_authorization_required_code() ) );
1620+ return new WP_Error( 'rest_cannot_assign_sticky', _l( 'Sorry, you are not allowed to make posts sticky.' ), array( 'status' => rest_authorization_required_code() ) );
1621 }
1622
1623 if ( ! $this->check_assign_terms_permission( $request ) ) {
1624- return new WP_Error( 'rest_cannot_assign_term', __( 'Sorry, you are not allowed to assign the provided terms.' ), array( 'status' => rest_authorization_required_code() ) );
1625+ return new WP_Error( 'rest_cannot_assign_term', _l( 'Sorry, you are not allowed to assign the provided terms.' ), array( 'status' => rest_authorization_required_code() ) );
1626 }
1627
1628 return true;
1629@@ -760,7 +760,7 @@ class WP_REST_Posts_Controller extends WP_REST_Controller {
1630 }
1631
1632 if ( $post && ! $this->check_delete_permission( $post ) ) {
1633- return new WP_Error( 'rest_cannot_delete', __( 'Sorry, you are not allowed to delete this post.' ), array( 'status' => rest_authorization_required_code() ) );
1634+ return new WP_Error( 'rest_cannot_delete', _l( 'Sorry, you are not allowed to delete this post.' ), array( 'status' => rest_authorization_required_code() ) );
1635 }
1636
1637 return true;
1638@@ -805,7 +805,7 @@ class WP_REST_Posts_Controller extends WP_REST_Controller {
1639 $supports_trash = apply_filters( "rest_{$this->post_type}_trashable", $supports_trash, $post );
1640
1641 if ( ! $this->check_delete_permission( $post ) ) {
1642- return new WP_Error( 'rest_user_cannot_delete_post', __( 'Sorry, you are not allowed to delete this post.' ), array( 'status' => rest_authorization_required_code() ) );
1643+ return new WP_Error( 'rest_user_cannot_delete_post', _l( 'Sorry, you are not allowed to delete this post.' ), array( 'status' => rest_authorization_required_code() ) );
1644 }
1645
1646 $request->set_param( 'context', 'edit' );
1647@@ -820,12 +820,12 @@ class WP_REST_Posts_Controller extends WP_REST_Controller {
1648 } else {
1649 // If we don't support trashing for this type, error out.
1650 if ( ! $supports_trash ) {
1651- return new WP_Error( 'rest_trash_not_supported', __( 'The post does not support trashing. Set force=true to delete.' ), array( 'status' => 501 ) );
1652+ return new WP_Error( 'rest_trash_not_supported', _l( 'The post does not support trashing. Set force=true to delete.' ), array( 'status' => 501 ) );
1653 }
1654
1655 // Otherwise, only trash if we haven't already.
1656 if ( 'trash' === $post->post_status ) {
1657- return new WP_Error( 'rest_already_trashed', __( 'The post has already been deleted.' ), array( 'status' => 410 ) );
1658+ return new WP_Error( 'rest_already_trashed', _l( 'The post has already been deleted.' ), array( 'status' => 410 ) );
1659 }
1660
1661 // (Note that internally this falls through to `wp_delete_post` if
1662@@ -836,7 +836,7 @@ class WP_REST_Posts_Controller extends WP_REST_Controller {
1663 }
1664
1665 if ( ! $result ) {
1666- return new WP_Error( 'rest_cannot_delete', __( 'The post cannot be deleted.' ), array( 'status' => 500 ) );
1667+ return new WP_Error( 'rest_cannot_delete', _l( 'The post cannot be deleted.' ), array( 'status' => 500 ) );
1668 }
1669
1670 /**
1671@@ -1031,7 +1031,7 @@ class WP_REST_Posts_Controller extends WP_REST_Controller {
1672 $user_obj = get_userdata( $post_author );
1673
1674 if ( ! $user_obj ) {
1675- return new WP_Error( 'rest_invalid_author', __( 'Invalid author ID.' ), array( 'status' => 400 ) );
1676+ return new WP_Error( 'rest_invalid_author', _l( 'Invalid author ID.' ), array( 'status' => 400 ) );
1677 }
1678 }
1679
1680@@ -1044,18 +1044,18 @@ class WP_REST_Posts_Controller extends WP_REST_Controller {
1681
1682 if ( '' !== $request['password'] ) {
1683 if ( ! empty( $schema['properties']['sticky'] ) && ! empty( $request['sticky'] ) ) {
1684- return new WP_Error( 'rest_invalid_field', __( 'A post can not be sticky and have a password.' ), array( 'status' => 400 ) );
1685+ return new WP_Error( 'rest_invalid_field', _l( 'A post can not be sticky and have a password.' ), array( 'status' => 400 ) );
1686 }
1687
1688 if ( ! empty( $prepared_post->ID ) && is_sticky( $prepared_post->ID ) ) {
1689- return new WP_Error( 'rest_invalid_field', __( 'A sticky post can not be password protected.' ), array( 'status' => 400 ) );
1690+ return new WP_Error( 'rest_invalid_field', _l( 'A sticky post can not be password protected.' ), array( 'status' => 400 ) );
1691 }
1692 }
1693 }
1694
1695 if ( ! empty( $schema['properties']['sticky'] ) && ! empty( $request['sticky'] ) ) {
1696 if ( ! empty( $prepared_post->ID ) && post_password_required( $prepared_post->ID ) ) {
1697- return new WP_Error( 'rest_invalid_field', __( 'A password protected post can not be set to sticky.' ), array( 'status' => 400 ) );
1698+ return new WP_Error( 'rest_invalid_field', _l( 'A password protected post can not be set to sticky.' ), array( 'status' => 400 ) );
1699 }
1700 }
1701
1702@@ -1066,7 +1066,7 @@ class WP_REST_Posts_Controller extends WP_REST_Controller {
1703 } else {
1704 $parent = get_post( (int) $request['parent'] );
1705 if ( empty( $parent ) ) {
1706- return new WP_Error( 'rest_post_invalid_id', __( 'Invalid post parent ID.' ), array( 'status' => 400 ) );
1707+ return new WP_Error( 'rest_post_invalid_id', _l( 'Invalid post parent ID.' ), array( 'status' => 400 ) );
1708 }
1709 $prepared_post->post_parent = (int) $parent->ID;
1710 }
1711@@ -1120,13 +1120,13 @@ class WP_REST_Posts_Controller extends WP_REST_Controller {
1712 break;
1713 case 'private':
1714 if ( ! current_user_can( $post_type->cap->publish_posts ) ) {
1715- return new WP_Error( 'rest_cannot_publish', __( 'Sorry, you are not allowed to create private posts in this post type.' ), array( 'status' => rest_authorization_required_code() ) );
1716+ return new WP_Error( 'rest_cannot_publish', _l( 'Sorry, you are not allowed to create private posts in this post type.' ), array( 'status' => rest_authorization_required_code() ) );
1717 }
1718 break;
1719 case 'publish':
1720 case 'future':
1721 if ( ! current_user_can( $post_type->cap->publish_posts ) ) {
1722- return new WP_Error( 'rest_cannot_publish', __( 'Sorry, you are not allowed to publish posts in this post type.' ), array( 'status' => rest_authorization_required_code() ) );
1723+ return new WP_Error( 'rest_cannot_publish', _l( 'Sorry, you are not allowed to publish posts in this post type.' ), array( 'status' => rest_authorization_required_code() ) );
1724 }
1725 break;
1726 default:
1727@@ -1157,7 +1157,7 @@ class WP_REST_Posts_Controller extends WP_REST_Controller {
1728 if ( $result ) {
1729 return true;
1730 } else {
1731- return new WP_Error( 'rest_invalid_featured_media', __( 'Invalid featured media ID.' ), array( 'status' => 400 ) );
1732+ return new WP_Error( 'rest_invalid_featured_media', _l( 'Invalid featured media ID.' ), array( 'status' => 400 ) );
1733 }
1734 } else {
1735 return delete_post_thumbnail( $post_id );
1736@@ -1722,31 +1722,31 @@ class WP_REST_Posts_Controller extends WP_REST_Controller {
1737 // Base properties for every Post.
1738 'properties' => array(
1739 'date' => array(
1740- 'description' => __( "The date the object was published, in the site's timezone." ),
1741+ 'description' => _l( "The date the object was published, in the site's timezone." ),
1742 'type' => 'string',
1743 'format' => 'date-time',
1744 'context' => array( 'view', 'edit', 'embed' ),
1745 ),
1746 'date_gmt' => array(
1747- 'description' => __( 'The date the object was published, as GMT.' ),
1748+ 'description' => _l( 'The date the object was published, as GMT.' ),
1749 'type' => 'string',
1750 'format' => 'date-time',
1751 'context' => array( 'view', 'edit' ),
1752 ),
1753 'guid' => array(
1754- 'description' => __( 'The globally unique identifier for the object.' ),
1755+ 'description' => _l( 'The globally unique identifier for the object.' ),
1756 'type' => 'object',
1757 'context' => array( 'view', 'edit' ),
1758 'readonly' => true,
1759 'properties' => array(
1760 'raw' => array(
1761- 'description' => __( 'GUID for the object, as it exists in the database.' ),
1762+ 'description' => _l( 'GUID for the object, as it exists in the database.' ),
1763 'type' => 'string',
1764 'context' => array( 'edit' ),
1765 'readonly' => true,
1766 ),
1767 'rendered' => array(
1768- 'description' => __( 'GUID for the object, transformed for display.' ),
1769+ 'description' => _l( 'GUID for the object, transformed for display.' ),
1770 'type' => 'string',
1771 'context' => array( 'view', 'edit' ),
1772 'readonly' => true,
1773@@ -1754,34 +1754,34 @@ class WP_REST_Posts_Controller extends WP_REST_Controller {
1774 ),
1775 ),
1776 'id' => array(
1777- 'description' => __( 'Unique identifier for the object.' ),
1778+ 'description' => _l( 'Unique identifier for the object.' ),
1779 'type' => 'integer',
1780 'context' => array( 'view', 'edit', 'embed' ),
1781 'readonly' => true,
1782 ),
1783 'link' => array(
1784- 'description' => __( 'URL to the object.' ),
1785+ 'description' => _l( 'URL to the object.' ),
1786 'type' => 'string',
1787 'format' => 'uri',
1788 'context' => array( 'view', 'edit', 'embed' ),
1789 'readonly' => true,
1790 ),
1791 'modified' => array(
1792- 'description' => __( "The date the object was last modified, in the site's timezone." ),
1793+ 'description' => _l( "The date the object was last modified, in the site's timezone." ),
1794 'type' => 'string',
1795 'format' => 'date-time',
1796 'context' => array( 'view', 'edit' ),
1797 'readonly' => true,
1798 ),
1799 'modified_gmt' => array(
1800- 'description' => __( 'The date the object was last modified, as GMT.' ),
1801+ 'description' => _l( 'The date the object was last modified, as GMT.' ),
1802 'type' => 'string',
1803 'format' => 'date-time',
1804 'context' => array( 'view', 'edit' ),
1805 'readonly' => true,
1806 ),
1807 'slug' => array(
1808- 'description' => __( 'An alphanumeric identifier for the object unique to its type.' ),
1809+ 'description' => _l( 'An alphanumeric identifier for the object unique to its type.' ),
1810 'type' => 'string',
1811 'context' => array( 'view', 'edit', 'embed' ),
1812 'arg_options' => array(
1813@@ -1789,19 +1789,19 @@ class WP_REST_Posts_Controller extends WP_REST_Controller {
1814 ),
1815 ),
1816 'status' => array(
1817- 'description' => __( 'A named status for the object.' ),
1818+ 'description' => _l( 'A named status for the object.' ),
1819 'type' => 'string',
1820 'enum' => array_keys( get_post_stati( array( 'internal' => false ) ) ),
1821 'context' => array( 'view', 'edit' ),
1822 ),
1823 'type' => array(
1824- 'description' => __( 'Type of Post for the object.' ),
1825+ 'description' => _l( 'Type of Post for the object.' ),
1826 'type' => 'string',
1827 'context' => array( 'view', 'edit', 'embed' ),
1828 'readonly' => true,
1829 ),
1830 'password' => array(
1831- 'description' => __( 'A password to protect access to the content and excerpt.' ),
1832+ 'description' => _l( 'A password to protect access to the content and excerpt.' ),
1833 'type' => 'string',
1834 'context' => array( 'edit' ),
1835 ),
1836@@ -1812,7 +1812,7 @@ class WP_REST_Posts_Controller extends WP_REST_Controller {
1837
1838 if ( $post_type_obj->hierarchical ) {
1839 $schema['properties']['parent'] = array(
1840- 'description' => __( 'The ID for the parent of the object.' ),
1841+ 'description' => _l( 'The ID for the parent of the object.' ),
1842 'type' => 'integer',
1843 'context' => array( 'view', 'edit' ),
1844 );
1845@@ -1872,7 +1872,7 @@ class WP_REST_Posts_Controller extends WP_REST_Controller {
1846
1847 case 'title':
1848 $schema['properties']['title'] = array(
1849- 'description' => __( 'The title for the object.' ),
1850+ 'description' => _l( 'The title for the object.' ),
1851 'type' => 'object',
1852 'context' => array( 'view', 'edit', 'embed' ),
1853 'arg_options' => array(
1854@@ -1880,12 +1880,12 @@ class WP_REST_Posts_Controller extends WP_REST_Controller {
1855 ),
1856 'properties' => array(
1857 'raw' => array(
1858- 'description' => __( 'Title for the object, as it exists in the database.' ),
1859+ 'description' => _l( 'Title for the object, as it exists in the database.' ),
1860 'type' => 'string',
1861 'context' => array( 'edit' ),
1862 ),
1863 'rendered' => array(
1864- 'description' => __( 'HTML title for the object, transformed for display.' ),
1865+ 'description' => _l( 'HTML title for the object, transformed for display.' ),
1866 'type' => 'string',
1867 'context' => array( 'view', 'edit', 'embed' ),
1868 'readonly' => true,
1869@@ -1896,7 +1896,7 @@ class WP_REST_Posts_Controller extends WP_REST_Controller {
1870
1871 case 'editor':
1872 $schema['properties']['content'] = array(
1873- 'description' => __( 'The content for the object.' ),
1874+ 'description' => _l( 'The content for the object.' ),
1875 'type' => 'object',
1876 'context' => array( 'view', 'edit' ),
1877 'arg_options' => array(
1878@@ -1904,18 +1904,18 @@ class WP_REST_Posts_Controller extends WP_REST_Controller {
1879 ),
1880 'properties' => array(
1881 'raw' => array(
1882- 'description' => __( 'Content for the object, as it exists in the database.' ),
1883+ 'description' => _l( 'Content for the object, as it exists in the database.' ),
1884 'type' => 'string',
1885 'context' => array( 'edit' ),
1886 ),
1887 'rendered' => array(
1888- 'description' => __( 'HTML content for the object, transformed for display.' ),
1889+ 'description' => _l( 'HTML content for the object, transformed for display.' ),
1890 'type' => 'string',
1891 'context' => array( 'view', 'edit' ),
1892 'readonly' => true,
1893 ),
1894 'protected' => array(
1895- 'description' => __( 'Whether the content is protected with a password.' ),
1896+ 'description' => _l( 'Whether the content is protected with a password.' ),
1897 'type' => 'boolean',
1898 'context' => array( 'view', 'edit', 'embed' ),
1899 'readonly' => true,
1900@@ -1926,7 +1926,7 @@ class WP_REST_Posts_Controller extends WP_REST_Controller {
1901
1902 case 'author':
1903 $schema['properties']['author'] = array(
1904- 'description' => __( 'The ID for the author of the object.' ),
1905+ 'description' => _l( 'The ID for the author of the object.' ),
1906 'type' => 'integer',
1907 'context' => array( 'view', 'edit', 'embed' ),
1908 );
1909@@ -1934,7 +1934,7 @@ class WP_REST_Posts_Controller extends WP_REST_Controller {
1910
1911 case 'excerpt':
1912 $schema['properties']['excerpt'] = array(
1913- 'description' => __( 'The excerpt for the object.' ),
1914+ 'description' => _l( 'The excerpt for the object.' ),
1915 'type' => 'object',
1916 'context' => array( 'view', 'edit', 'embed' ),
1917 'arg_options' => array(
1918@@ -1942,18 +1942,18 @@ class WP_REST_Posts_Controller extends WP_REST_Controller {
1919 ),
1920 'properties' => array(
1921 'raw' => array(
1922- 'description' => __( 'Excerpt for the object, as it exists in the database.' ),
1923+ 'description' => _l( 'Excerpt for the object, as it exists in the database.' ),
1924 'type' => 'string',
1925 'context' => array( 'edit' ),
1926 ),
1927 'rendered' => array(
1928- 'description' => __( 'HTML excerpt for the object, transformed for display.' ),
1929+ 'description' => _l( 'HTML excerpt for the object, transformed for display.' ),
1930 'type' => 'string',
1931 'context' => array( 'view', 'edit', 'embed' ),
1932 'readonly' => true,
1933 ),
1934 'protected' => array(
1935- 'description' => __( 'Whether the excerpt is protected with a password.' ),
1936+ 'description' => _l( 'Whether the excerpt is protected with a password.' ),
1937 'type' => 'boolean',
1938 'context' => array( 'view', 'edit', 'embed' ),
1939 'readonly' => true,
1940@@ -1964,7 +1964,7 @@ class WP_REST_Posts_Controller extends WP_REST_Controller {
1941
1942 case 'thumbnail':
1943 $schema['properties']['featured_media'] = array(
1944- 'description' => __( 'The ID of the featured media for the object.' ),
1945+ 'description' => _l( 'The ID of the featured media for the object.' ),
1946 'type' => 'integer',
1947 'context' => array( 'view', 'edit', 'embed' ),
1948 );
1949@@ -1972,13 +1972,13 @@ class WP_REST_Posts_Controller extends WP_REST_Controller {
1950
1951 case 'comments':
1952 $schema['properties']['comment_status'] = array(
1953- 'description' => __( 'Whether or not comments are open on the object.' ),
1954+ 'description' => _l( 'Whether or not comments are open on the object.' ),
1955 'type' => 'string',
1956 'enum' => array( 'open', 'closed' ),
1957 'context' => array( 'view', 'edit' ),
1958 );
1959 $schema['properties']['ping_status'] = array(
1960- 'description' => __( 'Whether or not the object can be pinged.' ),
1961+ 'description' => _l( 'Whether or not the object can be pinged.' ),
1962 'type' => 'string',
1963 'enum' => array( 'open', 'closed' ),
1964 'context' => array( 'view', 'edit' ),
1965@@ -1987,7 +1987,7 @@ class WP_REST_Posts_Controller extends WP_REST_Controller {
1966
1967 case 'page-attributes':
1968 $schema['properties']['menu_order'] = array(
1969- 'description' => __( 'The order of the object in relation to other object of its type.' ),
1970+ 'description' => _l( 'The order of the object in relation to other object of its type.' ),
1971 'type' => 'integer',
1972 'context' => array( 'view', 'edit' ),
1973 );
1974@@ -1998,7 +1998,7 @@ class WP_REST_Posts_Controller extends WP_REST_Controller {
1975 $formats = array_values( get_post_format_slugs() );
1976
1977 $schema['properties']['format'] = array(
1978- 'description' => __( 'The format for the object.' ),
1979+ 'description' => _l( 'The format for the object.' ),
1980 'type' => 'string',
1981 'enum' => $formats,
1982 'context' => array( 'view', 'edit' ),
1983@@ -2014,14 +2014,14 @@ class WP_REST_Posts_Controller extends WP_REST_Controller {
1984
1985 if ( 'post' === $this->post_type ) {
1986 $schema['properties']['sticky'] = array(
1987- 'description' => __( 'Whether or not the object should be treated as sticky.' ),
1988+ 'description' => _l( 'Whether or not the object should be treated as sticky.' ),
1989 'type' => 'boolean',
1990 'context' => array( 'view', 'edit' ),
1991 );
1992 }
1993
1994 $schema['properties']['template'] = array(
1995- 'description' => __( 'The theme file to use to display the object.' ),
1996+ 'description' => _l( 'The theme file to use to display the object.' ),
1997 'type' => 'string',
1998 'enum' => array_merge( array_keys( wp_get_theme()->get_page_templates( null, $this->post_type ) ), array( '' ) ),
1999 'context' => array( 'view', 'edit' ),
2000@@ -2032,7 +2032,7 @@ class WP_REST_Posts_Controller extends WP_REST_Controller {
2001 $base = ! empty( $taxonomy->rest_base ) ? $taxonomy->rest_base : $taxonomy->name;
2002 $schema['properties'][ $base ] = array(
2003 /* translators: %s: taxonomy name */
2004- 'description' => sprintf( __( 'The terms assigned to the object in the %s taxonomy.' ), $taxonomy->name ),
2005+ 'description' => sprintf( _l( 'The terms assigned to the object in the %s taxonomy.' ), $taxonomy->name ),
2006 'type' => 'array',
2007 'items' => array(
2008 'type' => 'integer',
2009@@ -2058,14 +2058,14 @@ class WP_REST_Posts_Controller extends WP_REST_Controller {
2010 $query_params['context']['default'] = 'view';
2011
2012 $query_params['after'] = array(
2013- 'description' => __( 'Limit response to posts published after a given ISO8601 compliant date.' ),
2014+ 'description' => _l( 'Limit response to posts published after a given ISO8601 compliant date.' ),
2015 'type' => 'string',
2016 'format' => 'date-time',
2017 );
2018
2019 if ( post_type_supports( $this->post_type, 'author' ) ) {
2020 $query_params['author'] = array(
2021- 'description' => __( 'Limit result set to posts assigned to specific authors.' ),
2022+ 'description' => _l( 'Limit result set to posts assigned to specific authors.' ),
2023 'type' => 'array',
2024 'items' => array(
2025 'type' => 'integer',
2026@@ -2073,7 +2073,7 @@ class WP_REST_Posts_Controller extends WP_REST_Controller {
2027 'default' => array(),
2028 );
2029 $query_params['author_exclude'] = array(
2030- 'description' => __( 'Ensure result set excludes posts assigned to specific authors.' ),
2031+ 'description' => _l( 'Ensure result set excludes posts assigned to specific authors.' ),
2032 'type' => 'array',
2033 'items' => array(
2034 'type' => 'integer',
2035@@ -2083,13 +2083,13 @@ class WP_REST_Posts_Controller extends WP_REST_Controller {
2036 }
2037
2038 $query_params['before'] = array(
2039- 'description' => __( 'Limit response to posts published before a given ISO8601 compliant date.' ),
2040+ 'description' => _l( 'Limit response to posts published before a given ISO8601 compliant date.' ),
2041 'type' => 'string',
2042 'format' => 'date-time',
2043 );
2044
2045 $query_params['exclude'] = array(
2046- 'description' => __( 'Ensure result set excludes specific IDs.' ),
2047+ 'description' => _l( 'Ensure result set excludes specific IDs.' ),
2048 'type' => 'array',
2049 'items' => array(
2050 'type' => 'integer',
2051@@ -2098,7 +2098,7 @@ class WP_REST_Posts_Controller extends WP_REST_Controller {
2052 );
2053
2054 $query_params['include'] = array(
2055- 'description' => __( 'Limit result set to specific IDs.' ),
2056+ 'description' => _l( 'Limit result set to specific IDs.' ),
2057 'type' => 'array',
2058 'items' => array(
2059 'type' => 'integer',
2060@@ -2108,25 +2108,25 @@ class WP_REST_Posts_Controller extends WP_REST_Controller {
2061
2062 if ( 'page' === $this->post_type || post_type_supports( $this->post_type, 'page-attributes' ) ) {
2063 $query_params['menu_order'] = array(
2064- 'description' => __( 'Limit result set to posts with a specific menu_order value.' ),
2065+ 'description' => _l( 'Limit result set to posts with a specific menu_order value.' ),
2066 'type' => 'integer',
2067 );
2068 }
2069
2070 $query_params['offset'] = array(
2071- 'description' => __( 'Offset the result set by a specific number of items.' ),
2072+ 'description' => _l( 'Offset the result set by a specific number of items.' ),
2073 'type' => 'integer',
2074 );
2075
2076 $query_params['order'] = array(
2077- 'description' => __( 'Order sort attribute ascending or descending.' ),
2078+ 'description' => _l( 'Order sort attribute ascending or descending.' ),
2079 'type' => 'string',
2080 'default' => 'desc',
2081 'enum' => array( 'asc', 'desc' ),
2082 );
2083
2084 $query_params['orderby'] = array(
2085- 'description' => __( 'Sort collection by object attribute.' ),
2086+ 'description' => _l( 'Sort collection by object attribute.' ),
2087 'type' => 'string',
2088 'default' => 'date',
2089 'enum' => array(
2090@@ -2150,7 +2150,7 @@ class WP_REST_Posts_Controller extends WP_REST_Controller {
2091
2092 if ( $post_type->hierarchical || 'attachment' === $this->post_type ) {
2093 $query_params['parent'] = array(
2094- 'description' => __( 'Limit result set to items with particular parent IDs.' ),
2095+ 'description' => _l( 'Limit result set to items with particular parent IDs.' ),
2096 'type' => 'array',
2097 'items' => array(
2098 'type' => 'integer',
2099@@ -2158,7 +2158,7 @@ class WP_REST_Posts_Controller extends WP_REST_Controller {
2100 'default' => array(),
2101 );
2102 $query_params['parent_exclude'] = array(
2103- 'description' => __( 'Limit result set to all items except those of a particular parent ID.' ),
2104+ 'description' => _l( 'Limit result set to all items except those of a particular parent ID.' ),
2105 'type' => 'array',
2106 'items' => array(
2107 'type' => 'integer',
2108@@ -2168,7 +2168,7 @@ class WP_REST_Posts_Controller extends WP_REST_Controller {
2109 }
2110
2111 $query_params['slug'] = array(
2112- 'description' => __( 'Limit result set to posts with one or more specific slugs.' ),
2113+ 'description' => _l( 'Limit result set to posts with one or more specific slugs.' ),
2114 'type' => 'array',
2115 'items' => array(
2116 'type' => 'string',
2117@@ -2178,7 +2178,7 @@ class WP_REST_Posts_Controller extends WP_REST_Controller {
2118
2119 $query_params['status'] = array(
2120 'default' => 'publish',
2121- 'description' => __( 'Limit result set to posts assigned one or more statuses.' ),
2122+ 'description' => _l( 'Limit result set to posts assigned one or more statuses.' ),
2123 'type' => 'array',
2124 'items' => array(
2125 'enum' => array_merge( array_keys( get_post_stati() ), array( 'any' ) ),
2126@@ -2194,7 +2194,7 @@ class WP_REST_Posts_Controller extends WP_REST_Controller {
2127
2128 $query_params[ $base ] = array(
2129 /* translators: %s: taxonomy name */
2130- 'description' => sprintf( __( 'Limit result set to all items that have the specified term assigned in the %s taxonomy.' ), $base ),
2131+ 'description' => sprintf( _l( 'Limit result set to all items that have the specified term assigned in the %s taxonomy.' ), $base ),
2132 'type' => 'array',
2133 'items' => array(
2134 'type' => 'integer',
2135@@ -2204,7 +2204,7 @@ class WP_REST_Posts_Controller extends WP_REST_Controller {
2136
2137 $query_params[ $base . '_exclude' ] = array(
2138 /* translators: %s: taxonomy name */
2139- 'description' => sprintf( __( 'Limit result set to all items except those that have the specified term assigned in the %s taxonomy.' ), $base ),
2140+ 'description' => sprintf( _l( 'Limit result set to all items except those that have the specified term assigned in the %s taxonomy.' ), $base ),
2141 'type' => 'array',
2142 'items' => array(
2143 'type' => 'integer',
2144@@ -2215,7 +2215,7 @@ class WP_REST_Posts_Controller extends WP_REST_Controller {
2145
2146 if ( 'post' === $this->post_type ) {
2147 $query_params['sticky'] = array(
2148- 'description' => __( 'Limit result set to items that are sticky.' ),
2149+ 'description' => _l( 'Limit result set to items that are sticky.' ),
2150 'type' => 'boolean',
2151 );
2152 }
2153@@ -2270,7 +2270,7 @@ class WP_REST_Posts_Controller extends WP_REST_Controller {
2154 return $result;
2155 }
2156 } else {
2157- return new WP_Error( 'rest_forbidden_status', __( 'Status is forbidden.' ), array( 'status' => rest_authorization_required_code() ) );
2158+ return new WP_Error( 'rest_forbidden_status', _l( 'Status is forbidden.' ), array( 'status' => rest_authorization_required_code() ) );
2159 }
2160 }
2161
2162diff --git src/wp-includes/rest-api/endpoints/class-wp-rest-revisions-controller.php src/wp-includes/rest-api/endpoints/class-wp-rest-revisions-controller.php
2163index 8b0efcdf3d..4b46d8296a 100644
2164--- src/wp-includes/rest-api/endpoints/class-wp-rest-revisions-controller.php
2165+++ src/wp-includes/rest-api/endpoints/class-wp-rest-revisions-controller.php
2166@@ -73,7 +73,7 @@ class WP_REST_Revisions_Controller extends WP_REST_Controller {
2167 register_rest_route( $this->namespace, '/' . $this->parent_base . '/(?P<parent>[\d]+)/' . $this->rest_base, array(
2168 'args' => array(
2169 'parent' => array(
2170- 'description' => __( 'The ID for the parent of the object.' ),
2171+ 'description' => _l( 'The ID for the parent of the object.' ),
2172 'type' => 'integer',
2173 ),
2174 ),
2175@@ -89,11 +89,11 @@ class WP_REST_Revisions_Controller extends WP_REST_Controller {
2176 register_rest_route( $this->namespace, '/' . $this->parent_base . '/(?P<parent>[\d]+)/' . $this->rest_base . '/(?P<id>[\d]+)', array(
2177 'args' => array(
2178 'parent' => array(
2179- 'description' => __( 'The ID for the parent of the object.' ),
2180+ 'description' => _l( 'The ID for the parent of the object.' ),
2181 'type' => 'integer',
2182 ),
2183 'id' => array(
2184- 'description' => __( 'Unique identifier for the object.' ),
2185+ 'description' => _l( 'Unique identifier for the object.' ),
2186 'type' => 'integer',
2187 ),
2188 ),
2189@@ -113,7 +113,7 @@ class WP_REST_Revisions_Controller extends WP_REST_Controller {
2190 'force' => array(
2191 'type' => 'boolean',
2192 'default' => false,
2193- 'description' => __( 'Required to be true, as revisions do not support trashing.' ),
2194+ 'description' => _l( 'Required to be true, as revisions do not support trashing.' ),
2195 ),
2196 ),
2197 ),
2198@@ -131,7 +131,7 @@ class WP_REST_Revisions_Controller extends WP_REST_Controller {
2199 * @return WP_Post|WP_Error Post object if ID is valid, WP_Error otherwise.
2200 */
2201 protected function get_parent( $parent ) {
2202- $error = new WP_Error( 'rest_post_invalid_parent', __( 'Invalid post parent ID.' ), array( 'status' => 404 ) );
2203+ $error = new WP_Error( 'rest_post_invalid_parent', _l( 'Invalid post parent ID.' ), array( 'status' => 404 ) );
2204 if ( (int) $parent <= 0 ) {
2205 return $error;
2206 }
2207@@ -161,7 +161,7 @@ class WP_REST_Revisions_Controller extends WP_REST_Controller {
2208
2209 $parent_post_type_obj = get_post_type_object( $parent->post_type );
2210 if ( ! current_user_can( $parent_post_type_obj->cap->edit_post, $parent->ID ) ) {
2211- return new WP_Error( 'rest_cannot_read', __( 'Sorry, you are not allowed to view revisions of this post.' ), array( 'status' => rest_authorization_required_code() ) );
2212+ return new WP_Error( 'rest_cannot_read', _l( 'Sorry, you are not allowed to view revisions of this post.' ), array( 'status' => rest_authorization_required_code() ) );
2213 }
2214
2215 return true;
2216@@ -176,7 +176,7 @@ class WP_REST_Revisions_Controller extends WP_REST_Controller {
2217 * @return WP_Post|WP_Error Revision post object if ID is valid, WP_Error otherwise.
2218 */
2219 protected function get_revision( $id ) {
2220- $error = new WP_Error( 'rest_post_invalid_id', __( 'Invalid revision ID.' ), array( 'status' => 404 ) );
2221+ $error = new WP_Error( 'rest_post_invalid_id', _l( 'Invalid revision ID.' ), array( 'status' => 404 ) );
2222 if ( (int) $id <= 0 ) {
2223 return $error;
2224 }
2225@@ -299,7 +299,7 @@ class WP_REST_Revisions_Controller extends WP_REST_Controller {
2226
2227 // We don't support trashing for revisions.
2228 if ( ! $force ) {
2229- return new WP_Error( 'rest_trash_not_supported', __( 'Revisions do not support trashing. Set force=true to delete.' ), array( 'status' => 501 ) );
2230+ return new WP_Error( 'rest_trash_not_supported', _l( 'Revisions do not support trashing. Set force=true to delete.' ), array( 'status' => 501 ) );
2231 }
2232
2233 $previous = $this->prepare_item_for_response( $revision, $request );
2234@@ -319,7 +319,7 @@ class WP_REST_Revisions_Controller extends WP_REST_Controller {
2235 do_action( 'rest_delete_revision', $result, $request );
2236
2237 if ( ! $result ) {
2238- return new WP_Error( 'rest_cannot_delete', __( 'The post cannot be deleted.' ), array( 'status' => 500 ) );
2239+ return new WP_Error( 'rest_cannot_delete', _l( 'The post cannot be deleted.' ), array( 'status' => 500 ) );
2240 }
2241
2242 $response = new WP_REST_Response();
2243@@ -471,51 +471,51 @@ class WP_REST_Revisions_Controller extends WP_REST_Controller {
2244 // Base properties for every Revision.
2245 'properties' => array(
2246 'author' => array(
2247- 'description' => __( 'The ID for the author of the object.' ),
2248+ 'description' => _l( 'The ID for the author of the object.' ),
2249 'type' => 'integer',
2250 'context' => array( 'view', 'edit', 'embed' ),
2251 ),
2252 'date' => array(
2253- 'description' => __( "The date the object was published, in the site's timezone." ),
2254+ 'description' => _l( "The date the object was published, in the site's timezone." ),
2255 'type' => 'string',
2256 'format' => 'date-time',
2257 'context' => array( 'view', 'edit', 'embed' ),
2258 ),
2259 'date_gmt' => array(
2260- 'description' => __( 'The date the object was published, as GMT.' ),
2261+ 'description' => _l( 'The date the object was published, as GMT.' ),
2262 'type' => 'string',
2263 'format' => 'date-time',
2264 'context' => array( 'view', 'edit' ),
2265 ),
2266 'guid' => array(
2267- 'description' => __( 'GUID for the object, as it exists in the database.' ),
2268+ 'description' => _l( 'GUID for the object, as it exists in the database.' ),
2269 'type' => 'string',
2270 'context' => array( 'view', 'edit' ),
2271 ),
2272 'id' => array(
2273- 'description' => __( 'Unique identifier for the object.' ),
2274+ 'description' => _l( 'Unique identifier for the object.' ),
2275 'type' => 'integer',
2276 'context' => array( 'view', 'edit', 'embed' ),
2277 ),
2278 'modified' => array(
2279- 'description' => __( "The date the object was last modified, in the site's timezone." ),
2280+ 'description' => _l( "The date the object was last modified, in the site's timezone." ),
2281 'type' => 'string',
2282 'format' => 'date-time',
2283 'context' => array( 'view', 'edit' ),
2284 ),
2285 'modified_gmt' => array(
2286- 'description' => __( 'The date the object was last modified, as GMT.' ),
2287+ 'description' => _l( 'The date the object was last modified, as GMT.' ),
2288 'type' => 'string',
2289 'format' => 'date-time',
2290 'context' => array( 'view', 'edit' ),
2291 ),
2292 'parent' => array(
2293- 'description' => __( 'The ID for the parent of the object.' ),
2294+ 'description' => _l( 'The ID for the parent of the object.' ),
2295 'type' => 'integer',
2296 'context' => array( 'view', 'edit', 'embed' ),
2297 ),
2298 'slug' => array(
2299- 'description' => __( 'An alphanumeric identifier for the object unique to its type.' ),
2300+ 'description' => _l( 'An alphanumeric identifier for the object unique to its type.' ),
2301 'type' => 'string',
2302 'context' => array( 'view', 'edit', 'embed' ),
2303 ),
2304diff --git src/wp-includes/rest-api/endpoints/class-wp-rest-settings-controller.php src/wp-includes/rest-api/endpoints/class-wp-rest-settings-controller.php
2305index 57954f1b52..52e533a1a7 100644
2306--- src/wp-includes/rest-api/endpoints/class-wp-rest-settings-controller.php
2307+++ src/wp-includes/rest-api/endpoints/class-wp-rest-settings-controller.php
2308@@ -200,7 +200,7 @@ class WP_REST_Settings_Controller extends WP_REST_Controller {
2309 */
2310 if ( ! is_scalar( get_option( $args['option_name'], false ) ) ) {
2311 return new WP_Error(
2312- 'rest_invalid_stored_value', sprintf( __( 'The %s property has an invalid stored value, and cannot be updated to null.' ), $name ), array( 'status' => 500 )
2313+ 'rest_invalid_stored_value', sprintf( _l( 'The %s property has an invalid stored value, and cannot be updated to null.' ), $name ), array( 'status' => 500 )
2314 );
2315 }
2316
2317diff --git src/wp-includes/rest-api/endpoints/class-wp-rest-taxonomies-controller.php src/wp-includes/rest-api/endpoints/class-wp-rest-taxonomies-controller.php
2318index b46562c9c4..b4c23d1d12 100644
2319--- src/wp-includes/rest-api/endpoints/class-wp-rest-taxonomies-controller.php
2320+++ src/wp-includes/rest-api/endpoints/class-wp-rest-taxonomies-controller.php
2321@@ -50,7 +50,7 @@ class WP_REST_Taxonomies_Controller extends WP_REST_Controller {
2322 register_rest_route( $this->namespace, '/' . $this->rest_base . '/(?P<taxonomy>[\w-]+)', array(
2323 'args' => array(
2324 'taxonomy' => array(
2325- 'description' => __( 'An alphanumeric identifier for the taxonomy.' ),
2326+ 'description' => _l( 'An alphanumeric identifier for the taxonomy.' ),
2327 'type' => 'string',
2328 ),
2329 ),
2330@@ -87,7 +87,7 @@ class WP_REST_Taxonomies_Controller extends WP_REST_Controller {
2331 return true;
2332 }
2333 }
2334- return new WP_Error( 'rest_cannot_view', __( 'Sorry, you are not allowed to manage terms in this taxonomy.' ), array( 'status' => rest_authorization_required_code() ) );
2335+ return new WP_Error( 'rest_cannot_view', _l( 'Sorry, you are not allowed to manage terms in this taxonomy.' ), array( 'status' => rest_authorization_required_code() ) );
2336 }
2337 return true;
2338 }
2339@@ -147,7 +147,7 @@ class WP_REST_Taxonomies_Controller extends WP_REST_Controller {
2340 return false;
2341 }
2342 if ( 'edit' === $request['context'] && ! current_user_can( $tax_obj->cap->manage_terms ) ) {
2343- return new WP_Error( 'rest_forbidden_context', __( 'Sorry, you are not allowed to manage terms in this taxonomy.' ), array( 'status' => rest_authorization_required_code() ) );
2344+ return new WP_Error( 'rest_forbidden_context', _l( 'Sorry, you are not allowed to manage terms in this taxonomy.' ), array( 'status' => rest_authorization_required_code() ) );
2345 }
2346 }
2347
2348@@ -166,7 +166,7 @@ class WP_REST_Taxonomies_Controller extends WP_REST_Controller {
2349 public function get_item( $request ) {
2350 $tax_obj = get_taxonomy( $request['taxonomy'] );
2351 if ( empty( $tax_obj ) ) {
2352- return new WP_Error( 'rest_taxonomy_invalid', __( 'Invalid taxonomy.' ), array( 'status' => 404 ) );
2353+ return new WP_Error( 'rest_taxonomy_invalid', _l( 'Invalid taxonomy.' ), array( 'status' => 404 ) );
2354 }
2355 $data = $this->prepare_item_for_response( $tax_obj, $request );
2356 return rest_ensure_response( $data );
2357@@ -241,49 +241,49 @@ class WP_REST_Taxonomies_Controller extends WP_REST_Controller {
2358 'type' => 'object',
2359 'properties' => array(
2360 'capabilities' => array(
2361- 'description' => __( 'All capabilities used by the taxonomy.' ),
2362+ 'description' => _l( 'All capabilities used by the taxonomy.' ),
2363 'type' => 'object',
2364 'context' => array( 'edit' ),
2365 'readonly' => true,
2366 ),
2367 'description' => array(
2368- 'description' => __( 'A human-readable description of the taxonomy.' ),
2369+ 'description' => _l( 'A human-readable description of the taxonomy.' ),
2370 'type' => 'string',
2371 'context' => array( 'view', 'edit' ),
2372 'readonly' => true,
2373 ),
2374 'hierarchical' => array(
2375- 'description' => __( 'Whether or not the taxonomy should have children.' ),
2376+ 'description' => _l( 'Whether or not the taxonomy should have children.' ),
2377 'type' => 'boolean',
2378 'context' => array( 'view', 'edit' ),
2379 'readonly' => true,
2380 ),
2381 'labels' => array(
2382- 'description' => __( 'Human-readable labels for the taxonomy for various contexts.' ),
2383+ 'description' => _l( 'Human-readable labels for the taxonomy for various contexts.' ),
2384 'type' => 'object',
2385 'context' => array( 'edit' ),
2386 'readonly' => true,
2387 ),
2388 'name' => array(
2389- 'description' => __( 'The title for the taxonomy.' ),
2390+ 'description' => _l( 'The title for the taxonomy.' ),
2391 'type' => 'string',
2392 'context' => array( 'view', 'edit', 'embed' ),
2393 'readonly' => true,
2394 ),
2395 'slug' => array(
2396- 'description' => __( 'An alphanumeric identifier for the taxonomy.' ),
2397+ 'description' => _l( 'An alphanumeric identifier for the taxonomy.' ),
2398 'type' => 'string',
2399 'context' => array( 'view', 'edit', 'embed' ),
2400 'readonly' => true,
2401 ),
2402 'show_cloud' => array(
2403- 'description' => __( 'Whether or not the term cloud should be displayed.' ),
2404+ 'description' => _l( 'Whether or not the term cloud should be displayed.' ),
2405 'type' => 'boolean',
2406 'context' => array( 'edit' ),
2407 'readonly' => true,
2408 ),
2409 'types' => array(
2410- 'description' => __( 'Types associated with the taxonomy.' ),
2411+ 'description' => _l( 'Types associated with the taxonomy.' ),
2412 'type' => 'array',
2413 'items' => array(
2414 'type' => 'string',
2415@@ -292,7 +292,7 @@ class WP_REST_Taxonomies_Controller extends WP_REST_Controller {
2416 'readonly' => true,
2417 ),
2418 'rest_base' => array(
2419- 'description' => __( 'REST base route for the taxonomy.' ),
2420+ 'description' => _l( 'REST base route for the taxonomy.' ),
2421 'type' => 'string',
2422 'context' => array( 'view', 'edit', 'embed' ),
2423 'readonly' => true,
2424@@ -314,7 +314,7 @@ class WP_REST_Taxonomies_Controller extends WP_REST_Controller {
2425 $new_params = array();
2426 $new_params['context'] = $this->get_context_param( array( 'default' => 'view' ) );
2427 $new_params['type'] = array(
2428- 'description' => __( 'Limit results to taxonomies associated with a specific post type.' ),
2429+ 'description' => _l( 'Limit results to taxonomies associated with a specific post type.' ),
2430 'type' => 'string',
2431 );
2432 return $new_params;
2433diff --git src/wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php src/wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php
2434index 299b034329..f51b36c990 100644
2435--- src/wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php
2436+++ src/wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php
2437@@ -98,7 +98,7 @@ class WP_REST_Terms_Controller extends WP_REST_Controller {
2438 register_rest_route( $this->namespace, '/' . $this->rest_base . '/(?P<id>[\d]+)', array(
2439 'args' => array(
2440 'id' => array(
2441- 'description' => __( 'Unique identifier for the term.' ),
2442+ 'description' => _l( 'Unique identifier for the term.' ),
2443 'type' => 'integer',
2444 ),
2445 ),
2446@@ -124,7 +124,7 @@ class WP_REST_Terms_Controller extends WP_REST_Controller {
2447 'force' => array(
2448 'type' => 'boolean',
2449 'default' => false,
2450- 'description' => __( 'Required to be true, as terms do not support trashing.' ),
2451+ 'description' => _l( 'Required to be true, as terms do not support trashing.' ),
2452 ),
2453 ),
2454 ),
2455@@ -147,7 +147,7 @@ class WP_REST_Terms_Controller extends WP_REST_Controller {
2456 return false;
2457 }
2458 if ( 'edit' === $request['context'] && ! current_user_can( $tax_obj->cap->edit_terms ) ) {
2459- return new WP_Error( 'rest_forbidden_context', __( 'Sorry, you are not allowed to edit terms in this taxonomy.' ), array( 'status' => rest_authorization_required_code() ) );
2460+ return new WP_Error( 'rest_forbidden_context', _l( 'Sorry, you are not allowed to edit terms in this taxonomy.' ), array( 'status' => rest_authorization_required_code() ) );
2461 }
2462 return true;
2463 }
2464@@ -302,7 +302,7 @@ class WP_REST_Terms_Controller extends WP_REST_Controller {
2465 * @return WP_Term|WP_Error Term object if ID is valid, WP_Error otherwise.
2466 */
2467 protected function get_term( $id ) {
2468- $error = new WP_Error( 'rest_term_invalid', __( 'Term does not exist.' ), array( 'status' => 404 ) );
2469+ $error = new WP_Error( 'rest_term_invalid', _l( 'Term does not exist.' ), array( 'status' => 404 ) );
2470
2471 if ( ! $this->check_is_taxonomy_allowed( $this->taxonomy ) ) {
2472 return $error;
2473@@ -336,7 +336,7 @@ class WP_REST_Terms_Controller extends WP_REST_Controller {
2474 }
2475
2476 if ( 'edit' === $request['context'] && ! current_user_can( 'edit_term', $term->term_id ) ) {
2477- return new WP_Error( 'rest_forbidden_context', __( 'Sorry, you are not allowed to edit this term.' ), array( 'status' => rest_authorization_required_code() ) );
2478+ return new WP_Error( 'rest_forbidden_context', _l( 'Sorry, you are not allowed to edit this term.' ), array( 'status' => rest_authorization_required_code() ) );
2479 }
2480 return true;
2481 }
2482@@ -378,7 +378,7 @@ class WP_REST_Terms_Controller extends WP_REST_Controller {
2483
2484 $taxonomy_obj = get_taxonomy( $this->taxonomy );
2485 if ( ! current_user_can( $taxonomy_obj->cap->edit_terms ) ) {
2486- return new WP_Error( 'rest_cannot_create', __( 'Sorry, you are not allowed to create new terms.' ), array( 'status' => rest_authorization_required_code() ) );
2487+ return new WP_Error( 'rest_cannot_create', _l( 'Sorry, you are not allowed to create new terms.' ), array( 'status' => rest_authorization_required_code() ) );
2488 }
2489
2490 return true;
2491@@ -396,13 +396,13 @@ class WP_REST_Terms_Controller extends WP_REST_Controller {
2492 public function create_item( $request ) {
2493 if ( isset( $request['parent'] ) ) {
2494 if ( ! is_taxonomy_hierarchical( $this->taxonomy ) ) {
2495- return new WP_Error( 'rest_taxonomy_not_hierarchical', __( 'Cannot set parent term, taxonomy is not hierarchical.' ), array( 'status' => 400 ) );
2496+ return new WP_Error( 'rest_taxonomy_not_hierarchical', _l( 'Cannot set parent term, taxonomy is not hierarchical.' ), array( 'status' => 400 ) );
2497 }
2498
2499 $parent = get_term( (int) $request['parent'], $this->taxonomy );
2500
2501 if ( ! $parent ) {
2502- return new WP_Error( 'rest_term_invalid', __( 'Parent term does not exist.' ), array( 'status' => 400 ) );
2503+ return new WP_Error( 'rest_term_invalid', _l( 'Parent term does not exist.' ), array( 'status' => 400 ) );
2504 }
2505 }
2506
2507@@ -479,7 +479,7 @@ class WP_REST_Terms_Controller extends WP_REST_Controller {
2508 }
2509
2510 if ( ! current_user_can( 'edit_term', $term->term_id ) ) {
2511- return new WP_Error( 'rest_cannot_update', __( 'Sorry, you are not allowed to edit this term.' ), array( 'status' => rest_authorization_required_code() ) );
2512+ return new WP_Error( 'rest_cannot_update', _l( 'Sorry, you are not allowed to edit this term.' ), array( 'status' => rest_authorization_required_code() ) );
2513 }
2514
2515 return true;
2516@@ -502,13 +502,13 @@ class WP_REST_Terms_Controller extends WP_REST_Controller {
2517
2518 if ( isset( $request['parent'] ) ) {
2519 if ( ! is_taxonomy_hierarchical( $this->taxonomy ) ) {
2520- return new WP_Error( 'rest_taxonomy_not_hierarchical', __( 'Cannot set parent term, taxonomy is not hierarchical.' ), array( 'status' => 400 ) );
2521+ return new WP_Error( 'rest_taxonomy_not_hierarchical', _l( 'Cannot set parent term, taxonomy is not hierarchical.' ), array( 'status' => 400 ) );
2522 }
2523
2524 $parent = get_term( (int) $request['parent'], $this->taxonomy );
2525
2526 if ( ! $parent ) {
2527- return new WP_Error( 'rest_term_invalid', __( 'Parent term does not exist.' ), array( 'status' => 400 ) );
2528+ return new WP_Error( 'rest_term_invalid', _l( 'Parent term does not exist.' ), array( 'status' => 400 ) );
2529 }
2530 }
2531
2532@@ -566,7 +566,7 @@ class WP_REST_Terms_Controller extends WP_REST_Controller {
2533 }
2534
2535 if ( ! current_user_can( 'delete_term', $term->term_id ) ) {
2536- return new WP_Error( 'rest_cannot_delete', __( 'Sorry, you are not allowed to delete this term.' ), array( 'status' => rest_authorization_required_code() ) );
2537+ return new WP_Error( 'rest_cannot_delete', _l( 'Sorry, you are not allowed to delete this term.' ), array( 'status' => rest_authorization_required_code() ) );
2538 }
2539
2540 return true;
2541@@ -591,7 +591,7 @@ class WP_REST_Terms_Controller extends WP_REST_Controller {
2542
2543 // We don't support trashing for terms.
2544 if ( ! $force ) {
2545- return new WP_Error( 'rest_trash_not_supported', __( 'Terms do not support trashing. Set force=true to delete.' ), array( 'status' => 501 ) );
2546+ return new WP_Error( 'rest_trash_not_supported', _l( 'Terms do not support trashing. Set force=true to delete.' ), array( 'status' => 501 ) );
2547 }
2548
2549 $request->set_param( 'context', 'view' );
2550@@ -601,7 +601,7 @@ class WP_REST_Terms_Controller extends WP_REST_Controller {
2551 $retval = wp_delete_term( $term->term_id, $term->taxonomy );
2552
2553 if ( ! $retval ) {
2554- return new WP_Error( 'rest_cannot_delete', __( 'The term cannot be deleted.' ), array( 'status' => 500 ) );
2555+ return new WP_Error( 'rest_cannot_delete', _l( 'The term cannot be deleted.' ), array( 'status' => 500 ) );
2556 }
2557
2558 $response = new WP_REST_Response();
2559@@ -828,31 +828,31 @@ class WP_REST_Terms_Controller extends WP_REST_Controller {
2560 'type' => 'object',
2561 'properties' => array(
2562 'id' => array(
2563- 'description' => __( 'Unique identifier for the term.' ),
2564+ 'description' => _l( 'Unique identifier for the term.' ),
2565 'type' => 'integer',
2566 'context' => array( 'view', 'embed', 'edit' ),
2567 'readonly' => true,
2568 ),
2569 'count' => array(
2570- 'description' => __( 'Number of published posts for the term.' ),
2571+ 'description' => _l( 'Number of published posts for the term.' ),
2572 'type' => 'integer',
2573 'context' => array( 'view', 'edit' ),
2574 'readonly' => true,
2575 ),
2576 'description' => array(
2577- 'description' => __( 'HTML description of the term.' ),
2578+ 'description' => _l( 'HTML description of the term.' ),
2579 'type' => 'string',
2580 'context' => array( 'view', 'edit' ),
2581 ),
2582 'link' => array(
2583- 'description' => __( 'URL of the term.' ),
2584+ 'description' => _l( 'URL of the term.' ),
2585 'type' => 'string',
2586 'format' => 'uri',
2587 'context' => array( 'view', 'embed', 'edit' ),
2588 'readonly' => true,
2589 ),
2590 'name' => array(
2591- 'description' => __( 'HTML title for the term.' ),
2592+ 'description' => _l( 'HTML title for the term.' ),
2593 'type' => 'string',
2594 'context' => array( 'view', 'embed', 'edit' ),
2595 'arg_options' => array(
2596@@ -861,7 +861,7 @@ class WP_REST_Terms_Controller extends WP_REST_Controller {
2597 'required' => true,
2598 ),
2599 'slug' => array(
2600- 'description' => __( 'An alphanumeric identifier for the term unique to its type.' ),
2601+ 'description' => _l( 'An alphanumeric identifier for the term unique to its type.' ),
2602 'type' => 'string',
2603 'context' => array( 'view', 'embed', 'edit' ),
2604 'arg_options' => array(
2605@@ -869,7 +869,7 @@ class WP_REST_Terms_Controller extends WP_REST_Controller {
2606 ),
2607 ),
2608 'taxonomy' => array(
2609- 'description' => __( 'Type attribution for the term.' ),
2610+ 'description' => _l( 'Type attribution for the term.' ),
2611 'type' => 'string',
2612 'enum' => array_keys( get_taxonomies() ),
2613 'context' => array( 'view', 'embed', 'edit' ),
2614@@ -882,7 +882,7 @@ class WP_REST_Terms_Controller extends WP_REST_Controller {
2615
2616 if ( $taxonomy->hierarchical ) {
2617 $schema['properties']['parent'] = array(
2618- 'description' => __( 'The parent term ID.' ),
2619+ 'description' => _l( 'The parent term ID.' ),
2620 'type' => 'integer',
2621 'context' => array( 'view', 'edit' ),
2622 );
2623@@ -908,7 +908,7 @@ class WP_REST_Terms_Controller extends WP_REST_Controller {
2624 $query_params['context']['default'] = 'view';
2625
2626 $query_params['exclude'] = array(
2627- 'description' => __( 'Ensure result set excludes specific IDs.' ),
2628+ 'description' => _l( 'Ensure result set excludes specific IDs.' ),
2629 'type' => 'array',
2630 'items' => array(
2631 'type' => 'integer',
2632@@ -917,7 +917,7 @@ class WP_REST_Terms_Controller extends WP_REST_Controller {
2633 );
2634
2635 $query_params['include'] = array(
2636- 'description' => __( 'Limit result set to specific IDs.' ),
2637+ 'description' => _l( 'Limit result set to specific IDs.' ),
2638 'type' => 'array',
2639 'items' => array(
2640 'type' => 'integer',
2641@@ -927,13 +927,13 @@ class WP_REST_Terms_Controller extends WP_REST_Controller {
2642
2643 if ( ! $taxonomy->hierarchical ) {
2644 $query_params['offset'] = array(
2645- 'description' => __( 'Offset the result set by a specific number of items.' ),
2646+ 'description' => _l( 'Offset the result set by a specific number of items.' ),
2647 'type' => 'integer',
2648 );
2649 }
2650
2651 $query_params['order'] = array(
2652- 'description' => __( 'Order sort attribute ascending or descending.' ),
2653+ 'description' => _l( 'Order sort attribute ascending or descending.' ),
2654 'type' => 'string',
2655 'default' => 'asc',
2656 'enum' => array(
2657@@ -943,7 +943,7 @@ class WP_REST_Terms_Controller extends WP_REST_Controller {
2658 );
2659
2660 $query_params['orderby'] = array(
2661- 'description' => __( 'Sort collection by term attribute.' ),
2662+ 'description' => _l( 'Sort collection by term attribute.' ),
2663 'type' => 'string',
2664 'default' => 'name',
2665 'enum' => array(
2666@@ -958,26 +958,26 @@ class WP_REST_Terms_Controller extends WP_REST_Controller {
2667 );
2668
2669 $query_params['hide_empty'] = array(
2670- 'description' => __( 'Whether to hide terms not assigned to any posts.' ),
2671+ 'description' => _l( 'Whether to hide terms not assigned to any posts.' ),
2672 'type' => 'boolean',
2673 'default' => false,
2674 );
2675
2676 if ( $taxonomy->hierarchical ) {
2677 $query_params['parent'] = array(
2678- 'description' => __( 'Limit result set to terms assigned to a specific parent.' ),
2679+ 'description' => _l( 'Limit result set to terms assigned to a specific parent.' ),
2680 'type' => 'integer',
2681 );
2682 }
2683
2684 $query_params['post'] = array(
2685- 'description' => __( 'Limit result set to terms assigned to a specific post.' ),
2686+ 'description' => _l( 'Limit result set to terms assigned to a specific post.' ),
2687 'type' => 'integer',
2688 'default' => null,
2689 );
2690
2691 $query_params['slug'] = array(
2692- 'description' => __( 'Limit result set to terms with one or more specific slugs.' ),
2693+ 'description' => _l( 'Limit result set to terms with one or more specific slugs.' ),
2694 'type' => 'array',
2695 'items' => array(
2696 'type' => 'string'
2697diff --git src/wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php src/wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php
2698index 63fb4e9e99..3976effbbd 100644
2699--- src/wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php
2700+++ src/wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php
2701@@ -67,7 +67,7 @@ class WP_REST_Users_Controller extends WP_REST_Controller {
2702 register_rest_route( $this->namespace, '/' . $this->rest_base . '/(?P<id>[\d]+)', array(
2703 'args' => array(
2704 'id' => array(
2705- 'description' => __( 'Unique identifier for the user.' ),
2706+ 'description' => _l( 'Unique identifier for the user.' ),
2707 'type' => 'integer',
2708 ),
2709 ),
2710@@ -93,11 +93,11 @@ class WP_REST_Users_Controller extends WP_REST_Controller {
2711 'force' => array(
2712 'type' => 'boolean',
2713 'default' => false,
2714- 'description' => __( 'Required to be true, as users do not support trashing.' ),
2715+ 'description' => _l( 'Required to be true, as users do not support trashing.' ),
2716 ),
2717 'reassign' => array(
2718 'type' => 'integer',
2719- 'description' => __( 'Reassign the deleted user\'s posts and links to this user ID.' ),
2720+ 'description' => _l( 'Reassign the deleted user\'s posts and links to this user ID.' ),
2721 'required' => true,
2722 'sanitize_callback' => array( $this, 'check_reassign' ),
2723 ),
2724@@ -128,11 +128,11 @@ class WP_REST_Users_Controller extends WP_REST_Controller {
2725 'force' => array(
2726 'type' => 'boolean',
2727 'default' => false,
2728- 'description' => __( 'Required to be true, as users do not support trashing.' ),
2729+ 'description' => _l( 'Required to be true, as users do not support trashing.' ),
2730 ),
2731 'reassign' => array(
2732 'type' => 'integer',
2733- 'description' => __( 'Reassign the deleted user\'s posts and links to this user ID.' ),
2734+ 'description' => _l( 'Reassign the deleted user\'s posts and links to this user ID.' ),
2735 'required' => true,
2736 'sanitize_callback' => array( $this, 'check_reassign' ),
2737 ),
2738@@ -165,7 +165,7 @@ class WP_REST_Users_Controller extends WP_REST_Controller {
2739 return false;
2740 }
2741
2742- return new WP_Error( 'rest_invalid_param', __( 'Invalid user parameter(s).' ), array( 'status' => 400 ) );
2743+ return new WP_Error( 'rest_invalid_param', _l( 'Invalid user parameter(s).' ), array( 'status' => 400 ) );
2744 }
2745
2746 /**
2747@@ -180,15 +180,15 @@ class WP_REST_Users_Controller extends WP_REST_Controller {
2748 public function get_items_permissions_check( $request ) {
2749 // Check if roles is specified in GET request and if user can list users.
2750 if ( ! empty( $request['roles'] ) && ! current_user_can( 'list_users' ) ) {
2751- return new WP_Error( 'rest_user_cannot_view', __( 'Sorry, you are not allowed to filter users by role.' ), array( 'status' => rest_authorization_required_code() ) );
2752+ return new WP_Error( 'rest_user_cannot_view', _l( 'Sorry, you are not allowed to filter users by role.' ), array( 'status' => rest_authorization_required_code() ) );
2753 }
2754
2755 if ( 'edit' === $request['context'] && ! current_user_can( 'list_users' ) ) {
2756- return new WP_Error( 'rest_forbidden_context', __( 'Sorry, you are not allowed to list users.' ), array( 'status' => rest_authorization_required_code() ) );
2757+ return new WP_Error( 'rest_forbidden_context', _l( 'Sorry, you are not allowed to list users.' ), array( 'status' => rest_authorization_required_code() ) );
2758 }
2759
2760 if ( in_array( $request['orderby'], array( 'email', 'registered_date' ), true ) && ! current_user_can( 'list_users' ) ) {
2761- return new WP_Error( 'rest_forbidden_orderby', __( 'Sorry, you are not allowed to order users by this parameter.' ), array( 'status' => rest_authorization_required_code() ) );
2762+ return new WP_Error( 'rest_forbidden_orderby', _l( 'Sorry, you are not allowed to order users by this parameter.' ), array( 'status' => rest_authorization_required_code() ) );
2763 }
2764
2765 return true;
2766@@ -336,7 +336,7 @@ class WP_REST_Users_Controller extends WP_REST_Controller {
2767 * @return WP_User|WP_Error True if ID is valid, WP_Error otherwise.
2768 */
2769 protected function get_user( $id ) {
2770- $error = new WP_Error( 'rest_user_invalid_id', __( 'Invalid user ID.' ), array( 'status' => 404 ) );
2771+ $error = new WP_Error( 'rest_user_invalid_id', _l( 'Invalid user ID.' ), array( 'status' => 404 ) );
2772 if ( (int) $id <= 0 ) {
2773 return $error;
2774 }
2775@@ -375,9 +375,9 @@ class WP_REST_Users_Controller extends WP_REST_Controller {
2776 }
2777
2778 if ( 'edit' === $request['context'] && ! current_user_can( 'list_users' ) ) {
2779- return new WP_Error( 'rest_user_cannot_view', __( 'Sorry, you are not allowed to list users.' ), array( 'status' => rest_authorization_required_code() ) );
2780+ return new WP_Error( 'rest_user_cannot_view', _l( 'Sorry, you are not allowed to list users.' ), array( 'status' => rest_authorization_required_code() ) );
2781 } elseif ( ! count_user_posts( $user->ID, $types ) && ! current_user_can( 'edit_user', $user->ID ) && ! current_user_can( 'list_users' ) ) {
2782- return new WP_Error( 'rest_user_cannot_view', __( 'Sorry, you are not allowed to list users.' ), array( 'status' => rest_authorization_required_code() ) );
2783+ return new WP_Error( 'rest_user_cannot_view', _l( 'Sorry, you are not allowed to list users.' ), array( 'status' => rest_authorization_required_code() ) );
2784 }
2785
2786 return true;
2787@@ -417,7 +417,7 @@ class WP_REST_Users_Controller extends WP_REST_Controller {
2788 $current_user_id = get_current_user_id();
2789
2790 if ( empty( $current_user_id ) ) {
2791- return new WP_Error( 'rest_not_logged_in', __( 'You are not currently logged in.' ), array( 'status' => 401 ) );
2792+ return new WP_Error( 'rest_not_logged_in', _l( 'You are not currently logged in.' ), array( 'status' => 401 ) );
2793 }
2794
2795 $user = wp_get_current_user();
2796@@ -440,7 +440,7 @@ class WP_REST_Users_Controller extends WP_REST_Controller {
2797 public function create_item_permissions_check( $request ) {
2798
2799 if ( ! current_user_can( 'create_users' ) ) {
2800- return new WP_Error( 'rest_cannot_create_user', __( 'Sorry, you are not allowed to create new users.' ), array( 'status' => rest_authorization_required_code() ) );
2801+ return new WP_Error( 'rest_cannot_create_user', _l( 'Sorry, you are not allowed to create new users.' ), array( 'status' => rest_authorization_required_code() ) );
2802 }
2803
2804 return true;
2805@@ -457,7 +457,7 @@ class WP_REST_Users_Controller extends WP_REST_Controller {
2806 */
2807 public function create_item( $request ) {
2808 if ( ! empty( $request['id'] ) ) {
2809- return new WP_Error( 'rest_user_exists', __( 'Cannot create existing user.' ), array( 'status' => 400 ) );
2810+ return new WP_Error( 'rest_user_exists', _l( 'Cannot create existing user.' ), array( 'status' => 400 ) );
2811 }
2812
2813 $schema = $this->get_item_schema();
2814@@ -476,7 +476,7 @@ class WP_REST_Users_Controller extends WP_REST_Controller {
2815 $ret = wpmu_validate_user_signup( $user->user_login, $user->user_email );
2816
2817 if ( is_wp_error( $ret['errors'] ) && ! empty( $ret['errors']->errors ) ) {
2818- $error = new WP_Error( 'rest_invalid_param', __( 'Invalid user parameter(s).' ), array( 'status' => 400 ) );
2819+ $error = new WP_Error( 'rest_invalid_param', _l( 'Invalid user parameter(s).' ), array( 'status' => 400 ) );
2820 foreach ( $ret['errors']->errors as $code => $messages ) {
2821 foreach ( $messages as $message ) {
2822 $error->add( $code, $message );
2823@@ -493,7 +493,7 @@ class WP_REST_Users_Controller extends WP_REST_Controller {
2824 $user_id = wpmu_create_user( $user->user_login, $user->user_pass, $user->user_email );
2825
2826 if ( ! $user_id ) {
2827- return new WP_Error( 'rest_user_create', __( 'Error creating new user.' ), array( 'status' => 500 ) );
2828+ return new WP_Error( 'rest_user_create', _l( 'Error creating new user.' ), array( 'status' => 500 ) );
2829 }
2830
2831 $user->ID = $user_id;
2832@@ -571,11 +571,11 @@ class WP_REST_Users_Controller extends WP_REST_Controller {
2833 }
2834
2835 if ( ! current_user_can( 'edit_user', $user->ID ) ) {
2836- return new WP_Error( 'rest_cannot_edit', __( 'Sorry, you are not allowed to edit this user.' ), array( 'status' => rest_authorization_required_code() ) );
2837+ return new WP_Error( 'rest_cannot_edit', _l( 'Sorry, you are not allowed to edit this user.' ), array( 'status' => rest_authorization_required_code() ) );
2838 }
2839
2840 if ( ! empty( $request['roles'] ) && ! current_user_can( 'edit_users' ) ) {
2841- return new WP_Error( 'rest_cannot_edit_roles', __( 'Sorry, you are not allowed to edit roles of this user.' ), array( 'status' => rest_authorization_required_code() ) );
2842+ return new WP_Error( 'rest_cannot_edit_roles', _l( 'Sorry, you are not allowed to edit roles of this user.' ), array( 'status' => rest_authorization_required_code() ) );
2843 }
2844
2845 return true;
2846@@ -599,19 +599,19 @@ class WP_REST_Users_Controller extends WP_REST_Controller {
2847 $id = $user->ID;
2848
2849 if ( ! $user ) {
2850- return new WP_Error( 'rest_user_invalid_id', __( 'Invalid user ID.' ), array( 'status' => 404 ) );
2851+ return new WP_Error( 'rest_user_invalid_id', _l( 'Invalid user ID.' ), array( 'status' => 404 ) );
2852 }
2853
2854 if ( email_exists( $request['email'] ) && $request['email'] !== $user->user_email ) {
2855- return new WP_Error( 'rest_user_invalid_email', __( 'Invalid email address.' ), array( 'status' => 400 ) );
2856+ return new WP_Error( 'rest_user_invalid_email', _l( 'Invalid email address.' ), array( 'status' => 400 ) );
2857 }
2858
2859 if ( ! empty( $request['username'] ) && $request['username'] !== $user->user_login ) {
2860- return new WP_Error( 'rest_user_invalid_argument', __( "Username isn't editable." ), array( 'status' => 400 ) );
2861+ return new WP_Error( 'rest_user_invalid_argument', _l( "Username isn't editable." ), array( 'status' => 400 ) );
2862 }
2863
2864 if ( ! empty( $request['slug'] ) && $request['slug'] !== $user->user_nicename && get_user_by( 'slug', $request['slug'] ) ) {
2865- return new WP_Error( 'rest_user_invalid_slug', __( 'Invalid slug.' ), array( 'status' => 400 ) );
2866+ return new WP_Error( 'rest_user_invalid_slug', _l( 'Invalid slug.' ), array( 'status' => 400 ) );
2867 }
2868
2869 if ( ! empty( $request['roles'] ) ) {
2870@@ -713,7 +713,7 @@ class WP_REST_Users_Controller extends WP_REST_Controller {
2871 }
2872
2873 if ( ! current_user_can( 'delete_user', $user->ID ) ) {
2874- return new WP_Error( 'rest_user_cannot_delete', __( 'Sorry, you are not allowed to delete this user.' ), array( 'status' => rest_authorization_required_code() ) );
2875+ return new WP_Error( 'rest_user_cannot_delete', _l( 'Sorry, you are not allowed to delete this user.' ), array( 'status' => rest_authorization_required_code() ) );
2876 }
2877
2878 return true;
2879@@ -731,7 +731,7 @@ class WP_REST_Users_Controller extends WP_REST_Controller {
2880 public function delete_item( $request ) {
2881 // We don't support delete requests in multisite.
2882 if ( is_multisite() ) {
2883- return new WP_Error( 'rest_cannot_delete', __( 'The user cannot be deleted.' ), array( 'status' => 501 ) );
2884+ return new WP_Error( 'rest_cannot_delete', _l( 'The user cannot be deleted.' ), array( 'status' => 501 ) );
2885 }
2886 $user = $this->get_user( $request['id'] );
2887 if ( is_wp_error( $user ) ) {
2888@@ -744,12 +744,12 @@ class WP_REST_Users_Controller extends WP_REST_Controller {
2889
2890 // We don't support trashing for users.
2891 if ( ! $force ) {
2892- return new WP_Error( 'rest_trash_not_supported', __( 'Users do not support trashing. Set force=true to delete.' ), array( 'status' => 501 ) );
2893+ return new WP_Error( 'rest_trash_not_supported', _l( 'Users do not support trashing. Set force=true to delete.' ), array( 'status' => 501 ) );
2894 }
2895
2896 if ( ! empty( $reassign ) ) {
2897 if ( $reassign === $id || ! get_userdata( $reassign ) ) {
2898- return new WP_Error( 'rest_user_invalid_reassign', __( 'Invalid user ID for reassignment.' ), array( 'status' => 400 ) );
2899+ return new WP_Error( 'rest_user_invalid_reassign', _l( 'Invalid user ID for reassignment.' ), array( 'status' => 400 ) );
2900 }
2901 }
2902
2903@@ -763,7 +763,7 @@ class WP_REST_Users_Controller extends WP_REST_Controller {
2904 $result = wp_delete_user( $id, $reassign );
2905
2906 if ( ! $result ) {
2907- return new WP_Error( 'rest_cannot_delete', __( 'The user cannot be deleted.' ), array( 'status' => 500 ) );
2908+ return new WP_Error( 'rest_cannot_delete', _l( 'The user cannot be deleted.' ), array( 'status' => 500 ) );
2909 }
2910
2911 $response = new WP_REST_Response();
2912@@ -1043,7 +1043,7 @@ class WP_REST_Users_Controller extends WP_REST_Controller {
2913
2914 if ( ! isset( $wp_roles->role_objects[ $role ] ) ) {
2915 /* translators: %s: role key */
2916- return new WP_Error( 'rest_user_invalid_role', sprintf( __( 'The role %s does not exist.' ), $role ), array( 'status' => 400 ) );
2917+ return new WP_Error( 'rest_user_invalid_role', sprintf( _l( 'The role %s does not exist.' ), $role ), array( 'status' => 400 ) );
2918 }
2919
2920 $potential_role = $wp_roles->role_objects[ $role ];
2921@@ -1057,7 +1057,7 @@ class WP_REST_Users_Controller extends WP_REST_Controller {
2922 && get_current_user_id() === $user_id
2923 && ! $potential_role->has_cap( 'edit_users' )
2924 ) {
2925- return new WP_Error( 'rest_user_invalid_role', __( 'Sorry, you are not allowed to give users that role.' ), array( 'status' => rest_authorization_required_code() ) );
2926+ return new WP_Error( 'rest_user_invalid_role', _l( 'Sorry, you are not allowed to give users that role.' ), array( 'status' => rest_authorization_required_code() ) );
2927 }
2928
2929 /** Include admin functions to get access to get_editable_roles() */
2930@@ -1067,7 +1067,7 @@ class WP_REST_Users_Controller extends WP_REST_Controller {
2931 $editable_roles = get_editable_roles();
2932
2933 if ( empty( $editable_roles[ $role ] ) ) {
2934- return new WP_Error( 'rest_user_invalid_role', __( 'Sorry, you are not allowed to give users that role.' ), array( 'status' => 403 ) );
2935+ return new WP_Error( 'rest_user_invalid_role', _l( 'Sorry, you are not allowed to give users that role.' ), array( 'status' => 403 ) );
2936 }
2937 }
2938
2939@@ -1091,14 +1091,14 @@ class WP_REST_Users_Controller extends WP_REST_Controller {
2940 $username = (string) $value;
2941
2942 if ( ! validate_username( $username ) ) {
2943- return new WP_Error( 'rest_user_invalid_username', __( 'Username contains invalid characters.' ), array( 'status' => 400 ) );
2944+ return new WP_Error( 'rest_user_invalid_username', _l( 'Username contains invalid characters.' ), array( 'status' => 400 ) );
2945 }
2946
2947 /** This filter is documented in wp-includes/user.php */
2948 $illegal_logins = (array) apply_filters( 'illegal_user_logins', array() );
2949
2950 if ( in_array( strtolower( $username ), array_map( 'strtolower', $illegal_logins ) ) ) {
2951- return new WP_Error( 'rest_user_invalid_username', __( 'Sorry, that username is not allowed.' ), array( 'status' => 400 ) );
2952+ return new WP_Error( 'rest_user_invalid_username', _l( 'Sorry, that username is not allowed.' ), array( 'status' => 400 ) );
2953 }
2954
2955 return $username;
2956@@ -1121,11 +1121,11 @@ class WP_REST_Users_Controller extends WP_REST_Controller {
2957 $password = (string) $value;
2958
2959 if ( empty( $password ) ) {
2960- return new WP_Error( 'rest_user_invalid_password', __( 'Passwords cannot be empty.' ), array( 'status' => 400 ) );
2961+ return new WP_Error( 'rest_user_invalid_password', _l( 'Passwords cannot be empty.' ), array( 'status' => 400 ) );
2962 }
2963
2964 if ( false !== strpos( $password, "\\" ) ) {
2965- return new WP_Error( 'rest_user_invalid_password', __( 'Passwords cannot contain the "\\" character.' ), array( 'status' => 400 ) );
2966+ return new WP_Error( 'rest_user_invalid_password', _l( 'Passwords cannot contain the "\\" character.' ), array( 'status' => 400 ) );
2967 }
2968
2969 return $password;
2970@@ -1146,13 +1146,13 @@ class WP_REST_Users_Controller extends WP_REST_Controller {
2971 'type' => 'object',
2972 'properties' => array(
2973 'id' => array(
2974- 'description' => __( 'Unique identifier for the user.' ),
2975+ 'description' => _l( 'Unique identifier for the user.' ),
2976 'type' => 'integer',
2977 'context' => array( 'embed', 'view', 'edit' ),
2978 'readonly' => true,
2979 ),
2980 'username' => array(
2981- 'description' => __( 'Login name for the user.' ),
2982+ 'description' => _l( 'Login name for the user.' ),
2983 'type' => 'string',
2984 'context' => array( 'edit' ),
2985 'required' => true,
2986@@ -1161,7 +1161,7 @@ class WP_REST_Users_Controller extends WP_REST_Controller {
2987 ),
2988 ),
2989 'name' => array(
2990- 'description' => __( 'Display name for the user.' ),
2991+ 'description' => _l( 'Display name for the user.' ),
2992 'type' => 'string',
2993 'context' => array( 'embed', 'view', 'edit' ),
2994 'arg_options' => array(
2995@@ -1169,7 +1169,7 @@ class WP_REST_Users_Controller extends WP_REST_Controller {
2996 ),
2997 ),
2998 'first_name' => array(
2999- 'description' => __( 'First name for the user.' ),
3000+ 'description' => _l( 'First name for the user.' ),
3001 'type' => 'string',
3002 'context' => array( 'edit' ),
3003 'arg_options' => array(
3004@@ -1177,7 +1177,7 @@ class WP_REST_Users_Controller extends WP_REST_Controller {
3005 ),
3006 ),
3007 'last_name' => array(
3008- 'description' => __( 'Last name for the user.' ),
3009+ 'description' => _l( 'Last name for the user.' ),
3010 'type' => 'string',
3011 'context' => array( 'edit' ),
3012 'arg_options' => array(
3013@@ -1185,38 +1185,38 @@ class WP_REST_Users_Controller extends WP_REST_Controller {
3014 ),
3015 ),
3016 'email' => array(
3017- 'description' => __( 'The email address for the user.' ),
3018+ 'description' => _l( 'The email address for the user.' ),
3019 'type' => 'string',
3020 'format' => 'email',
3021 'context' => array( 'edit' ),
3022 'required' => true,
3023 ),
3024 'url' => array(
3025- 'description' => __( 'URL of the user.' ),
3026+ 'description' => _l( 'URL of the user.' ),
3027 'type' => 'string',
3028 'format' => 'uri',
3029 'context' => array( 'embed', 'view', 'edit' ),
3030 ),
3031 'description' => array(
3032- 'description' => __( 'Description of the user.' ),
3033+ 'description' => _l( 'Description of the user.' ),
3034 'type' => 'string',
3035 'context' => array( 'embed', 'view', 'edit' ),
3036 ),
3037 'link' => array(
3038- 'description' => __( 'Author URL of the user.' ),
3039+ 'description' => _l( 'Author URL of the user.' ),
3040 'type' => 'string',
3041 'format' => 'uri',
3042 'context' => array( 'embed', 'view', 'edit' ),
3043 'readonly' => true,
3044 ),
3045 'locale' => array(
3046- 'description' => __( 'Locale for the user.' ),
3047+ 'description' => _l( 'Locale for the user.' ),
3048 'type' => 'string',
3049 'enum' => array_merge( array( '', 'en_US' ), get_available_languages() ),
3050 'context' => array( 'edit' ),
3051 ),
3052 'nickname' => array(
3053- 'description' => __( 'The nickname for the user.' ),
3054+ 'description' => _l( 'The nickname for the user.' ),
3055 'type' => 'string',
3056 'context' => array( 'edit' ),
3057 'arg_options' => array(
3058@@ -1224,7 +1224,7 @@ class WP_REST_Users_Controller extends WP_REST_Controller {
3059 ),
3060 ),
3061 'slug' => array(
3062- 'description' => __( 'An alphanumeric identifier for the user.' ),
3063+ 'description' => _l( 'An alphanumeric identifier for the user.' ),
3064 'type' => 'string',
3065 'context' => array( 'embed', 'view', 'edit' ),
3066 'arg_options' => array(
3067@@ -1232,14 +1232,14 @@ class WP_REST_Users_Controller extends WP_REST_Controller {
3068 ),
3069 ),
3070 'registered_date' => array(
3071- 'description' => __( 'Registration date for the user.' ),
3072+ 'description' => _l( 'Registration date for the user.' ),
3073 'type' => 'string',
3074 'format' => 'date-time',
3075 'context' => array( 'edit' ),
3076 'readonly' => true,
3077 ),
3078 'roles' => array(
3079- 'description' => __( 'Roles assigned to the user.' ),
3080+ 'description' => _l( 'Roles assigned to the user.' ),
3081 'type' => 'array',
3082 'items' => array(
3083 'type' => 'string',
3084@@ -1247,7 +1247,7 @@ class WP_REST_Users_Controller extends WP_REST_Controller {
3085 'context' => array( 'edit' ),
3086 ),
3087 'password' => array(
3088- 'description' => __( 'Password for the user (never included).' ),
3089+ 'description' => _l( 'Password for the user (never included).' ),
3090 'type' => 'string',
3091 'context' => array(), // Password is never displayed.
3092 'required' => true,
3093@@ -1256,13 +1256,13 @@ class WP_REST_Users_Controller extends WP_REST_Controller {
3094 ),
3095 ),
3096 'capabilities' => array(
3097- 'description' => __( 'All capabilities assigned to the user.' ),
3098+ 'description' => _l( 'All capabilities assigned to the user.' ),
3099 'type' => 'object',
3100 'context' => array( 'edit' ),
3101 'readonly' => true,
3102 ),
3103 'extra_capabilities' => array(
3104- 'description' => __( 'Any extra capabilities assigned to the user.' ),
3105+ 'description' => _l( 'Any extra capabilities assigned to the user.' ),
3106 'type' => 'object',
3107 'context' => array( 'edit' ),
3108 'readonly' => true,
3109@@ -1278,7 +1278,7 @@ class WP_REST_Users_Controller extends WP_REST_Controller {
3110 foreach ( $avatar_sizes as $size ) {
3111 $avatar_properties[ $size ] = array(
3112 /* translators: %d: avatar image size in pixels */
3113- 'description' => sprintf( __( 'Avatar URL with image size of %d pixels.' ), $size ),
3114+ 'description' => sprintf( _l( 'Avatar URL with image size of %d pixels.' ), $size ),
3115 'type' => 'string',
3116 'format' => 'uri',
3117 'context' => array( 'embed', 'view', 'edit' ),
3118@@ -1286,7 +1286,7 @@ class WP_REST_Users_Controller extends WP_REST_Controller {
3119 }
3120
3121 $schema['properties']['avatar_urls'] = array(
3122- 'description' => __( 'Avatar URLs for the user.' ),
3123+ 'description' => _l( 'Avatar URLs for the user.' ),
3124 'type' => 'object',
3125 'context' => array( 'embed', 'view', 'edit' ),
3126 'readonly' => true,
3127@@ -1313,7 +1313,7 @@ class WP_REST_Users_Controller extends WP_REST_Controller {
3128 $query_params['context']['default'] = 'view';
3129
3130 $query_params['exclude'] = array(
3131- 'description' => __( 'Ensure result set excludes specific IDs.' ),
3132+ 'description' => _l( 'Ensure result set excludes specific IDs.' ),
3133 'type' => 'array',
3134 'items' => array(
3135 'type' => 'integer',
3136@@ -1322,7 +1322,7 @@ class WP_REST_Users_Controller extends WP_REST_Controller {
3137 );
3138
3139 $query_params['include'] = array(
3140- 'description' => __( 'Limit result set to specific IDs.' ),
3141+ 'description' => _l( 'Limit result set to specific IDs.' ),
3142 'type' => 'array',
3143 'items' => array(
3144 'type' => 'integer',
3145@@ -1331,20 +1331,20 @@ class WP_REST_Users_Controller extends WP_REST_Controller {
3146 );
3147
3148 $query_params['offset'] = array(
3149- 'description' => __( 'Offset the result set by a specific number of items.' ),
3150+ 'description' => _l( 'Offset the result set by a specific number of items.' ),
3151 'type' => 'integer',
3152 );
3153
3154 $query_params['order'] = array(
3155 'default' => 'asc',
3156- 'description' => __( 'Order sort attribute ascending or descending.' ),
3157+ 'description' => _l( 'Order sort attribute ascending or descending.' ),
3158 'enum' => array( 'asc', 'desc' ),
3159 'type' => 'string',
3160 );
3161
3162 $query_params['orderby'] = array(
3163 'default' => 'name',
3164- 'description' => __( 'Sort collection by object attribute.' ),
3165+ 'description' => _l( 'Sort collection by object attribute.' ),
3166 'enum' => array(
3167 'id',
3168 'include',
3169@@ -1358,7 +1358,7 @@ class WP_REST_Users_Controller extends WP_REST_Controller {
3170 );
3171
3172 $query_params['slug'] = array(
3173- 'description' => __( 'Limit result set to users with one or more specific slugs.' ),
3174+ 'description' => _l( 'Limit result set to users with one or more specific slugs.' ),
3175 'type' => 'array',
3176 'items' => array(
3177 'type' => 'string',
3178@@ -1366,7 +1366,7 @@ class WP_REST_Users_Controller extends WP_REST_Controller {
3179 );
3180
3181 $query_params['roles'] = array(
3182- 'description' => __( 'Limit result set to users matching at least one specific role provided. Accepts csv list or single role.' ),
3183+ 'description' => _l( 'Limit result set to users matching at least one specific role provided. Accepts csv list or single role.' ),
3184 'type' => 'array',
3185 'items' => array(
3186 'type' => 'string',
3187diff --git src/wp-includes/rest-api/fields/class-wp-rest-meta-fields.php src/wp-includes/rest-api/fields/class-wp-rest-meta-fields.php
3188index eaf70a5781..2b44d89f71 100644
3189--- src/wp-includes/rest-api/fields/class-wp-rest-meta-fields.php
3190+++ src/wp-includes/rest-api/fields/class-wp-rest-meta-fields.php
3191@@ -180,7 +180,7 @@ abstract class WP_REST_Meta_Fields {
3192 return new WP_Error(
3193 'rest_cannot_delete',
3194 /* translators: %s: custom field key */
3195- sprintf( __( 'Sorry, you are not allowed to edit the %s custom field.' ), $name ),
3196+ sprintf( _l( 'Sorry, you are not allowed to edit the %s custom field.' ), $name ),
3197 array( 'key' => $name, 'status' => rest_authorization_required_code() )
3198 );
3199 }
3200@@ -188,7 +188,7 @@ abstract class WP_REST_Meta_Fields {
3201 if ( ! delete_metadata( $meta_type, $object_id, wp_slash( $meta_key ) ) ) {
3202 return new WP_Error(
3203 'rest_meta_database_error',
3204- __( 'Could not delete meta value from database.' ),
3205+ _l( 'Could not delete meta value from database.' ),
3206 array( 'key' => $name, 'status' => WP_Http::INTERNAL_SERVER_ERROR )
3207 );
3208 }
3209@@ -216,7 +216,7 @@ abstract class WP_REST_Meta_Fields {
3210 return new WP_Error(
3211 'rest_cannot_update',
3212 /* translators: %s: custom field key */
3213- sprintf( __( 'Sorry, you are not allowed to edit the %s custom field.' ), $name ),
3214+ sprintf( _l( 'Sorry, you are not allowed to edit the %s custom field.' ), $name ),
3215 array( 'key' => $name, 'status' => rest_authorization_required_code() )
3216 );
3217 }
3218@@ -251,7 +251,7 @@ abstract class WP_REST_Meta_Fields {
3219 if ( ! delete_metadata( $meta_type, $object_id, wp_slash( $meta_key ), wp_slash( $value ) ) ) {
3220 return new WP_Error(
3221 'rest_meta_database_error',
3222- __( 'Could not update meta value in database.' ),
3223+ _l( 'Could not update meta value in database.' ),
3224 array( 'key' => $name, 'status' => WP_Http::INTERNAL_SERVER_ERROR )
3225 );
3226 }
3227@@ -261,7 +261,7 @@ abstract class WP_REST_Meta_Fields {
3228 if ( ! add_metadata( $meta_type, $object_id, wp_slash( $meta_key ), wp_slash( $value ) ) ) {
3229 return new WP_Error(
3230 'rest_meta_database_error',
3231- __( 'Could not update meta value in database.' ),
3232+ _l( 'Could not update meta value in database.' ),
3233 array( 'key' => $name, 'status' => WP_Http::INTERNAL_SERVER_ERROR )
3234 );
3235 }
3236@@ -288,7 +288,7 @@ abstract class WP_REST_Meta_Fields {
3237 return new WP_Error(
3238 'rest_cannot_update',
3239 /* translators: %s: custom field key */
3240- sprintf( __( 'Sorry, you are not allowed to edit the %s custom field.' ), $name ),
3241+ sprintf( _l( 'Sorry, you are not allowed to edit the %s custom field.' ), $name ),
3242 array( 'key' => $name, 'status' => rest_authorization_required_code() )
3243 );
3244 }
3245@@ -308,7 +308,7 @@ abstract class WP_REST_Meta_Fields {
3246 if ( ! update_metadata( $meta_type, $object_id, $meta_key, $meta_value ) ) {
3247 return new WP_Error(
3248 'rest_meta_database_error',
3249- __( 'Could not update meta value in database.' ),
3250+ _l( 'Could not update meta value in database.' ),
3251 array( 'key' => $name, 'status' => WP_Http::INTERNAL_SERVER_ERROR )
3252 );
3253 }
3254@@ -387,7 +387,7 @@ abstract class WP_REST_Meta_Fields {
3255 $fields = $this->get_registered_fields();
3256
3257 $schema = array(
3258- 'description' => __( 'Meta fields.' ),
3259+ 'description' => _l( 'Meta fields.' ),
3260 'type' => 'object',
3261 'context' => array( 'view', 'edit' ),
3262 'properties' => array(),
3263diff --git tests/phpunit/tests/rest-api/rest-users-controller.php tests/phpunit/tests/rest-api/rest-users-controller.php
3264index 30246932bf..68bca079f6 100644
3265--- tests/phpunit/tests/rest-api/rest-users-controller.php
3266+++ tests/phpunit/tests/rest-api/rest-users-controller.php
3267@@ -948,7 +948,6 @@ class WP_Test_REST_Users_Controller extends WP_Test_REST_Controller_Testcase {
3268 } else {
3269 $this->assertInternalType( 'array', $data['data']['params'] );
3270 $errors = $data['data']['params'];
3271- $this->assertInternalType( 'string', $errors['username'] );
3272 $this->assertEquals( 'Username contains invalid characters.', $errors['username'] );
3273 }
3274 }
3275@@ -988,7 +987,6 @@ class WP_Test_REST_Users_Controller extends WP_Test_REST_Controller_Testcase {
3276 $data = $response->get_data();
3277 $this->assertInternalType( 'array', $data['data']['params'] );
3278 $errors = $data['data']['params'];
3279- $this->assertInternalType( 'string', $errors['username'] );
3280 $this->assertEquals( 'Sorry, that username is not allowed.', $errors['username'] );
3281 }
3282