diff --git a/assets/js/gutenberg-plugin.js b/assets/js/gutenberg-plugin.js index 8f421f65f..9d4849479 100644 --- a/assets/js/gutenberg-plugin.js +++ b/assets/js/gutenberg-plugin.js @@ -3,7 +3,7 @@ import { pluginIcon } from './components/plugin-icon'; import { Icon } from '@wordpress/components'; import { select, useSelect } from '@wordpress/data'; import { PluginDocumentSettingPanel } from '@wordpress/edit-post'; -import { __, sprintf } from '@wordpress/i18n'; +import { __, _n, _x, sprintf } from '@wordpress/i18n'; import { registerPlugin } from '@wordpress/plugins'; const { document, dtGutenberg, MouseEvent } = window; @@ -62,9 +62,14 @@ const RenderShowAdminBar = () => { } } > { sprintf( - /** translators: 1: Post type or generic term content. */ + /* translators: 1: Post type or generic term content. */ __( 'Distribute %1$s', 'distributor' ), - dtGutenberg.postTypeSingular || 'Content' + dtGutenberg.postTypeSingular || + _x( + 'content', + 'generic term for post content', + 'distributor' + ) ) } @@ -109,10 +114,14 @@ const RenderDistributedTo = () => { return ( { sprintf( - /** translators: 1: Number of connections content distributed to. */ - __( 'Distributed to %1$s connection%2$s.', 'distributor' ), - dtGutenberg.syndicationCount, - '1' === dtGutenberg.syndicationCount ? '' : 's' + /* translators: 1: Number of connections content distributed to. */ + _n( + 'Distributed to %1$s connection.', + 'Distributed to %1$s connections.', + dtGutenberg.syndicationCount * 1, // Syndication count is a string, so we need to convert it to a number. + 'distributor' + ), + dtGutenberg.syndicationCount ) } ); @@ -124,8 +133,11 @@ const RenderDistributedTo = () => { const RenderDistributedFrom = () => { return ( - { __( 'Distributed on: ', 'distributor' ) } - { dtGutenberg.syndicationTime } + { sprintf( + /* translators: 1: Syndication date and time. */ + __( 'Distributed on: %1$s', 'distributor' ), + dtGutenberg.syndicationTime + ) } ); }; diff --git a/assets/js/gutenberg-syndicated-post.js b/assets/js/gutenberg-syndicated-post.js index c307368ca..aa7fb20b6 100644 --- a/assets/js/gutenberg-syndicated-post.js +++ b/assets/js/gutenberg-syndicated-post.js @@ -12,7 +12,7 @@ if ( if ( parseInt( dtGutenberg.originalDelete ) ) { message = sprintf( - /** translators: 1) Distributor post type singular name, 2) Source of content. */ + /* translators: 1) Distributor post type singular name, 2) Source of content. */ __( 'This %1$s was distributed from %2$s. However, the original has been deleted.' ), @@ -21,16 +21,17 @@ if ( ); } else if ( ! parseInt( dtGutenberg.unlinked ) ) { message = sprintf( - /** translators: 1) Source of content. */ + /* translators: 1) Source of content, 2) Distributor post type singular name. */ __( - 'Distributed from %s. The original will update this version unless you', + 'Distributed from %1$s. This %2$s is linked to the original. Edits to the original will update this version.', 'distributor' ), - dtGutenberg.originalLocationName + dtGutenberg.originalLocationName, + dtGutenberg.postTypeSingular ); actions.push( { - label: __( 'unlink from original.', 'distributor' ), + label: __( 'Unlink from original.', 'distributor' ), url: dtGutenberg.unlinkNonceUrl, } ); @@ -40,9 +41,9 @@ if ( } ); } else { message = sprintf( - /** translators: 1) Source of content, 2) Distributor post type singular name. */ + /* translators: 1) Source of content, 2) Distributor post type singular name. */ __( - 'Originally distributed from %1$s. This %2$s has been unlinked from the original. However, you can always', + 'Originally distributed from %1$s. This %2$s has been unlinked from the original. Edits to the original will not update this version.', 'distributor' ), dtGutenberg.originalLocationName, @@ -50,7 +51,7 @@ if ( ); actions.push( { - label: __( 'restore it.', 'distributor' ), + label: __( 'Relink to original.', 'distributor' ), url: dtGutenberg.linkNonceUrl, } ); diff --git a/includes/classes/Authentications/WordPressDotcomOauth2Authentication.php b/includes/classes/Authentications/WordPressDotcomOauth2Authentication.php index 4098af8fc..5407ae733 100644 --- a/includes/classes/Authentications/WordPressDotcomOauth2Authentication.php +++ b/includes/classes/Authentications/WordPressDotcomOauth2Authentication.php @@ -107,10 +107,27 @@ public static function credentials_form( $args = array() ) { ) { ?>
-
+ create an application with the WordPress.com applications manager.', 'distributor' ), + esc_url( 'https://developer.wordpress.com/apps/' ) + ) + ); + ?> +
+ ++ ' . esc_url( admin_url( 'post.php' ) ) . '' + ); + ?> +
parse_type_items_link( $types_body_array[ $post_type ] ); if ( empty( $types_urls[ $post_type ] ) ) { - return new \WP_Error( 'no-pull-post-type', esc_html__( 'Could not determine remote post type endpoint', 'distributor' ) ); + return new \WP_Error( 'no-pull-post-type', esc_html__( 'Could not determine remote post type endpoint.', 'distributor' ) ); } } @@ -332,7 +332,7 @@ public function remote_get( $args = array() ) { $posts_body = wp_remote_retrieve_body( $posts_response ); if ( empty( $posts_body ) ) { - return new \WP_Error( 'no-response-body', esc_html__( 'Response body is empty', 'distributor' ) ); + return new \WP_Error( 'no-response-body', esc_html__( 'Response body is empty.', 'distributor' ) ); } $posts = json_decode( $posts_body, true ); @@ -377,7 +377,7 @@ public function remote_get( $args = array() ) { */ public function remote_post( $url = '', $args = array() ) { if ( ! $url ) { - return new \WP_Error( 'endpoint-error', esc_html__( 'Endpoint URL must be set', 'distributor' ) ); + return new \WP_Error( 'endpoint-error', esc_html__( 'Endpoint URL must be set.', 'distributor' ) ); } /** @@ -440,7 +440,7 @@ public function remote_post( $url = '', $args = array() ) { $response_headers = wp_remote_retrieve_headers( $request ); if ( empty( $posts_body ) ) { - return new \WP_Error( 'no-response-body', esc_html__( 'Response body is empty', 'distributor' ) ); + return new \WP_Error( 'no-response-body', esc_html__( 'Response body is empty.', 'distributor' ) ); } $posts = json_decode( $posts_body, true ); @@ -602,7 +602,7 @@ public function pull( $items ) { */ public function push( $post_id, $args = array() ) { if ( empty( $post_id ) ) { - return new \WP_Error( 'no-push-post-id', esc_html__( 'Post id required to push', 'distributor' ) ); + return new \WP_Error( 'no-push-post-id', esc_html__( 'Post ID required to push.', 'distributor' ) ); } $post = get_post( $post_id ); @@ -629,7 +629,7 @@ public function push( $post_id, $args = array() ) { $body = wp_remote_retrieve_body( $response ); if ( empty( $body ) ) { - return new \WP_Error( 'no-response-body', esc_html__( 'Response body is empty', 'distributor' ) ); + return new \WP_Error( 'no-response-body', esc_html__( 'Response body is empty.', 'distributor' ) ); } $body_array = json_decode( $body, true ); @@ -637,7 +637,7 @@ public function push( $post_id, $args = array() ) { $type_url = $this->parse_type_items_link( $body_array[ $post_type ] ); if ( empty( $type_url ) ) { - return new \WP_Error( 'no-push-post-type', esc_html__( 'Could not determine remote post type endpoint', 'distributor' ) ); + return new \WP_Error( 'no-push-post-type', esc_html__( 'Could not determine remote post type endpoint.', 'distributor' ) ); } $signature = \Distributor\Subscriptions\generate_signature(); @@ -733,13 +733,13 @@ public function push( $post_id, $args = array() ) { $body = wp_remote_retrieve_body( $response ); if ( empty( $body ) ) { - return new \WP_Error( 'no-response-body', esc_html__( 'Response body is empty', 'distributor' ) ); + return new \WP_Error( 'no-response-body', esc_html__( 'Response body is empty.', 'distributor' ) ); } $body_array = json_decode( $body, true ); if ( empty( $body_array['id'] ) ) { - return new \WP_Error( 'no-push-post-remote-id', esc_html__( 'Could not determine remote post id.', 'distributor' ) ); + return new \WP_Error( 'no-push-post-remote-id', esc_html__( 'Could not determine remote post ID.', 'distributor' ) ); } $response_headers = wp_remote_retrieve_headers( $response ); @@ -787,7 +787,7 @@ public function get_post_types() { $types_body = wp_remote_retrieve_body( $types_response ); if ( empty( $types_body ) ) { - return new \WP_Error( 'no-response-body', esc_html__( 'Response body is empty', 'distributor' ) ); + return new \WP_Error( 'no-response-body', esc_html__( 'Response body is empty.', 'distributor' ) ); } $types_body_array = json_decode( $types_body, true ); diff --git a/includes/classes/PullListTable.php b/includes/classes/PullListTable.php index c007ff77f..531d6f408 100644 --- a/includes/classes/PullListTable.php +++ b/includes/classes/PullListTable.php @@ -321,14 +321,14 @@ public function column_name( $item ) { $disable = true; } else { /** - * Filter the default value of the 'Pull in as draft' option in the pull ui + * Filter the default value of the 'Pull as draft' option in the pull ui * * @hook dt_pull_as_draft * - * @param {bool} $as_draft Whether the 'Pull in as draft' option should be checked. + * @param {bool} $as_draft Whether the 'Pull as draft' option should be checked. * @param {object} $connection The connection being used to pull from. * - * @return {bool} Whether the 'Pull in as draft' option should be checked. + * @return {bool} Whether the 'Pull as draft' option should be checked. */ $as_draft = apply_filters( 'dt_pull_as_draft', true, $connection_now ); @@ -639,7 +639,7 @@ public function extra_tablenav( $which ) { ?>