Merge pull request #11534 from woothemes/localization-tweaks

Localization tweaks
This commit is contained in:
Mike Jolley 2016-07-26 15:29:02 +01:00 committed by GitHub
commit 4775cec578
10 changed files with 35 additions and 35 deletions

View File

@ -152,7 +152,7 @@ abstract class WC_REST_Posts_Controller extends WC_REST_Controller {
$post = get_post( $id );
if ( empty( $id ) || empty( $post->ID ) || ! in_array( $post->post_type, $this->get_post_types() ) ) {
return new WP_Error( "woocommerce_rest_invalid_{$this->post_type}_id", __( 'Invalid id.', 'woocommerce' ), array( 'status' => 404 ) );
return new WP_Error( "woocommerce_rest_invalid_{$this->post_type}_id", __( 'Invalid ID.', 'woocommerce' ), array( 'status' => 404 ) );
}
$data = $this->prepare_item_for_response( $post, $request );
@ -622,7 +622,7 @@ abstract class WC_REST_Posts_Controller extends WC_REST_Controller {
'validate_callback' => 'rest_validate_request_arg',
);
$params['exclude'] = array(
'description' => __( 'Ensure result set excludes specific ids.', 'woocommerce' ),
'description' => __( 'Ensure result set excludes specific IDs.', 'woocommerce' ),
'type' => 'array',
'default' => array(),
'sanitize_callback' => 'wp_parse_id_list',
@ -663,13 +663,13 @@ abstract class WC_REST_Posts_Controller extends WC_REST_Controller {
$post_type_obj = get_post_type_object( $this->post_type );
if ( isset( $post_type_obj->hierarchical ) && $post_type_obj->hierarchical ) {
$params['parent'] = array(
'description' => __( 'Limit result set to those of particular parent ids.', 'woocommerce' ),
'description' => __( 'Limit result set to those of particular parent IDs.', 'woocommerce' ),
'type' => 'array',
'sanitize_callback' => 'wp_parse_id_list',
'default' => array(),
);
$params['parent_exclude'] = array(
'description' => __( 'Limit result set to all items except those of a particular parent id.', 'woocommerce' ),
'description' => __( 'Limit result set to all items except those of a particular parent ID.', 'woocommerce' ),
'type' => 'array',
'sanitize_callback' => 'wp_parse_id_list',
'default' => array(),

View File

@ -111,7 +111,7 @@ class WC_Settings_Accounts extends WC_Settings_Page {
array(
'title' => __( 'Orders', 'woocommerce' ),
'desc' => __( 'Endpoint for the My Account → Orders page', 'woocommerce' ),
'desc' => sprintf( __( 'Endpoint for the My Account → %s page', 'woocommerce' ), __( 'Orders', 'woocommerce' ) ),
'id' => 'woocommerce_myaccount_orders_endpoint',
'type' => 'text',
'default' => 'orders',
@ -120,7 +120,7 @@ class WC_Settings_Accounts extends WC_Settings_Page {
array(
'title' => __( 'View Order', 'woocommerce' ),
'desc' => __( 'Endpoint for the My Account → View Order page', 'woocommerce' ),
'desc' => sprintf( __( 'Endpoint for the My Account → %s page', 'woocommerce' ), __( 'View Order', 'woocommerce' ) ),
'id' => 'woocommerce_myaccount_view_order_endpoint',
'type' => 'text',
'default' => 'view-order',
@ -129,7 +129,7 @@ class WC_Settings_Accounts extends WC_Settings_Page {
array(
'title' => __( 'Downloads', 'woocommerce' ),
'desc' => __( 'Endpoint for the My Account → Downloads page', 'woocommerce' ),
'desc' => sprintf( __( 'Endpoint for the My Account → %s page', 'woocommerce' ), __( 'Downloads', 'woocommerce' ) ),
'id' => 'woocommerce_myaccount_downloads_endpoint',
'type' => 'text',
'default' => 'downloads',
@ -138,7 +138,7 @@ class WC_Settings_Accounts extends WC_Settings_Page {
array(
'title' => __( 'Edit Account', 'woocommerce' ),
'desc' => __( 'Endpoint for the My Account → Edit Account page', 'woocommerce' ),
'desc' => sprintf( __( 'Endpoint for the My Account → %s page', 'woocommerce' ), __( 'Edit Account', 'woocommerce' ) ),
'id' => 'woocommerce_myaccount_edit_account_endpoint',
'type' => 'text',
'default' => 'edit-account',
@ -147,7 +147,7 @@ class WC_Settings_Accounts extends WC_Settings_Page {
array(
'title' => __( 'Addresses', 'woocommerce' ),
'desc' => __( 'Endpoint for the My Account → Addresses page', 'woocommerce' ),
'desc' => sprintf( __( 'Endpoint for the My Account → %s page', 'woocommerce' ), __( 'Addresses', 'woocommerce' ) ),
'id' => 'woocommerce_myaccount_edit_address_endpoint',
'type' => 'text',
'default' => 'edit-address',
@ -156,7 +156,7 @@ class WC_Settings_Accounts extends WC_Settings_Page {
array(
'title' => __( 'Payment Methods', 'woocommerce' ),
'desc' => __( 'Endpoint for the My Account → Payment Methods page', 'woocommerce' ),
'desc' => sprintf( __( 'Endpoint for the My Account → %s page', 'woocommerce' ), __( 'Payment Methods', 'woocommerce' ) ),
'id' => 'woocommerce_myaccount_payment_methods_endpoint',
'type' => 'text',
'default' => 'payment-methods',
@ -165,7 +165,7 @@ class WC_Settings_Accounts extends WC_Settings_Page {
array(
'title' => __( 'Lost Password', 'woocommerce' ),
'desc' => __( 'Endpoint for the My Account → Lost Password page', 'woocommerce' ),
'desc' => sprintf( __( 'Endpoint for the My Account → %s page', 'woocommerce' ), __( 'Lost Password', 'woocommerce' ) ),
'id' => 'woocommerce_myaccount_lost_password_endpoint',
'type' => 'text',
'default' => 'lost-password',

View File

@ -353,7 +353,7 @@ class WC_REST_Customers_Controller extends WC_REST_Controller {
$customer = get_userdata( $id );
if ( empty( $id ) || empty( $customer->ID ) ) {
return new WP_Error( 'woocommerce_rest_invalid_id', __( 'Invalid resource id.', 'woocommerce' ), array( 'status' => 404 ) );
return new WP_Error( 'woocommerce_rest_invalid_id', __( 'Invalid resource ID.', 'woocommerce' ), array( 'status' => 404 ) );
}
$customer = $this->prepare_item_for_response( $customer, $request );
@ -373,7 +373,7 @@ class WC_REST_Customers_Controller extends WC_REST_Controller {
$customer = get_userdata( $id );
if ( ! $customer ) {
return new WP_Error( 'woocommerce_rest_invalid_id', __( 'Invalid resource id.', 'woocommerce' ), array( 'status' => 400 ) );
return new WP_Error( 'woocommerce_rest_invalid_id', __( 'Invalid resource ID.', 'woocommerce' ), array( 'status' => 400 ) );
}
if ( ! empty( $request['email'] ) && email_exists( $request['email'] ) && $request['email'] !== $customer->user_email ) {
@ -837,13 +837,13 @@ class WC_REST_Customers_Controller extends WC_REST_Controller {
$params['context']['default'] = 'view';
$params['exclude'] = array(
'description' => __( 'Ensure result set excludes specific ids.', 'woocommerce' ),
'description' => __( 'Ensure result set excludes specific IDs.', 'woocommerce' ),
'type' => 'array',
'default' => array(),
'sanitize_callback' => 'wp_parse_id_list',
);
$params['include'] = array(
'description' => __( 'Limit result set to specific ids.', 'woocommerce' ),
'description' => __( 'Limit result set to specific IDs.', 'woocommerce' ),
'type' => 'array',
'default' => array(),
'sanitize_callback' => 'wp_parse_id_list',

View File

@ -161,7 +161,7 @@ class WC_REST_Order_Notes_Controller extends WC_REST_Controller {
$order = get_post( (int) $request['order_id'] );
if ( empty( $order->post_type ) || $this->post_type !== $order->post_type ) {
return new WP_Error( 'woocommerce_rest_{$this->post_type}_invalid_id', __( 'Invalid order id.', 'woocommerce' ), array( 'status' => 404 ) );
return new WP_Error( 'woocommerce_rest_{$this->post_type}_invalid_id', __( 'Invalid order ID.', 'woocommerce' ), array( 'status' => 404 ) );
}
$args = array(
@ -200,7 +200,7 @@ class WC_REST_Order_Notes_Controller extends WC_REST_Controller {
$order = get_post( (int) $request['order_id'] );
if ( empty( $order->post_type ) || $this->post_type !== $order->post_type ) {
return new WP_Error( 'woocommerce_rest_order_invalid_id', __( 'Invalid order id.', 'woocommerce' ), array( 'status' => 404 ) );
return new WP_Error( 'woocommerce_rest_order_invalid_id', __( 'Invalid order ID.', 'woocommerce' ), array( 'status' => 404 ) );
}
$order = wc_get_order( $order );
@ -244,13 +244,13 @@ class WC_REST_Order_Notes_Controller extends WC_REST_Controller {
$order = get_post( (int) $request['order_id'] );
if ( empty( $order->post_type ) || $this->post_type !== $order->post_type ) {
return new WP_Error( 'woocommerce_rest_order_invalid_id', __( 'Invalid order id.', 'woocommerce' ), array( 'status' => 404 ) );
return new WP_Error( 'woocommerce_rest_order_invalid_id', __( 'Invalid order ID.', 'woocommerce' ), array( 'status' => 404 ) );
}
$note = get_comment( $id );
if ( empty( $id ) || empty( $note ) || intval( $note->comment_post_ID ) !== intval( $order->ID ) ) {
return new WP_Error( 'woocommerce_rest_invalid_id', __( 'Invalid resource id.', 'woocommerce' ), array( 'status' => 404 ) );
return new WP_Error( 'woocommerce_rest_invalid_id', __( 'Invalid resource ID.', 'woocommerce' ), array( 'status' => 404 ) );
}
$order_note = $this->prepare_item_for_response( $note, $request );
@ -277,13 +277,13 @@ class WC_REST_Order_Notes_Controller extends WC_REST_Controller {
$order = get_post( (int) $request['order_id'] );
if ( empty( $order->post_type ) || $this->post_type !== $order->post_type ) {
return new WP_Error( 'woocommerce_rest_order_invalid_id', __( 'Invalid order id.', 'woocommerce' ), array( 'status' => 404 ) );
return new WP_Error( 'woocommerce_rest_order_invalid_id', __( 'Invalid order ID.', 'woocommerce' ), array( 'status' => 404 ) );
}
$note = get_comment( $id );
if ( empty( $id ) || empty( $note ) || intval( $note->comment_post_ID ) !== intval( $order->ID ) ) {
return new WP_Error( 'woocommerce_rest_invalid_id', __( 'Invalid resource id.', 'woocommerce' ), array( 'status' => 404 ) );
return new WP_Error( 'woocommerce_rest_invalid_id', __( 'Invalid resource ID.', 'woocommerce' ), array( 'status' => 404 ) );
}
$request->set_param( 'context', 'edit' );

View File

@ -182,7 +182,7 @@ class WC_REST_Product_Categories_Controller extends WC_REST_Terms_Controller {
),
),
'parent' => array(
'description' => __( 'The id for the parent of the resource.', 'woocommerce' ),
'description' => __( 'The ID for the parent of the resource.', 'woocommerce' ),
'type' => 'integer',
'context' => array( 'view', 'edit' ),
),

View File

@ -103,7 +103,7 @@ class WC_REST_Product_Reviews_Controller extends WC_REST_Controller {
$product = get_post( (int) $request['product_id'] );
if ( empty( $product->post_type ) || 'product' !== $product->post_type ) {
return new WP_Error( 'woocommerce_rest_product_invalid_id', __( 'Invalid product id.', 'woocommerce' ), array( 'status' => 404 ) );
return new WP_Error( 'woocommerce_rest_product_invalid_id', __( 'Invalid product ID.', 'woocommerce' ), array( 'status' => 404 ) );
}
$reviews = get_approved_comments( $product->ID );
@ -128,13 +128,13 @@ class WC_REST_Product_Reviews_Controller extends WC_REST_Controller {
$product = get_post( (int) $request['product_id'] );
if ( empty( $product->post_type ) || 'product' !== $product->post_type ) {
return new WP_Error( 'woocommerce_rest_product_invalid_id', __( 'Invalid product id.', 'woocommerce' ), array( 'status' => 404 ) );
return new WP_Error( 'woocommerce_rest_product_invalid_id', __( 'Invalid product ID.', 'woocommerce' ), array( 'status' => 404 ) );
}
$review = get_comment( $id );
if ( empty( $id ) || empty( $review ) || intval( $review->comment_post_ID ) !== intval( $product->ID ) ) {
return new WP_Error( 'woocommerce_rest_invalid_id', __( 'Invalid resource id.', 'woocommerce' ), array( 'status' => 404 ) );
return new WP_Error( 'woocommerce_rest_invalid_id', __( 'Invalid resource ID.', 'woocommerce' ), array( 'status' => 404 ) );
}
$delivery = $this->prepare_item_for_response( $review, $request );

View File

@ -1732,7 +1732,7 @@ class WC_REST_Products_Controller extends WC_REST_Posts_Controller {
$post = get_post( $id );
if ( empty( $id ) || empty( $post->ID ) || ! in_array( $post->post_type, $this->get_post_types() ) ) {
return new WP_Error( "woocommerce_rest_{$this->post_type}_invalid_id", __( 'Invalid post id.', 'woocommerce' ), array( 'status' => 404 ) );
return new WP_Error( "woocommerce_rest_{$this->post_type}_invalid_id", __( 'Invalid post ID.', 'woocommerce' ), array( 'status' => 404 ) );
}
$supports_trash = EMPTY_TRASH_DAYS > 0;

View File

@ -389,7 +389,7 @@ class WC_REST_Taxes_Controller extends WC_REST_Controller {
$tax_obj = WC_Tax::_get_tax_rate( $id, OBJECT );
if ( empty( $id ) || empty( $tax_obj ) ) {
return new WP_Error( 'woocommerce_rest_invalid_id', __( 'Invalid resource id.', 'woocommerce' ), array( 'status' => 404 ) );
return new WP_Error( 'woocommerce_rest_invalid_id', __( 'Invalid resource ID.', 'woocommerce' ), array( 'status' => 404 ) );
}
$tax = $this->prepare_item_for_response( $tax_obj, $request );
@ -409,7 +409,7 @@ class WC_REST_Taxes_Controller extends WC_REST_Controller {
$tax_obj = WC_Tax::_get_tax_rate( $id, OBJECT );
if ( empty( $id ) || empty( $tax_obj ) ) {
return new WP_Error( 'woocommerce_rest_invalid_id', __( 'Invalid resource id.', 'woocommerce' ), array( 'status' => 404 ) );
return new WP_Error( 'woocommerce_rest_invalid_id', __( 'Invalid resource ID.', 'woocommerce' ), array( 'status' => 404 ) );
}
$tax = $this->create_or_update_tax( $request, $tax_obj );
@ -452,7 +452,7 @@ class WC_REST_Taxes_Controller extends WC_REST_Controller {
$tax = WC_Tax::_get_tax_rate( $id, OBJECT );
if ( empty( $id ) || empty( $tax ) ) {
return new WP_Error( 'woocommerce_rest_invalid_id', __( 'Invalid resource id.', 'woocommerce' ), array( 'status' => 400 ) );
return new WP_Error( 'woocommerce_rest_invalid_id', __( 'Invalid resource ID.', 'woocommerce' ), array( 'status' => 400 ) );
}
$request->set_param( 'context', 'edit' );
@ -647,13 +647,13 @@ class WC_REST_Taxes_Controller extends WC_REST_Controller {
$params['context']['default'] = 'view';
$params['exclude'] = array(
'description' => __( 'Ensure result set excludes specific ids.', 'woocommerce' ),
'description' => __( 'Ensure result set excludes specific IDs.', 'woocommerce' ),
'type' => 'array',
'default' => array(),
'sanitize_callback' => 'wp_parse_id_list',
);
$params['include'] = array(
'description' => __( 'Limit result set to specific ids.', 'woocommerce' ),
'description' => __( 'Limit result set to specific IDs.', 'woocommerce' ),
'type' => 'array',
'default' => array(),
'sanitize_callback' => 'wp_parse_id_list',

View File

@ -103,7 +103,7 @@ class WC_REST_Webhook_Deliveries_Controller extends WC_REST_Controller {
$webhook = new WC_Webhook( (int) $request['webhook_id'] );
if ( empty( $webhook->post_data->post_type ) || 'shop_webhook' !== $webhook->post_data->post_type ) {
return new WP_Error( 'woocommerce_rest_webhook_invalid_id', __( 'Invalid webhook id.', 'woocommerce' ), array( 'status' => 404 ) );
return new WP_Error( 'woocommerce_rest_webhook_invalid_id', __( 'Invalid webhook ID.', 'woocommerce' ), array( 'status' => 404 ) );
}
$logs = $webhook->get_delivery_logs();
@ -129,13 +129,13 @@ class WC_REST_Webhook_Deliveries_Controller extends WC_REST_Controller {
$webhook = new WC_Webhook( (int) $request['webhook_id'] );
if ( empty( $webhook->post_data->post_type ) || 'shop_webhook' !== $webhook->post_data->post_type ) {
return new WP_Error( 'woocommerce_rest_webhook_invalid_id', __( 'Invalid webhook id.', 'woocommerce' ), array( 'status' => 404 ) );
return new WP_Error( 'woocommerce_rest_webhook_invalid_id', __( 'Invalid webhook ID.', 'woocommerce' ), array( 'status' => 404 ) );
}
$log = $webhook->get_delivery_log( $id );
if ( empty( $id ) || empty( $log ) ) {
return new WP_Error( 'woocommerce_rest_invalid_id', __( 'Invalid resource id.', 'woocommerce' ), array( 'status' => 404 ) );
return new WP_Error( 'woocommerce_rest_invalid_id', __( 'Invalid resource ID.', 'woocommerce' ), array( 'status' => 404 ) );
}
$delivery = $this->prepare_item_for_response( (object) $log, $request );

View File

@ -302,7 +302,7 @@ class WC_REST_Webhooks_Controller extends WC_REST_Posts_Controller {
$post = get_post( $id );
if ( empty( $id ) || empty( $post->ID ) || $this->post_type !== $post->post_type ) {
return new WP_Error( "woocommerce_rest_{$this->post_type}_invalid_id", __( 'Invalid post id.', 'woocommerce' ), array( 'status' => 404 ) );
return new WP_Error( "woocommerce_rest_{$this->post_type}_invalid_id", __( 'Invalid post ID.', 'woocommerce' ), array( 'status' => 404 ) );
}
$request->set_param( 'context', 'edit' );