Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improves translatability of upsells shown after deleting content #20807

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 12 additions & 11 deletions admin/watchers/class-slug-change-watcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,9 @@ public function detect_post_trash( $post_id ) {
$post_label = $this->get_post_type_label( get_post_type( $post_id ) );

/* translators: %1$s expands to the translated name of the post type. */
$first_sentence = sprintf( __( 'You just trashed a %1$s.', 'wordpress-seo' ), $post_label );
$message = $this->get_message( $first_sentence, 'trashed', $post_label );
$first_sentence = sprintf( __( 'You just trashed a %1$s.', 'wordpress-seo' ), $post_label );
$second_sentence = __( 'Search engines and other websites can still send traffic to your trashed content.', 'wordpress-seo' );
$message = $this->get_message( $first_sentence, $second_sentence );

$this->add_notification( $message );
}
Expand All @@ -85,8 +86,9 @@ public function detect_post_delete( $post_id ) {
$post_label = $this->get_post_type_label( get_post_type( $post_id ) );

/* translators: %1$s expands to the translated name of the post type. */
$first_sentence = sprintf( __( 'You just deleted a %1$s.', 'wordpress-seo' ), $post_label );
$message = $this->get_message( $first_sentence, 'deleted', $post_label );
$first_sentence = sprintf( __( 'You just deleted a %1$s.', 'wordpress-seo' ), $post_label );
$second_sentence = __( 'Search engines and other websites can still send traffic to your deleted content.', 'wordpress-seo' );
$message = $this->get_message( $first_sentence, $second_sentence );

$this->add_notification( $message );
}
Expand All @@ -107,8 +109,9 @@ public function detect_term_delete( $term_taxonomy_id ) {
$term_label = $this->get_taxonomy_label_for_term( $term->term_id );

/* translators: %1$s expands to the translated name of the term. */
$first_sentence = sprintf( __( 'You just deleted a %1$s.', 'wordpress-seo' ), $term_label );
$message = $this->get_message( $first_sentence, 'deleted', $term_label );
$first_sentence = sprintf( __( 'You just deleted a %1$s.', 'wordpress-seo' ), $term_label );
$second_sentence = __( 'Search engines and other websites can still send traffic to your deleted content.', 'wordpress-seo' );
$message = $this->get_message( $first_sentence, $second_sentence );

$this->add_notification( $message );
}
Expand Down Expand Up @@ -209,17 +212,15 @@ protected function check_visible_post_status( $post_status ) {
* Returns the message around changed URLs.
*
* @param string $first_sentence The first sentence of the notification.
* @param string $action The action performed, either "deleted" or "trashed".
* @param string $object_label The label of the object that was deleted or trashed.
* @param string $second_sentence The second sentence of the notification.
*
* @return string The full notification.
*/
protected function get_message( $first_sentence, $action, $object_label ) {
protected function get_message( $first_sentence, $second_sentence ) {
return '<h2>' . __( 'Make sure you don\'t miss out on traffic!', 'wordpress-seo' ) . '</h2>'
. '<p>'
. $first_sentence
/* translators: %1$s expands to either "deleted" or "trashed". %2$s expands to the name of the post or term. */
. ' ' . sprintf( __( 'Search engines and other websites can still send traffic to your %1$s %2$s.', 'wordpress-seo' ), $action, $object_label )
. ' ' . $second_sentence
. ' ' . __( 'You should create a redirect to ensure your visitors do not get a 404 error when they click on the no longer working URL.', 'wordpress-seo' )
/* translators: %s expands to Yoast SEO Premium */
. ' ' . sprintf( __( 'With %s, you can easily create such redirects.', 'wordpress-seo' ), 'Yoast SEO Premium' )
Expand Down